From 48f8ef357cc1b30f4f1e8175d465c05f267f2af5 Mon Sep 17 00:00:00 2001 From: "filip.chytil" Date: Wed, 28 Jan 2026 20:13:30 +0100 Subject: [PATCH] simplify prompt template imports This follows the same pattern used for agents, allowing users to import with: from tinygent.prompts import ReActPromptTemplate, get_prompt_template from tinygent.prompts.react import get_prompt_template Instead of: from tinygent.core.prompts.agents.template.react_agent import ReActPromptTemplate from tinygent.core.prompts.agents.factory.react_agent import get_prompt_template --- README.md | 2 +- docs/api-reference.md | 30 +++---- docs/concepts/agents.md | 6 +- docs/concepts/llms.md | 2 +- docs/concepts/memory.md | 20 ++--- docs/concepts/middleware.md | 16 ++-- docs/concepts/tools.md | 12 +-- docs/examples.md | 2 +- docs/getting-started.md | 4 +- docs/guides/building-agents.md | 14 +-- docs/guides/custom-tools.md | 12 +-- docs/index.md | 8 +- examples/agents/map/README.md | 7 +- examples/agents/map/main.py | 16 ++-- examples/agents/map/quick.py | 2 +- examples/agents/middleware/README.md | 6 +- .../middleware/llm_tool_selector_example.py | 12 ++- examples/agents/middleware/main.py | 24 +++-- .../agents/middleware/tool_limiter_example.py | 6 +- examples/agents/multi-step/README.md | 8 +- examples/agents/multi-step/main.py | 26 +++--- examples/agents/multi-step/quick.py | 2 +- examples/agents/react/README.md | 8 +- examples/agents/react/main.py | 18 ++-- examples/agents/squad/main.py | 32 +++---- examples/agents/squad/quick.py | 2 +- examples/chat-app/main.py | 23 +++-- examples/cross-encoder/main.py | 2 +- examples/embeddings/main.py | 2 +- examples/function-calling/README.md | 8 +- examples/function-calling/main.py | 6 +- examples/knowledge-graph/main.py | 8 +- examples/llm-usage/main.py | 4 +- .../memory/buffer-summary-memory/README.md | 2 +- examples/memory/buffer-summary-memory/main.py | 2 +- examples/memory/combined-memory/README.md | 2 +- examples/memory/combined-memory/main.py | 2 +- examples/tool-usage/README.md | 12 +-- examples/tool-usage/main.py | 10 +-- tinygent/agents/__init__.py | 43 +++++++++ tinygent/agents/map_agent.py | 4 +- tinygent/agents/middleware/__init__.py | 6 +- .../agents/middleware/llm_tool_selector.py | 10 +-- tinygent/agents/multi_step_agent.py | 4 +- tinygent/agents/react_agent.py | 4 +- tinygent/agents/squad_agent.py | 4 +- tinygent/core/datamodels/messages.py | 7 +- tinygent/core/prompts/agents/__init__.py | 0 tinygent/core/types/__init__.py | 32 +++---- tinygent/prompts/__init__.py | 87 ++++++++++++++++++ tinygent/prompts/map.py | 23 +++++ tinygent/prompts/middleware.py | 31 +++++++ tinygent/prompts/multistep.py | 55 ++++++++++++ tinygent/prompts/react.py | 53 +++++++++++ tinygent/prompts/squad.py | 23 +++++ tinygent/utils/__init__.py | 2 - tinygent/utils/answer_validation.py | 6 -- uv.lock | 90 +++++++++---------- 58 files changed, 581 insertions(+), 283 deletions(-) create mode 100644 tinygent/core/prompts/agents/__init__.py create mode 100644 tinygent/prompts/__init__.py create mode 100644 tinygent/prompts/map.py create mode 100644 tinygent/prompts/middleware.py create mode 100644 tinygent/prompts/multistep.py create mode 100644 tinygent/prompts/react.py create mode 100644 tinygent/prompts/squad.py delete mode 100644 tinygent/utils/answer_validation.py diff --git a/README.md b/README.md index 2a0d3b7..751f42e 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Tinygent is a tiny agentic framework - lightweight, easy to use (hopefully), and ```python # uv sync --extra openai -from tinygent.tools.tool import tool +from tinygent.tools import tool from tinygent.core.factory import build_agent @tool diff --git a/docs/api-reference.md b/docs/api-reference.md index cc54d2c..1765664 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -219,7 +219,7 @@ agent = TinyMAPAgent( Create a simple tool. ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool @tool def my_function(param: str) -> str: @@ -234,7 +234,7 @@ def my_function(param: str) -> str: Create and globally register a tool. ```python -from tinygent.tools.tool import register_tool +from tinygent.tools import register_tool @register_tool(use_cache: bool = False, hidden: bool = False) def my_function(param: str) -> str: @@ -254,7 +254,7 @@ def my_function(param: str) -> str: Create a tool requiring reasoning. ```python -from tinygent.tools.reasoning_tool import register_reasoning_tool +from tinygent.tools import register_reasoning_tool @register_reasoning_tool(reasoning_prompt: str) def my_function(param: str) -> str: @@ -273,7 +273,7 @@ def my_function(param: str) -> str: Create a just-in-time code generation tool. ```python -from tinygent.tools.jit_tool import jit_tool +from tinygent.tools import jit_tool @jit_tool(jit_instruction: str) def my_function(param: str): @@ -292,7 +292,7 @@ def my_function(param: str): ### BufferChatMemory ```python -from tinygent.memory.buffer_chat_memory import BufferChatMemory +from tinygent.memory import BufferChatMemory memory = BufferChatMemory() ``` @@ -308,7 +308,7 @@ memory = BufferChatMemory() ### SummaryBufferMemory ```python -from tinygent.memory.summary_buffer_memory import SummaryBufferMemory +from tinygent.memory import SummaryBufferMemory memory = SummaryBufferMemory( llm: BaseLLM, @@ -321,7 +321,7 @@ memory = SummaryBufferMemory( ### WindowBufferMemory ```python -from tinygent.memory.window_buffer_memory import WindowBufferMemory +from tinygent.memory import WindowBufferMemory memory = WindowBufferMemory( window_size: int = 4, @@ -333,7 +333,7 @@ memory = WindowBufferMemory( ### CombinedMemory ```python -from tinygent.memory.combined_memory import CombinedMemory +from tinygent.memory import CombinedMemory memory = CombinedMemory( memories: dict[str, BaseMemory], @@ -347,7 +347,7 @@ memory = CombinedMemory( ### Base Middleware ```python -from tinygent.agents.middleware.base import TinyBaseMiddleware +from tinygent.agents.middleware import TinyBaseMiddleware class CustomMiddleware(TinyBaseMiddleware): def on_start(self, *, run_id: str, task: str) -> None: @@ -386,7 +386,7 @@ class CustomMiddleware(TinyBaseMiddleware): ### Register Middleware ```python -from tinygent.agents.middleware.base import TinyBaseMiddleware +from tinygent.agents.middleware import TinyBaseMiddleware @register_middleware('my_middleware') class MyMiddleware(TinyBaseMiddleware): @@ -424,7 +424,7 @@ Base class for Pydantic models. ```python from pydantic import Field -from tinygent.core.types.base import TinyModel +from tinygent.core.types import TinyModel class MyInput(TinyModel): name: str = Field(..., description='User name') @@ -523,7 +523,7 @@ logger.error("Error message") ### Color Printer ```python -from tinygent.utils.color_printer import TinyColorPrinter +from tinygent.utils import TinyColorPrinter # Predefined colors print(TinyColorPrinter.success("Success!")) @@ -540,7 +540,7 @@ print(TinyColorPrinter.custom("Label", "Message", color="CYAN")) ### YAML Loader ```python -from tinygent.utils.yaml import tiny_yaml_load +from tinygent.utils import tiny_yaml_load config = tiny_yaml_load('config.yaml') ``` @@ -553,11 +553,11 @@ config = tiny_yaml_load('config.yaml') ```python from typing import List, Dict, Optional, Any -from tinygent.core.types.base import TinyModel +from tinygent.core.types import TinyModel from tinygent.core.datamodels.tool import AbstractTool from tinygent.core.datamodels.messages import TinyMessage from tinygent.agents.base import BaseAgent -from tinygent.memory.base import BaseMemory +from tinygent.memory import BaseMemory from tinygent.llms.base import BaseLLM ``` diff --git a/docs/concepts/agents.md b/docs/concepts/agents.md index 15e20cf..45d2f77 100644 --- a/docs/concepts/agents.md +++ b/docs/concepts/agents.md @@ -251,7 +251,7 @@ All agents support common configuration options: ```python from tinygent.agents.react_agent import ReactAgentConfig -from tinygent.memory.buffer_chat_memory import BufferChatMemory +from tinygent.memory import BufferChatMemory config = ReactAgentConfig( llm='openai:gpt-4o-mini', @@ -285,7 +285,7 @@ agent = build_agent( Agents can remember conversation history using memory: ```python -from tinygent.memory.buffer_chat_memory import BufferChatMemory +from tinygent.memory import BufferChatMemory agent = build_agent( 'react', @@ -310,7 +310,7 @@ See [Memory](memory.md) for more details. Customize agent behavior with middleware hooks: ```python -from tinygent.agents.middleware.base import TinyBaseMiddleware +from tinygent.agents.middleware import TinyBaseMiddleware class LoggingMiddleware(TinyBaseMiddleware): def on_reasoning(self, *, run_id: str, reasoning: str) -> None: diff --git a/docs/concepts/llms.md b/docs/concepts/llms.md index 60e77a7..6be64bc 100644 --- a/docs/concepts/llms.md +++ b/docs/concepts/llms.md @@ -316,7 +316,7 @@ LLMs can call functions (tools): ```python from tinygent.core.factory import build_llm -from tinygent.tools.tool import tool +from tinygent.tools import tool @tool def get_weather(location: str) -> str: diff --git a/docs/concepts/memory.md b/docs/concepts/memory.md index ba96e75..86ffcf6 100644 --- a/docs/concepts/memory.md +++ b/docs/concepts/memory.md @@ -21,7 +21,7 @@ agent.run("What is my name?") With memory, agents remember context: ```python -from tinygent.memory.buffer_chat_memory import BufferChatMemory +from tinygent.memory import BufferChatMemory agent = build_agent( 'react', @@ -50,7 +50,7 @@ Tinygent provides 4 built-in memory types: Stores all messages in a list: ```python -from tinygent.memory.buffer_chat_memory import BufferChatMemory +from tinygent.memory import BufferChatMemory memory = BufferChatMemory() @@ -97,7 +97,7 @@ print(memory.load_variables()) Summarizes old messages to save tokens: ```python -from tinygent.memory.summary_buffer_memory import SummaryBufferMemory +from tinygent.memory import SummaryBufferMemory memory = SummaryBufferMemory( llm=build_llm('openai:gpt-4o-mini'), @@ -147,7 +147,7 @@ print(memory.load_variables()) Keeps only the last N messages: ```python -from tinygent.memory.window_buffer_memory import WindowBufferMemory +from tinygent.memory import WindowBufferMemory memory = WindowBufferMemory(window_size=4) # Keep last 4 messages @@ -191,9 +191,9 @@ agent.run("Message 5") Combine different memory types: ```python -from tinygent.memory.combined_memory import CombinedMemory -from tinygent.memory.buffer_chat_memory import BufferChatMemory -from tinygent.memory.window_buffer_memory import WindowBufferMemory +from tinygent.memory import CombinedMemory +from tinygent.memory import BufferChatMemory +from tinygent.memory import WindowBufferMemory # Full history + recent window combined = CombinedMemory( @@ -342,7 +342,7 @@ memory._chat_history.remove_filter('only_human') Create custom memory classes: ```python -from tinygent.memory.base import BaseMemory +from tinygent.memory import BaseMemory class KeywordMemory(BaseMemory): """Memory that only saves messages containing keywords.""" @@ -428,7 +428,7 @@ MultiStep agents benefit from memory: ```python from tinygent.agents.multi_step_agent import TinyMultiStepAgent -from tinygent.memory.buffer_chat_memory import BufferChatMemory +from tinygent.memory import BufferChatMemory agent = TinyMultiStepAgent( llm=build_llm('openai:gpt-4o'), @@ -502,7 +502,7 @@ memory = WindowBufferMemory(window_size=4) Track memory changes with middleware: ```python -from tinygent.agents.middleware.base import TinyBaseMiddleware +from tinygent.agents.middleware import TinyBaseMiddleware class MemoryMonitorMiddleware(TinyBaseMiddleware): def on_answer(self, *, run_id: str, answer: str) -> None: diff --git a/docs/concepts/middleware.md b/docs/concepts/middleware.md index ca0984d..8118429 100644 --- a/docs/concepts/middleware.md +++ b/docs/concepts/middleware.md @@ -21,7 +21,7 @@ Think of middleware as **event listeners** for agent operations. ## Basic Example ```python -from tinygent.agents.middleware.base import TinyBaseMiddleware +from tinygent.agents.middleware import TinyBaseMiddleware class LoggingMiddleware(TinyBaseMiddleware): def on_reasoning(self, *, run_id: str, reasoning: str, **kwargs) -> None: @@ -131,7 +131,7 @@ Track the Thought-Action-Observation cycle: ```python from typing import Any -from tinygent.agents.middleware.base import TinyBaseMiddleware +from tinygent.agents.middleware import TinyBaseMiddleware class ReActCycleMiddleware(TinyBaseMiddleware): def __init__(self) -> None: @@ -361,7 +361,7 @@ agent = build_agent( Make middleware reusable: ```python -from tinygent.agents.middleware.base import TinyBaseMiddleware +from tinygent.agents.middleware import TinyBaseMiddleware @register_middleware('logging') class LoggingMiddleware(TinyBaseMiddleware): @@ -638,7 +638,7 @@ middleware = [ **Using Config Factory:** ```python -from tinygent.agents.middleware.tool_limiter import TinyToolCallLimiterMiddlewareConfig +from tinygent.agents.middleware import TinyToolCallLimiterMiddlewareConfig # Create via config config = TinyToolCallLimiterMiddlewareConfig( @@ -726,9 +726,7 @@ selector = TinyLLMToolSelectorMiddleware( **Custom Prompt Template:** ```python -from tinygent.core.prompts.agents.middleware.template.llm_tool_selector import ( - LLMToolSelectorPromptTemplate -) +from tinygent.prompts.middleware import LLMToolSelectorPromptTemplate custom_prompt = LLMToolSelectorPromptTemplate( system="You are a tool selection expert. Select only the most relevant tools.", @@ -745,9 +743,7 @@ selector = TinyLLMToolSelectorMiddleware( **Using Config Factory:** ```python -from tinygent.agents.middleware.llm_tool_selector import ( - TinyLLMToolSelectorMiddlewareConfig -) +from tinygent.agents.middleware import TinyLLMToolSelectorMiddlewareConfig # Create via config config = TinyLLMToolSelectorMiddlewareConfig( diff --git a/docs/concepts/tools.md b/docs/concepts/tools.md index 6ae84ba..222e7ea 100644 --- a/docs/concepts/tools.md +++ b/docs/concepts/tools.md @@ -16,7 +16,7 @@ A tool is a **Python function** that: **Example:** ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool @tool def get_weather(location: str) -> str: @@ -50,7 +50,7 @@ Tinygent provides 4 tool decorators for different use cases: **Best for**: Quick local tools, no global registration needed ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool @tool def calculator(expression: str) -> float: @@ -81,7 +81,7 @@ agent = build_agent('react', llm='openai:gpt-4o-mini', tools=[calculator]) **Best for**: Reusable tools, CLI usage, multi-agent systems ```python -from tinygent.tools.tool import register_tool +from tinygent.tools import register_tool @register_tool(use_cache=True) def search_web(query: str) -> str: @@ -136,7 +136,7 @@ expensive_api_call.clear_cache() Reasoning tools require the agent to provide a rationale before calling: ```python -from tinygent.tools.reasoning_tool import register_reasoning_tool +from tinygent.tools import register_reasoning_tool @register_reasoning_tool( reasoning_prompt='Explain why you are performing this search.' @@ -170,7 +170,7 @@ Observation: Found user record for John Doe JIT tools generate and execute code at runtime based on agent instructions: ```python -from tinygent.tools.jit_tool import jit_tool +from tinygent.tools import jit_tool @jit_tool(jit_instruction='Generate code to count from 1 to n, yielding each number.') def count(n: int): @@ -200,7 +200,7 @@ Tools can accept two input styles: ```python from pydantic import Field -from tinygent.core.types.base import TinyModel +from tinygent.core.types import TinyModel class WeatherInput(TinyModel): location: str = Field(..., description='The city or location') diff --git a/docs/examples.md b/docs/examples.md index 0b97665..40072d3 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -9,7 +9,7 @@ Explore practical examples of Tinygent in action. ### Simple Weather Agent ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool from tinygent.core.factory import build_agent @tool diff --git a/docs/getting-started.md b/docs/getting-started.md index 00fc11f..389aba5 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -132,7 +132,7 @@ Let's build a simple weather assistant. Tools are functions that agents can call. Use the `@tool` decorator: ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool @tool def get_weather(location: str) -> str: @@ -184,7 +184,7 @@ asyncio.run(main()) ```python # weather_agent.py -from tinygent.tools.tool import tool +from tinygent.tools import tool from tinygent.core.factory import build_agent @tool diff --git a/docs/guides/building-agents.md b/docs/guides/building-agents.md index 374eb96..905197d 100644 --- a/docs/guides/building-agents.md +++ b/docs/guides/building-agents.md @@ -11,7 +11,7 @@ A comprehensive guide to building agents with Tinygent. The fastest way to create an agent: ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool from tinygent.core.factory import build_agent @tool @@ -39,8 +39,8 @@ Let's build a complete travel planning agent. ```python from pydantic import Field -from tinygent.core.types.base import TinyModel -from tinygent.tools.tool import register_tool +from tinygent.core.types import TinyModel +from tinygent.tools import register_tool class WeatherInput(TinyModel): location: str = Field(..., description='City or location name') @@ -80,7 +80,7 @@ def search_hotels(data: HotelInput) -> str: ```python from tinygent.core.factory import build_agent -from tinygent.memory.buffer_chat_memory import BufferChatMemory +from tinygent.memory import BufferChatMemory agent = build_agent( 'react', @@ -94,7 +94,7 @@ agent = build_agent( ### Step 3: Add Middleware for Logging ```python -from tinygent.agents.middleware.base import TinyBaseMiddleware +from tinygent.agents.middleware import TinyBaseMiddleware class TravelAgentMiddleware(TinyBaseMiddleware): def on_reasoning(self, *, run_id: str, reasoning: str) -> None: @@ -141,7 +141,7 @@ For complex workflows, use MultiStep agent: ```python from tinygent.agents.multi_step_agent import TinyMultiStepAgent from tinygent.core.factory import build_llm -from tinygent.core.prompts.agents.template.multi_agent import ( +from tinygent.prompts.multistep import ( MultiStepPromptTemplate, PlanPromptTemplate, ActionPromptTemplate, @@ -331,7 +331,7 @@ Before deploying to production: ### Pattern 1: Conversational Agent ```python -from tinygent.memory.buffer_chat_memory import BufferChatMemory +from tinygent.memory import BufferChatMemory agent = build_agent( 'react', diff --git a/docs/guides/custom-tools.md b/docs/guides/custom-tools.md index 62dead2..58d4c03 100644 --- a/docs/guides/custom-tools.md +++ b/docs/guides/custom-tools.md @@ -7,7 +7,7 @@ A comprehensive guide to creating powerful custom tools for your agents. ## Quick Start ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool @tool def hello_world(name: str) -> str: @@ -32,7 +32,7 @@ Every tool needs three things: 3. **Docstring**: Describes what the tool does ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool @tool # 1. Decorator def search_database(query: str, limit: int = 10) -> list[dict]: # 2. Type hints @@ -105,8 +105,8 @@ For complex validation and documentation: ```python from pydantic import Field, field_validator, EmailStr -from tinygent.core.types.base import TinyModel -from tinygent.tools.tool import register_tool +from tinygent.core.types import TinyModel +from tinygent.tools import register_tool class EmailInput(TinyModel): to: EmailStr = Field(..., description='Recipient email address') @@ -245,7 +245,7 @@ expensive_computation.clear_cache() Require the agent to explain its reasoning: ```python -from tinygent.tools.reasoning_tool import register_reasoning_tool +from tinygent.tools import register_reasoning_tool @register_reasoning_tool( reasoning_prompt='Explain why you need to delete this record.' @@ -275,7 +275,7 @@ def delete_record(record_id: int) -> str: Generate code at runtime: ```python -from tinygent.tools.jit_tool import jit_tool +from tinygent.tools import jit_tool @jit_tool( jit_instruction='Generate code to process data according to user requirements.' diff --git a/docs/index.md b/docs/index.md index 8a93cf0..6da40be 100644 --- a/docs/index.md +++ b/docs/index.md @@ -21,7 +21,7 @@ Built with modern Python best practices, Tinygent provides: Tinygent follows the principle of progressive disclosure - start simple, grow complex only when needed. ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool from tinygent.core.factory import build_agent @tool @@ -95,7 +95,7 @@ agent = config.build() Components auto-register for global discovery: ```python -from tinygent.tools.tool import register_tool +from tinygent.tools import register_tool @register_tool def search(query: str) -> str: @@ -131,7 +131,7 @@ Built with Pydantic for runtime validation and excellent IDE support: ```python from pydantic import Field -from tinygent.core.types.base import TinyModel +from tinygent.core.types import TinyModel class WeatherInput(TinyModel): location: str = Field(..., description='The location to get weather for') @@ -169,7 +169,7 @@ uv sync --extra openai Create a file `my_agent.py`: ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool from tinygent.core.factory import build_agent @tool diff --git a/examples/agents/map/README.md b/examples/agents/map/README.md index 5a0a889..6ccc751 100644 --- a/examples/agents/map/README.md +++ b/examples/agents/map/README.md @@ -168,10 +168,11 @@ tiny \ ```python from pathlib import Path -from tinygent.agents.map_agent import MapPromptTemplate, TinyMAPAgent +from tinygent.agents import TinyMAPAgent +from tinygent.agents.map_agent import MapPromptTemplate from tinygent.core.factory import build_llm -from tinygent.memory.buffer_chat_memory import BufferChatMemory -from tinygent.utils.yaml import tiny_yaml_load +from tinygent.memory import BufferChatMemory +from tinygent.utils import tiny_yaml_load # Load prompt templates map_agent_prompt = tiny_yaml_load(str(Path(__file__).parent / 'prompts.yaml')) diff --git a/examples/agents/map/main.py b/examples/agents/map/main.py index 3f3b610..2fe04c2 100644 --- a/examples/agents/map/main.py +++ b/examples/agents/map/main.py @@ -1,16 +1,16 @@ from pathlib import Path from typing import Any -from tinygent.agents.map_agent import MapPromptTemplate -from tinygent.agents.map_agent import TinyMAPAgent -from tinygent.agents.middleware.base import TinyBaseMiddleware -from tinygent.agents.middleware.base import register_middleware +from tinygent.agents import TinyMAPAgent +from tinygent.agents.middleware import TinyBaseMiddleware +from tinygent.agents.middleware import register_middleware from tinygent.core.factory import build_llm -from tinygent.core.types.io.llm_io_input import TinyLLMInput +from tinygent.core.types import TinyLLMInput from tinygent.logging import setup_logger -from tinygent.memory.buffer_chat_memory import BufferChatMemory -from tinygent.utils.color_printer import TinyColorPrinter -from tinygent.utils.yaml import tiny_yaml_load +from tinygent.memory import BufferChatMemory +from tinygent.prompts import MapPromptTemplate +from tinygent.utils import TinyColorPrinter +from tinygent.utils import tiny_yaml_load logger = setup_logger('debug') diff --git a/examples/agents/map/quick.py b/examples/agents/map/quick.py index 56512b8..e4985b0 100644 --- a/examples/agents/map/quick.py +++ b/examples/agents/map/quick.py @@ -3,7 +3,7 @@ from tinygent.cli.utils import discover_and_register_components from tinygent.core.factory import build_agent from tinygent.logging import setup_logger -from tinygent.utils.yaml import tiny_yaml_load +from tinygent.utils import tiny_yaml_load logger = setup_logger('debug') diff --git a/examples/agents/middleware/README.md b/examples/agents/middleware/README.md index 313ba16..f203c06 100644 --- a/examples/agents/middleware/README.md +++ b/examples/agents/middleware/README.md @@ -17,7 +17,7 @@ Middleware in TinyGent follows a class-based pattern. You create custom middlewa ### Creating Custom Middleware ```python -from tinygent.agents.middleware.base import TinyBaseMiddleware +from tinygent.agents.middleware import TinyBaseMiddleware class LoggingMiddleware(TinyBaseMiddleware): def before_llm_call(self, *, run_id: str, llm_input: TinyLLMInput): @@ -52,8 +52,8 @@ class LoggingMiddleware(TinyBaseMiddleware): Use `TinyMiddlewareAgent` to combine multiple middleware instances: ```python -from tinygent.agents.middleware.agent import TinyMiddlewareAgent -from tinygent.agents.middleware.base import TinyBaseMiddleware +from tinygent.agents.middleware import TinyMiddlewareAgent +from tinygent.agents.middleware import TinyBaseMiddleware class LoggingMiddleware(TinyBaseMiddleware): def on_answer(self, *, run_id: str, answer: str): diff --git a/examples/agents/middleware/llm_tool_selector_example.py b/examples/agents/middleware/llm_tool_selector_example.py index 086edb7..66426e1 100644 --- a/examples/agents/middleware/llm_tool_selector_example.py +++ b/examples/agents/middleware/llm_tool_selector_example.py @@ -1,12 +1,10 @@ from pydantic import Field -from tinygent.agents.middleware.llm_tool_selector import ( - TinyLLMToolSelectorMiddlewareConfig, -) -from tinygent.core.factory.agent import build_agent -from tinygent.core.factory.llm import build_llm -from tinygent.core.factory.middleware import build_middleware -from tinygent.core.types.base import TinyModel +from tinygent.agents.middleware import TinyLLMToolSelectorMiddlewareConfig +from tinygent.core.factory import build_agent +from tinygent.core.factory import build_llm +from tinygent.core.factory import build_middleware +from tinygent.core.types import TinyModel from tinygent.logging import setup_logger from tinygent.tools import reasoning_tool diff --git a/examples/agents/middleware/main.py b/examples/agents/middleware/main.py index 388e737..2043b55 100644 --- a/examples/agents/middleware/main.py +++ b/examples/agents/middleware/main.py @@ -3,22 +3,20 @@ from pydantic import Field -from tinygent.agents.middleware.base import TinyBaseMiddleware -from tinygent.agents.middleware.base import register_middleware -from tinygent.agents.multi_step_agent import TinyMultiStepAgent +from tinygent.agents import TinyMultiStepAgent +from tinygent.agents.middleware import TinyBaseMiddleware +from tinygent.agents.middleware import register_middleware from tinygent.core.datamodels.tool import AbstractTool from tinygent.core.factory import build_llm -from tinygent.core.prompts.agents.template.multi_agent import ActionPromptTemplate -from tinygent.core.prompts.agents.template.multi_agent import ( - FallbackAnswerPromptTemplate, -) -from tinygent.core.prompts.agents.template.multi_agent import MultiStepPromptTemplate -from tinygent.core.prompts.agents.template.multi_agent import PlanPromptTemplate -from tinygent.core.types.base import TinyModel -from tinygent.core.types.io.llm_io_input import TinyLLMInput -from tinygent.memory.buffer_chat_memory import BufferChatMemory +from tinygent.core.types import TinyLLMInput +from tinygent.core.types import TinyModel +from tinygent.memory import BufferChatMemory +from tinygent.prompts.multistep import ActionPromptTemplate +from tinygent.prompts.multistep import FallbackAnswerPromptTemplate +from tinygent.prompts.multistep import MultiStepPromptTemplate +from tinygent.prompts.multistep import PlanPromptTemplate from tinygent.tools import reasoning_tool -from tinygent.utils.color_printer import TinyColorPrinter +from tinygent.utils import TinyColorPrinter class GreetInput(TinyModel): diff --git a/examples/agents/middleware/tool_limiter_example.py b/examples/agents/middleware/tool_limiter_example.py index c7032be..8833759 100644 --- a/examples/agents/middleware/tool_limiter_example.py +++ b/examples/agents/middleware/tool_limiter_example.py @@ -1,8 +1,8 @@ from pydantic import Field -from tinygent.agents.middleware.tool_limiter import TinyToolCallLimiterMiddleware -from tinygent.core.factory.agent import build_agent -from tinygent.core.types.base import TinyModel +from tinygent.agents.middleware import TinyToolCallLimiterMiddleware +from tinygent.core.factory import build_agent +from tinygent.core.types import TinyModel from tinygent.logging import setup_logger from tinygent.tools import reasoning_tool diff --git a/examples/agents/multi-step/README.md b/examples/agents/multi-step/README.md index 190b86e..06c0bac 100644 --- a/examples/agents/multi-step/README.md +++ b/examples/agents/multi-step/README.md @@ -88,8 +88,8 @@ tiny \ ## Example Tools ```python -from tinygent.tools.tool import tool -from tinygent.core.types.base import TinyModel +from tinygent.tools import tool +from tinygent.core.types import TinyModel from pydantic import Field class WeatherInput(TinyModel): @@ -116,16 +116,16 @@ def get_best_destination(data: GetBestDestinationInput) -> list[str]: ```python from pathlib import Path +from tinygent.agents import TinyMultiStepAgent from tinygent.agents.multi_step_agent import ( ActionPromptTemplate, FinalAnswerPromptTemplate, PlanPromptTemplate, MultiStepPromptTemplate, - TinyMultiStepAgent, ) from tinygent.llms import OpenAILLM from tinygent.memory import BufferChatMemory -from tinygent.utils.yaml import tiny_yaml_load +from tinygent.utils import tiny_yaml_load multi_step_agent_prompt = tiny_yaml_load(str(Path(__file__).parent / "agent.yaml")) diff --git a/examples/agents/multi-step/main.py b/examples/agents/multi-step/main.py index 8574125..289bb70 100644 --- a/examples/agents/multi-step/main.py +++ b/examples/agents/multi-step/main.py @@ -3,22 +3,22 @@ from pydantic import Field -from tinygent.agents.middleware.base import TinyBaseMiddleware -from tinygent.agents.middleware.base import register_middleware -from tinygent.agents.multi_step_agent import MultiStepPromptTemplate -from tinygent.agents.multi_step_agent import TinyMultiStepAgent +from tinygent.agents import TinyMultiStepAgent +from tinygent.agents.middleware import TinyBaseMiddleware +from tinygent.agents.middleware import register_middleware from tinygent.core.datamodels.tool import AbstractTool from tinygent.core.factory import build_llm -from tinygent.core.types.base import TinyModel -from tinygent.core.types.io.llm_io_input import TinyLLMInput +from tinygent.core.types import TinyLLMInput +from tinygent.core.types import TinyModel from tinygent.logging import setup_logger -from tinygent.memory.buffer_chat_memory import BufferChatMemory -from tinygent.memory.buffer_window_chat_memory import BufferWindowChatMemory -from tinygent.memory.combined_memory import CombinedMemory -from tinygent.tools.reasoning_tool import register_reasoning_tool -from tinygent.tools.tool import register_tool -from tinygent.utils.color_printer import TinyColorPrinter -from tinygent.utils.yaml import tiny_yaml_load +from tinygent.memory import BufferChatMemory +from tinygent.memory import BufferWindowChatMemory +from tinygent.memory import CombinedMemory +from tinygent.prompts import MultiStepPromptTemplate +from tinygent.tools import register_reasoning_tool +from tinygent.tools import register_tool +from tinygent.utils import TinyColorPrinter +from tinygent.utils import tiny_yaml_load logger = setup_logger('debug') diff --git a/examples/agents/multi-step/quick.py b/examples/agents/multi-step/quick.py index e6c793b..4fa48cc 100644 --- a/examples/agents/multi-step/quick.py +++ b/examples/agents/multi-step/quick.py @@ -3,7 +3,7 @@ from tinygent.cli.utils import discover_and_register_components from tinygent.core.factory import build_agent from tinygent.logging import setup_logger -from tinygent.utils.yaml import tiny_yaml_load +from tinygent.utils import tiny_yaml_load logger = setup_logger('debug') diff --git a/examples/agents/react/README.md b/examples/agents/react/README.md index 6fe86bf..91b484f 100644 --- a/examples/agents/react/README.md +++ b/examples/agents/react/README.md @@ -91,8 +91,8 @@ tiny \ ## Example Tools ```python -from tinygent.tools.tool import tool -from tinygent.core.types.base import TinyModel +from tinygent.tools import tool +from tinygent.core.types import TinyModel from pydantic import Field class WeatherInput(TinyModel): @@ -120,14 +120,14 @@ def get_best_destination(data: GetBestDestinationInput) -> list[str]: ```python from pathlib import Path +from tinygent.agents import TinyReActAgent from tinygent.agents.react_agent import ( ActionPromptTemplate, ReasonPromptTemplate, ReActPromptTemplate, - TinyReActAgent, ) from tinygent.llms import OpenAILLM -from tinygent.utils.yaml import tiny_yaml_load +from tinygent.utils import tiny_yaml_load react_agent_prompt = tiny_yaml_load(str(Path(__file__).parent / 'prompts.yaml')) diff --git a/examples/agents/react/main.py b/examples/agents/react/main.py index 51b4962..6ae176d 100644 --- a/examples/agents/react/main.py +++ b/examples/agents/react/main.py @@ -3,18 +3,18 @@ from pydantic import Field -from tinygent.agents.middleware.base import TinyBaseMiddleware -from tinygent.agents.middleware.base import register_middleware -from tinygent.agents.react_agent import ReActPromptTemplate -from tinygent.agents.react_agent import TinyReActAgent +from tinygent.agents import TinyReActAgent +from tinygent.agents.middleware import TinyBaseMiddleware +from tinygent.agents.middleware import register_middleware from tinygent.core.datamodels.tool import AbstractTool from tinygent.core.factory import build_llm -from tinygent.core.types.base import TinyModel +from tinygent.core.types import TinyModel from tinygent.logging import setup_logger -from tinygent.memory.buffer_chat_memory import BufferChatMemory -from tinygent.tools.tool import register_tool -from tinygent.utils.color_printer import TinyColorPrinter -from tinygent.utils.yaml import tiny_yaml_load +from tinygent.memory import BufferChatMemory +from tinygent.prompts import ReActPromptTemplate +from tinygent.tools import register_tool +from tinygent.utils import TinyColorPrinter +from tinygent.utils import tiny_yaml_load logger = setup_logger('debug') diff --git a/examples/agents/squad/main.py b/examples/agents/squad/main.py index efbb106..a5cdb4d 100644 --- a/examples/agents/squad/main.py +++ b/examples/agents/squad/main.py @@ -3,26 +3,26 @@ from pydantic import Field -from tinygent.agents.middleware.base import TinyBaseMiddleware -from tinygent.agents.middleware.base import register_middleware -from tinygent.agents.multi_step_agent import MultiStepPromptTemplate -from tinygent.agents.multi_step_agent import TinyMultiStepAgent -from tinygent.agents.react_agent import ReActPromptTemplate -from tinygent.agents.react_agent import TinyReActAgent +from tinygent.agents import TinyMultiStepAgent +from tinygent.agents import TinyReActAgent +from tinygent.agents import TinySquadAgent +from tinygent.agents.middleware import TinyBaseMiddleware +from tinygent.agents.middleware import register_middleware from tinygent.agents.squad_agent import AgentSquadMember -from tinygent.agents.squad_agent import SquadPromptTemplate -from tinygent.agents.squad_agent import TinySquadAgent from tinygent.core.datamodels.tool import AbstractTool from tinygent.core.factory import build_llm -from tinygent.core.types.base import TinyModel -from tinygent.core.types.io.llm_io_input import TinyLLMInput +from tinygent.core.types import TinyLLMInput +from tinygent.core.types import TinyModel from tinygent.logging import setup_logger -from tinygent.memory.buffer_chat_memory import BufferChatMemory -from tinygent.memory.buffer_window_chat_memory import BufferWindowChatMemory -from tinygent.tools.reasoning_tool import register_reasoning_tool -from tinygent.tools.tool import register_tool -from tinygent.utils.color_printer import TinyColorPrinter -from tinygent.utils.yaml import tiny_yaml_load +from tinygent.memory import BufferChatMemory +from tinygent.memory import BufferWindowChatMemory +from tinygent.prompts import MultiStepPromptTemplate +from tinygent.prompts import ReActPromptTemplate +from tinygent.prompts import SquadPromptTemplate +from tinygent.tools import register_reasoning_tool +from tinygent.tools import register_tool +from tinygent.utils import TinyColorPrinter +from tinygent.utils import tiny_yaml_load logger = setup_logger('debug') diff --git a/examples/agents/squad/quick.py b/examples/agents/squad/quick.py index 3eebbf2..ca20227 100644 --- a/examples/agents/squad/quick.py +++ b/examples/agents/squad/quick.py @@ -3,7 +3,7 @@ from tinygent.cli.utils import discover_and_register_components from tinygent.core.factory import build_agent from tinygent.logging import setup_logger -from tinygent.utils.yaml import tiny_yaml_load +from tinygent.utils import tiny_yaml_load logger = setup_logger('debug') diff --git a/examples/chat-app/main.py b/examples/chat-app/main.py index bae0d77..82e3b43 100644 --- a/examples/chat-app/main.py +++ b/examples/chat-app/main.py @@ -8,17 +8,17 @@ from tiny_brave import NewsSearchRequest from tiny_brave import brave_news_search import tiny_chat as tc -from tinygent.agents.middleware.base import TinyBaseMiddleware -from tinygent.agents.react_agent import ReActPromptTemplate -from tinygent.agents.react_agent import TinyReActAgent +from tinygent.agents import TinyReActAgent +from tinygent.agents.middleware import TinyBaseMiddleware from tinygent.cli.utils import discover_and_register_components from tinygent.core.datamodels.tool import AbstractTool from tinygent.core.factory import build_llm -from tinygent.core.types.base import TinyModel +from tinygent.core.types import TinyModel from tinygent.logging import setup_logger -from tinygent.memory.buffer_chat_memory import BufferChatMemory -from tinygent.tools.tool import register_tool -from tinygent.utils.yaml import tiny_yaml_load +from tinygent.memory import BufferChatMemory +from tinygent.prompts import ReActPromptTemplate +from tinygent.tools import register_tool +from tinygent.utils import tiny_yaml_load logger = setup_logger('debug') @@ -37,13 +37,17 @@ async def brave_news(data: BraveNewsConfig): class ChatClientMiddleware(TinyBaseMiddleware): - async def on_answer(self, *, run_id: str, answer: str) -> None: + async def on_answer( + self, *, run_id: str, answer: str, kwargs: dict[str, Any] + ) -> None: await tc.AgentMessage( id=run_id, content=answer, ).send() - async def on_answer_chunk(self, *, run_id: str, chunk: str, idx: str) -> None: + async def on_answer_chunk( + self, *, run_id: str, chunk: str, idx: str, kwargs: dict[str, Any] + ) -> None: await tc.AgentMessageChunk( id=run_id, content=chunk, @@ -56,6 +60,7 @@ async def after_tool_call( tool: AbstractTool, args: dict[str, Any], result: Any, + kwargs: dict[str, Any], ) -> None: await tc.AgentToolCallMessage( id=str(uuid.uuid4()), diff --git a/examples/cross-encoder/main.py b/examples/cross-encoder/main.py index 248fdef..c630806 100644 --- a/examples/cross-encoder/main.py +++ b/examples/cross-encoder/main.py @@ -1,6 +1,6 @@ import asyncio -from tinygent.core.factory.cross_encoder import build_cross_encoder +from tinygent.core.factory import build_cross_encoder def _print_results(results: list[tuple[tuple[str, str], float]], title: str): diff --git a/examples/embeddings/main.py b/examples/embeddings/main.py index c0fe9d8..8844ae9 100644 --- a/examples/embeddings/main.py +++ b/examples/embeddings/main.py @@ -1,4 +1,4 @@ -from tinygent.core.factory.embedder import build_embedder +from tinygent.core.factory import build_embedder def _print_res(embeddings: list[float], n: int = 3) -> str: diff --git a/examples/function-calling/README.md b/examples/function-calling/README.md index 1bbaade..94069f0 100644 --- a/examples/function-calling/README.md +++ b/examples/function-calling/README.md @@ -29,8 +29,8 @@ Pass a single `TinyModel` subclass for full control over field descriptions: ```python from pydantic import Field -from tinygent.core.types.base import TinyModel -from tinygent.tools.tool import tool +from tinygent.core.types import TinyModel +from tinygent.tools import tool class GetWeatherInput(TinyModel): @@ -48,7 +48,7 @@ def get_weather(data: GetWeatherInput) -> str: Pass parameters directly like any normal function — TinyGent auto-generates the schema: ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool @tool @@ -66,7 +66,7 @@ Both variants work identically with LLM function calling — the schema is gener Ask the model a question and provide a list of tools it can choose from. The model may return plain chat content or one or more tool calls. ```python -from tinygent.core.types.io.llm_io_input import TinyLLMInput +from tinygent.core.types import TinyLLMInput from tinygent.core.datamodels.messages import TinyHumanMessage from tinygent.llms import OpenAILLM diff --git a/examples/function-calling/main.py b/examples/function-calling/main.py index e50a8a5..222f90d 100644 --- a/examples/function-calling/main.py +++ b/examples/function-calling/main.py @@ -2,9 +2,9 @@ from tinygent.core.datamodels.messages import TinyHumanMessage from tinygent.core.factory import build_llm -from tinygent.core.types.base import TinyModel # Only needed for Variant 1 -from tinygent.core.types.io.llm_io_input import TinyLLMInput -from tinygent.tools.tool import tool +from tinygent.core.types import TinyLLMInput +from tinygent.core.types import TinyModel # Only needed for Variant 1 +from tinygent.tools import tool # Variant 1: TinyModel descriptor (explicit schema with field descriptions) diff --git a/examples/knowledge-graph/main.py b/examples/knowledge-graph/main.py index 6ee3825..8896cee 100644 --- a/examples/knowledge-graph/main.py +++ b/examples/knowledge-graph/main.py @@ -9,10 +9,10 @@ from tiny_graph.graph.multi_layer_graph.search.search_presets import ( NODE_HYBRID_SEARCH_RRF, ) -from tinygent.core.factory.cross_encoder import build_cross_encoder -from tinygent.core.factory.embedder import build_embedder -from tinygent.core.factory.llm import build_llm -from tinygent.core.types.base import TinyModel +from tinygent.core.factory import build_cross_encoder +from tinygent.core.factory import build_embedder +from tinygent.core.factory import build_llm +from tinygent.core.types import TinyModel from tinygent.logging import setup_logger logger = setup_logger('debug') diff --git a/examples/llm-usage/main.py b/examples/llm-usage/main.py index cf22005..af3718b 100644 --- a/examples/llm-usage/main.py +++ b/examples/llm-usage/main.py @@ -3,8 +3,8 @@ from tinygent.core.datamodels.messages import TinyHumanMessage from tinygent.core.datamodels.messages import TinySystemMessage from tinygent.core.factory import build_llm -from tinygent.core.types.base import TinyModel -from tinygent.core.types.io.llm_io_input import TinyLLMInput +from tinygent.core.types import TinyLLMInput +from tinygent.core.types import TinyModel from tinygent.tools import reasoning_tool from tinygent.tools import tool diff --git a/examples/memory/buffer-summary-memory/README.md b/examples/memory/buffer-summary-memory/README.md index a1aa722..398754d 100644 --- a/examples/memory/buffer-summary-memory/README.md +++ b/examples/memory/buffer-summary-memory/README.md @@ -30,7 +30,7 @@ ```python from tinygent.core.datamodels.messages import TinyChatMessage, TinyHumanMessage, TinyPlanMessage -from tinygent.core.factory.llm import build_llm +from tinygent.core.factory import build_llm from tinygent.memory import BufferSummaryChatMemory memory = BufferSummaryChatMemory( diff --git a/examples/memory/buffer-summary-memory/main.py b/examples/memory/buffer-summary-memory/main.py index 531943c..bec138f 100644 --- a/examples/memory/buffer-summary-memory/main.py +++ b/examples/memory/buffer-summary-memory/main.py @@ -1,7 +1,7 @@ from tinygent.core.datamodels.messages import TinyChatMessage from tinygent.core.datamodels.messages import TinyHumanMessage from tinygent.core.datamodels.messages import TinyPlanMessage -from tinygent.core.factory.llm import build_llm +from tinygent.core.factory import build_llm from tinygent.memory import BufferSummaryChatMemory diff --git a/examples/memory/combined-memory/README.md b/examples/memory/combined-memory/README.md index 6376f52..761760d 100644 --- a/examples/memory/combined-memory/README.md +++ b/examples/memory/combined-memory/README.md @@ -36,7 +36,7 @@ Async variants (`asave_context`, `aload_variables`, `aclear`) are also available ```python from tinygent.core.datamodels.messages import TinyHumanMessage, TinyChatMessage from tinygent.memory import BufferChatMemory, BufferWindowChatMemory -from tinygent.memory.combined_memory import CombinedMemory +from tinygent.memory import CombinedMemory combined = CombinedMemory(memory_list=[ BufferChatMemory(), # full transcript diff --git a/examples/memory/combined-memory/main.py b/examples/memory/combined-memory/main.py index 7975d6b..6df3a7d 100644 --- a/examples/memory/combined-memory/main.py +++ b/examples/memory/combined-memory/main.py @@ -3,7 +3,7 @@ from tinygent.core.datamodels.messages import TinyPlanMessage from tinygent.memory import BufferChatMemory from tinygent.memory import BufferWindowChatMemory -from tinygent.memory.combined_memory import CombinedMemory +from tinygent.memory import CombinedMemory def build_memory() -> CombinedMemory: diff --git a/examples/tool-usage/README.md b/examples/tool-usage/README.md index 03456f9..1aa871e 100644 --- a/examples/tool-usage/README.md +++ b/examples/tool-usage/README.md @@ -17,8 +17,8 @@ Pass a single `TinyModel` subclass as the only argument. This gives you full con ```python from pydantic import Field -from tinygent.core.types.base import TinyModel -from tinygent.tools.tool import tool +from tinygent.core.types import TinyModel +from tinygent.tools import tool class AddInput(TinyModel): a: int = Field(..., description='First number to add') @@ -35,7 +35,7 @@ def add(data: AddInput) -> int: Pass parameters directly like any normal function. TinyGent **auto-generates** a `TinyModel` schema from your type hints. ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool @tool def multiply(a: int, b: int) -> int: @@ -104,7 +104,7 @@ Creates a `Tool` instance but does **not** register it. **Using TinyModel:** ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool @tool def local_add(data: AddInput) -> int: @@ -116,7 +116,7 @@ print(local_add(AddInput(a=1, b=2))) # works directly **Using regular parameters:** ```python -from tinygent.tools.tool import tool +from tinygent.tools import tool @tool def multiply(a: int, b: int) -> int: @@ -163,7 +163,7 @@ print(add_tool(a=1, b=2)) Wraps an existing tool and augments every result with a lightweight instruction payload. This is useful when you want the LLM to receive inline guidance about how to interpret or execute the tool outcome. ```python -from tinygent.tools.jit_tool import jit_tool +from tinygent.tools import jit_tool @jit_tool(jit_instruction='Count from 1 to n, yielding each number.') def count(data: CountInput): diff --git a/examples/tool-usage/main.py b/examples/tool-usage/main.py index 0d1a292..7c23a99 100644 --- a/examples/tool-usage/main.py +++ b/examples/tool-usage/main.py @@ -1,11 +1,11 @@ from pydantic import Field from tinygent.core.runtime.tool_catalog import GlobalToolCatalog -from tinygent.core.types.base import TinyModel -from tinygent.tools.jit_tool import jit_tool -from tinygent.tools.reasoning_tool import register_reasoning_tool -from tinygent.tools.tool import register_tool -from tinygent.tools.tool import tool +from tinygent.core.types import TinyModel +from tinygent.tools import jit_tool +from tinygent.tools import register_reasoning_tool +from tinygent.tools import register_tool +from tinygent.tools import tool class AddInput(TinyModel): diff --git a/tinygent/agents/__init__.py b/tinygent/agents/__init__.py index 3ddd09f..c5b2805 100644 --- a/tinygent/agents/__init__.py +++ b/tinygent/agents/__init__.py @@ -1,3 +1,22 @@ +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from tinygent.prompts.map import MapPromptTemplate + from tinygent.prompts.multistep import MultiStepPromptTemplate + from tinygent.prompts.react import ReActPromptTemplate + from tinygent.prompts.squad import SquadPromptTemplate + + from .base_agent import TinyBaseAgent + from .base_agent import TinyBaseAgentConfig + from .map_agent import TinyMAPAgent + from .map_agent import TinyMAPAgentConfig + from .multi_step_agent import TinyMultiStepAgent + from .multi_step_agent import TinyMultiStepAgentConfig + from .react_agent import TinyReActAgent + from .react_agent import TinyReActAgentConfig + from .squad_agent import TinySquadAgent + from .squad_agent import TinySquadAgentConfig + __all__ = [ 'TinyBaseAgent', 'TinyBaseAgentConfig', @@ -9,6 +28,10 @@ 'TinySquadAgentConfig', 'TinyMAPAgent', 'TinyMAPAgentConfig', + 'ReActPromptTemplate', + 'MultiStepPromptTemplate', + 'SquadPromptTemplate', + 'MapPromptTemplate', ] @@ -63,4 +86,24 @@ def __getattr__(name): return TinyMAPAgentConfig + if name == 'ReActPromptTemplate': + from tinygent.prompts.react import ReActPromptTemplate + + return ReActPromptTemplate + + if name == 'MultiStepPromptTemplate': + from tinygent.prompts.multistep import MultiStepPromptTemplate + + return MultiStepPromptTemplate + + if name == 'SquadPromptTemplate': + from tinygent.prompts.squad import SquadPromptTemplate + + return SquadPromptTemplate + + if name == 'MapPromptTemplate': + from tinygent.prompts.map import MapPromptTemplate + + return MapPromptTemplate + raise AttributeError(name) diff --git a/tinygent/agents/map_agent.py b/tinygent/agents/map_agent.py index fb536a2..8ba71d6 100644 --- a/tinygent/agents/map_agent.py +++ b/tinygent/agents/map_agent.py @@ -19,13 +19,13 @@ from tinygent.core.datamodels.messages import TinySystemMessage from tinygent.core.datamodels.middleware import AbstractMiddleware from tinygent.core.datamodels.tool import AbstractTool -from tinygent.core.prompts.agents.factory.map_agent import get_prompt_template -from tinygent.core.prompts.agents.template.map_agent import MapPromptTemplate from tinygent.core.runtime.executors import run_async_in_executor from tinygent.core.telemetry.decorators import tiny_trace from tinygent.core.telemetry.otel import set_tiny_attributes from tinygent.core.types.base import TinyModel from tinygent.core.types.io.llm_io_input import TinyLLMInput +from tinygent.prompts.map import MapPromptTemplate +from tinygent.prompts.map import get_prompt_template from tinygent.utils.jinja_utils import render_template logger = logging.getLogger(__name__) diff --git a/tinygent/agents/middleware/__init__.py b/tinygent/agents/middleware/__init__.py index 25863b5..1f0f523 100644 --- a/tinygent/agents/middleware/__init__.py +++ b/tinygent/agents/middleware/__init__.py @@ -1,13 +1,17 @@ from .base import TinyBaseMiddleware from .base import register_middleware from .llm_tool_selector import TinyLLMToolSelectorMiddleware +from .llm_tool_selector import TinyLLMToolSelectorMiddlewareConfig from .tool_limiter import TinyToolCallLimiterMiddleware +from .tool_limiter import TinyToolCallLimiterMiddlewareConfig from .tool_limiter import ToolCallBlockedException __all__ = [ 'TinyBaseMiddleware', 'register_middleware', 'ToolCallBlockedException', - 'TinyToolCallLimiterMiddleware', 'TinyLLMToolSelectorMiddleware', + 'TinyLLMToolSelectorMiddlewareConfig', + 'TinyToolCallLimiterMiddleware', + 'TinyToolCallLimiterMiddlewareConfig', ] diff --git a/tinygent/agents/middleware/llm_tool_selector.py b/tinygent/agents/middleware/llm_tool_selector.py index 5c26015..f3f35b6 100644 --- a/tinygent/agents/middleware/llm_tool_selector.py +++ b/tinygent/agents/middleware/llm_tool_selector.py @@ -15,21 +15,17 @@ from tinygent.core.datamodels.messages import TinySystemMessage from tinygent.core.datamodels.tool import AbstractTool from tinygent.core.factory.llm import build_llm -from tinygent.core.prompts.agents.middleware.factory.llm_tool_selector import ( - get_prompt_template, -) -from tinygent.core.prompts.agents.middleware.template.llm_tool_selector import ( - LLMToolSelectorPromptTemplate, -) from tinygent.core.telemetry.decorators import tiny_trace from tinygent.core.telemetry.otel import set_tiny_attributes from tinygent.core.types.base import TinyModel from tinygent.core.types.io.llm_io_input import TinyLLMInput +from tinygent.prompts.middleware import LLMToolSelectorPromptTemplate +from tinygent.prompts.middleware import get_llm_tool_selector_prompt_template from tinygent.utils.jinja_utils import render_template logger = logging.getLogger(__name__) -_DEFAULT_PROMPT = get_prompt_template() +_DEFAULT_PROMPT = get_llm_tool_selector_prompt_template() class TinyLLMToolSelectorMiddlewareConfig( diff --git a/tinygent/agents/multi_step_agent.py b/tinygent/agents/multi_step_agent.py index 8c4ed73..1b5b707 100644 --- a/tinygent/agents/multi_step_agent.py +++ b/tinygent/agents/multi_step_agent.py @@ -23,8 +23,6 @@ from tinygent.core.datamodels.messages import TinyToolCall from tinygent.core.datamodels.middleware import AbstractMiddleware from tinygent.core.datamodels.tool import AbstractTool -from tinygent.core.prompts.agents.factory.multi_agent import get_prompt_template -from tinygent.core.prompts.agents.template.multi_agent import MultiStepPromptTemplate from tinygent.core.runtime.executors import run_async_in_executor from tinygent.core.telemetry.decorators import tiny_trace from tinygent.core.telemetry.otel import set_tiny_attributes @@ -32,6 +30,8 @@ from tinygent.core.types.base import TinyModel from tinygent.core.types.io.llm_io_chunks import TinyLLMResultChunk from tinygent.core.types.io.llm_io_input import TinyLLMInput +from tinygent.prompts.multistep import MultiStepPromptTemplate +from tinygent.prompts.multistep import get_prompt_template from tinygent.tools.reasoning_tool import ReasoningTool from tinygent.utils import render_template diff --git a/tinygent/agents/react_agent.py b/tinygent/agents/react_agent.py index 8d46e37..a614f57 100644 --- a/tinygent/agents/react_agent.py +++ b/tinygent/agents/react_agent.py @@ -21,8 +21,6 @@ from tinygent.core.datamodels.messages import TinyToolCall from tinygent.core.datamodels.middleware import AbstractMiddleware from tinygent.core.datamodels.tool import AbstractTool -from tinygent.core.prompts.agents.factory.react_agent import get_prompt_template -from tinygent.core.prompts.agents.template.react_agent import ReActPromptTemplate from tinygent.core.runtime.executors import run_async_in_executor from tinygent.core.telemetry.decorators import tiny_trace from tinygent.core.telemetry.otel import set_tiny_attributes @@ -30,6 +28,8 @@ from tinygent.core.types.base import TinyModel from tinygent.core.types.io.llm_io_chunks import TinyLLMResultChunk from tinygent.core.types.io.llm_io_input import TinyLLMInput +from tinygent.prompts.react import ReActPromptTemplate +from tinygent.prompts.react import get_prompt_template from tinygent.tools.reasoning_tool import ReasoningTool from tinygent.utils import render_template diff --git a/tinygent/agents/squad_agent.py b/tinygent/agents/squad_agent.py index ba5e798..a687661 100644 --- a/tinygent/agents/squad_agent.py +++ b/tinygent/agents/squad_agent.py @@ -25,14 +25,14 @@ from tinygent.core.datamodels.middleware import AbstractMiddleware from tinygent.core.datamodels.tool import AbstractTool from tinygent.core.factory.agent import build_agent -from tinygent.core.prompts.agents.factory.squad_agent import get_prompt_template -from tinygent.core.prompts.agents.template.squad_agent import SquadPromptTemplate from tinygent.core.runtime.executors import run_async_in_executor from tinygent.core.telemetry.decorators import tiny_trace from tinygent.core.telemetry.otel import set_tiny_attributes from tinygent.core.telemetry.otel import tiny_trace_span from tinygent.core.types.base import TinyModel from tinygent.core.types.io.llm_io_input import TinyLLMInput +from tinygent.prompts.squad import SquadPromptTemplate +from tinygent.prompts.squad import get_prompt_template from tinygent.utils.jinja_utils import render_template logger = logging.getLogger(__name__) diff --git a/tinygent/core/datamodels/messages.py b/tinygent/core/datamodels/messages.py index 3242fe4..e04aab4 100644 --- a/tinygent/core/datamodels/messages.py +++ b/tinygent/core/datamodels/messages.py @@ -1,6 +1,9 @@ +from __future__ import annotations + from abc import ABC from abc import abstractmethod import logging +from typing import TYPE_CHECKING from typing import Annotated from typing import Any from typing import Generic @@ -11,9 +14,11 @@ from pydantic import Field from pydantic import PrivateAttr -from tinygent.core.datamodels.tool import AbstractTool from tinygent.core.types.base import TinyModel +if TYPE_CHECKING: + from tinygent.core.datamodels.tool import AbstractTool + logger = logging.getLogger(__name__) TinyMessageType = TypeVar( diff --git a/tinygent/core/prompts/agents/__init__.py b/tinygent/core/prompts/agents/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tinygent/core/types/__init__.py b/tinygent/core/types/__init__.py index 4ecdd40..89421a6 100644 --- a/tinygent/core/types/__init__.py +++ b/tinygent/core/types/__init__.py @@ -1,27 +1,15 @@ +from .base import TinyModel +from .builder import TinyModelBuildable +from .discriminator import HasDiscriminatorField +from .io.llm_io_chunks import TinyLLMResultChunk +from .io.llm_io_input import TinyLLMInput +from .io.llm_io_result import TinyLLMResult + __all__ = [ + 'TinyLLMResultChunk', + 'TinyLLMInput', + 'TinyLLMResult', 'TinyModel', 'TinyModelBuildable', - 'TinyPrompt', 'HasDiscriminatorField', ] - - -def __getattr__(name: str): - if name == 'TinyModel': - from tinygent.core.types.base import TinyModel - - return TinyModel - elif name == 'TinyModelBuildable': - from tinygent.core.types.builder import TinyModelBuildable - - return TinyModelBuildable - elif name == 'TinyPrompt': - from tinygent.core.prompt import TinyPrompt - - return TinyPrompt - elif name == 'HasDiscriminatorField': - from tinygent.core.types.discriminator import HasDiscriminatorField - - return HasDiscriminatorField - else: - raise AttributeError(f'module {__name__} has no attribute {name}') diff --git a/tinygent/prompts/__init__.py b/tinygent/prompts/__init__.py new file mode 100644 index 0000000..bebcd64 --- /dev/null +++ b/tinygent/prompts/__init__.py @@ -0,0 +1,87 @@ +"""Prompt templates for Tinygent agents. + +Organized by agent type for clean imports: + from tinygent.prompts import react, multistep, squad, map, middleware + +Or import specific templates directly: + from tinygent.prompts import ReActPromptTemplate, MultiStepPromptTemplate + +Or from submodules: + from tinygent.prompts.react import ReActPromptTemplate +""" + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from tinygent.core.prompts.agents.template.map_agent import MapPromptTemplate + from tinygent.core.prompts.agents.template.multi_agent import MultiStepPromptTemplate + from tinygent.core.prompts.agents.template.react_agent import ReActPromptTemplate + from tinygent.core.prompts.agents.template.squad_agent import SquadPromptTemplate + from tinygent.prompts import map + from tinygent.prompts import middleware + from tinygent.prompts import multistep + from tinygent.prompts import react + from tinygent.prompts import squad + +__all__ = [ + 'react', + 'multistep', + 'squad', + 'map', + 'middleware', + 'ReActPromptTemplate', + 'MultiStepPromptTemplate', + 'SquadPromptTemplate', + 'MapPromptTemplate', +] + + +def __getattr__(name): + if name == 'react': + from tinygent.prompts import react + + return react + + if name == 'multistep': + from tinygent.prompts import multistep + + return multistep + + if name == 'squad': + from tinygent.prompts import squad + + return squad + + if name == 'map': + from tinygent.prompts import map + + return map + + if name == 'middleware': + from tinygent.prompts import middleware + + return middleware + + if name == 'ReActPromptTemplate': + from tinygent.core.prompts.agents.template.react_agent import ReActPromptTemplate + + return ReActPromptTemplate + + if name == 'MultiStepPromptTemplate': + from tinygent.core.prompts.agents.template.multi_agent import ( + MultiStepPromptTemplate, + ) + + return MultiStepPromptTemplate + + if name == 'SquadPromptTemplate': + from tinygent.core.prompts.agents.template.squad_agent import SquadPromptTemplate + + return SquadPromptTemplate + + if name == 'MapPromptTemplate': + from tinygent.core.prompts.agents.template.map_agent import MapPromptTemplate + + return MapPromptTemplate + + raise AttributeError(name) diff --git a/tinygent/prompts/map.py b/tinygent/prompts/map.py new file mode 100644 index 0000000..2f15f8a --- /dev/null +++ b/tinygent/prompts/map.py @@ -0,0 +1,23 @@ +"""MAP agent prompt templates.""" + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from tinygent.core.prompts.agents.factory.map_agent import get_prompt_template + from tinygent.core.prompts.agents.template.map_agent import MapPromptTemplate + +__all__ = ['MapPromptTemplate', 'get_prompt_template'] + + +def __getattr__(name): + if name == 'MapPromptTemplate': + from tinygent.core.prompts.agents.template.map_agent import MapPromptTemplate + + return MapPromptTemplate + + if name == 'get_prompt_template': + from tinygent.core.prompts.agents.factory.map_agent import get_prompt_template + + return get_prompt_template + + raise AttributeError(name) diff --git a/tinygent/prompts/middleware.py b/tinygent/prompts/middleware.py new file mode 100644 index 0000000..2aea584 --- /dev/null +++ b/tinygent/prompts/middleware.py @@ -0,0 +1,31 @@ +"""Middleware prompt templates.""" + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from tinygent.core.prompts.agents.middleware.factory.llm_tool_selector import ( + get_prompt_template as get_llm_tool_selector_prompt_template, + ) + from tinygent.core.prompts.agents.middleware.template.llm_tool_selector import ( + LLMToolSelectorPromptTemplate, + ) + +__all__ = ['LLMToolSelectorPromptTemplate', 'get_llm_tool_selector_prompt_template'] + + +def __getattr__(name): + if name == 'LLMToolSelectorPromptTemplate': + from tinygent.core.prompts.agents.middleware.template.llm_tool_selector import ( + LLMToolSelectorPromptTemplate, + ) + + return LLMToolSelectorPromptTemplate + + if name == 'get_llm_tool_selector_prompt_template': + from tinygent.core.prompts.agents.middleware.factory.llm_tool_selector import ( + get_prompt_template as get_llm_tool_selector_prompt_template, + ) + + return get_llm_tool_selector_prompt_template + + raise AttributeError(name) diff --git a/tinygent/prompts/multistep.py b/tinygent/prompts/multistep.py new file mode 100644 index 0000000..a15cfbb --- /dev/null +++ b/tinygent/prompts/multistep.py @@ -0,0 +1,55 @@ +"""MultiStep agent prompt templates.""" + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from tinygent.core.prompts.agents.factory.multi_agent import get_prompt_template + from tinygent.core.prompts.agents.template.multi_agent import ActionPromptTemplate + from tinygent.core.prompts.agents.template.multi_agent import ( + FallbackAnswerPromptTemplate, + ) + from tinygent.core.prompts.agents.template.multi_agent import MultiStepPromptTemplate + from tinygent.core.prompts.agents.template.multi_agent import PlanPromptTemplate + +__all__ = [ + 'MultiStepPromptTemplate', + 'ActionPromptTemplate', + 'FallbackAnswerPromptTemplate', + 'PlanPromptTemplate', + 'get_prompt_template', +] + + +def __getattr__(name): + if name == 'MultiStepPromptTemplate': + from tinygent.core.prompts.agents.template.multi_agent import ( + MultiStepPromptTemplate, + ) + + return MultiStepPromptTemplate + + if name == 'ActionPromptTemplate': + from tinygent.core.prompts.agents.template.multi_agent import ( + ActionPromptTemplate, + ) + + return ActionPromptTemplate + + if name == 'FallbackAnswerPromptTemplate': + from tinygent.core.prompts.agents.template.multi_agent import ( + FallbackAnswerPromptTemplate, + ) + + return FallbackAnswerPromptTemplate + + if name == 'PlanPromptTemplate': + from tinygent.core.prompts.agents.template.multi_agent import PlanPromptTemplate + + return PlanPromptTemplate + + if name == 'get_prompt_template': + from tinygent.core.prompts.agents.factory.multi_agent import get_prompt_template + + return get_prompt_template + + raise AttributeError(name) diff --git a/tinygent/prompts/react.py b/tinygent/prompts/react.py new file mode 100644 index 0000000..e5042e1 --- /dev/null +++ b/tinygent/prompts/react.py @@ -0,0 +1,53 @@ +"""ReAct agent prompt templates.""" + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from tinygent.core.prompts.agents.factory.react_agent import get_prompt_template + from tinygent.core.prompts.agents.template.react_agent import ActionPromptTemplate + from tinygent.core.prompts.agents.template.react_agent import FallbackPromptTemplate + from tinygent.core.prompts.agents.template.react_agent import ReActPromptTemplate + from tinygent.core.prompts.agents.template.react_agent import ReasonPromptTemplate + +__all__ = [ + 'ReActPromptTemplate', + 'ActionPromptTemplate', + 'FallbackPromptTemplate', + 'ReasonPromptTemplate', + 'get_prompt_template', +] + + +def __getattr__(name): + if name == 'ReActPromptTemplate': + from tinygent.core.prompts.agents.template.react_agent import ReActPromptTemplate + + return ReActPromptTemplate + + if name == 'ActionPromptTemplate': + from tinygent.core.prompts.agents.template.react_agent import ( + ActionPromptTemplate, + ) + + return ActionPromptTemplate + + if name == 'FallbackPromptTemplate': + from tinygent.core.prompts.agents.template.react_agent import ( + FallbackPromptTemplate, + ) + + return FallbackPromptTemplate + + if name == 'ReasonPromptTemplate': + from tinygent.core.prompts.agents.template.react_agent import ( + ReasonPromptTemplate, + ) + + return ReasonPromptTemplate + + if name == 'get_prompt_template': + from tinygent.core.prompts.agents.factory.react_agent import get_prompt_template + + return get_prompt_template + + raise AttributeError(name) diff --git a/tinygent/prompts/squad.py b/tinygent/prompts/squad.py new file mode 100644 index 0000000..7408ca1 --- /dev/null +++ b/tinygent/prompts/squad.py @@ -0,0 +1,23 @@ +"""Squad agent prompt templates.""" + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from tinygent.core.prompts.agents.factory.squad_agent import get_prompt_template + from tinygent.core.prompts.agents.template.squad_agent import SquadPromptTemplate + +__all__ = ['SquadPromptTemplate', 'get_prompt_template'] + + +def __getattr__(name): + if name == 'SquadPromptTemplate': + from tinygent.core.prompts.agents.template.squad_agent import SquadPromptTemplate + + return SquadPromptTemplate + + if name == 'get_prompt_template': + from tinygent.core.prompts.agents.factory.squad_agent import get_prompt_template + + return get_prompt_template + + raise AttributeError(name) diff --git a/tinygent/utils/__init__.py b/tinygent/utils/__init__.py index 340dc5c..26fda64 100644 --- a/tinygent/utils/__init__.py +++ b/tinygent/utils/__init__.py @@ -1,4 +1,3 @@ -from .answer_validation import is_final_answer from .color_printer import TinyColorPrinter from .jinja_utils import render_template from .jinja_utils import validate_template @@ -6,7 +5,6 @@ from .yaml import tiny_yaml_load __all__ = [ - 'is_final_answer', 'TinyColorPrinter', 'validate_template', 'render_template', diff --git a/tinygent/utils/answer_validation.py b/tinygent/utils/answer_validation.py deleted file mode 100644 index a889bc7..0000000 --- a/tinygent/utils/answer_validation.py +++ /dev/null @@ -1,6 +0,0 @@ -from tinygent.core.datamodels.messages import BaseMessage - - -def is_final_answer(message: BaseMessage) -> bool: - """Check if the message is marked as the final answer.""" - return message.metadata.get('is_final_answer', False) diff --git a/uv.lock b/uv.lock index 9ccd034..1c7594d 100644 --- a/uv.lock +++ b/uv.lock @@ -132,11 +132,11 @@ wheels = [ [[package]] name = "async-lru" -version = "2.0.5" +version = "2.1.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/b2/4d/71ec4d3939dc755264f680f6c2b4906423a304c3d18e96853f0a595dfe97/async_lru-2.0.5.tar.gz", hash = "sha256:481d52ccdd27275f42c43a928b4a50c3bfb2d67af4e78b170e3e0bb39c66e5bb", size = 10380 } +sdist = { url = "https://files.pythonhosted.org/packages/ef/c3/bbf34f15ea88dfb649ab2c40f9d75081784a50573a9ea431563cab64adb8/async_lru-2.1.0.tar.gz", hash = "sha256:9eeb2fecd3fe42cc8a787fc32ead53a3a7158cc43d039c3c55ab3e4e5b2a80ed", size = 12041 } wheels = [ - { url = "https://files.pythonhosted.org/packages/03/49/d10027df9fce941cb8184e78a02857af36360d33e1721df81c5ed2179a1a/async_lru-2.0.5-py3-none-any.whl", hash = "sha256:ab95404d8d2605310d345932697371a5f40def0487c03d6d0ad9138de52c9943", size = 6069 }, + { url = "https://files.pythonhosted.org/packages/2e/e9/eb6a5db5ac505d5d45715388e92bced7a5bb556facc4d0865d192823f2d2/async_lru-2.1.0-py3-none-any.whl", hash = "sha256:fa12dcf99a42ac1280bc16c634bbaf06883809790f6304d85cdab3f666f33a7e", size = 6933 }, ] [[package]] @@ -536,14 +536,14 @@ wheels = [ [[package]] name = "importlib-metadata" -version = "8.7.0" +version = "8.7.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "zipp" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/76/66/650a33bd90f786193e4de4b3ad86ea60b53c89b669a5c7be931fac31cdb0/importlib_metadata-8.7.0.tar.gz", hash = "sha256:d13b81ad223b890aa16c5471f2ac3056cf76c5f10f82d6f9292f0b415f389000", size = 56641 } +sdist = { url = "https://files.pythonhosted.org/packages/f3/49/3b30cad09e7771a4982d9975a8cbf64f00d4a1ececb53297f1d9a7be1b10/importlib_metadata-8.7.1.tar.gz", hash = "sha256:49fef1ae6440c182052f407c8d34a68f72efc36db9ca90dc0113398f2fdde8bb", size = 57107 } wheels = [ - { url = "https://files.pythonhosted.org/packages/20/b0/36bd937216ec521246249be3bf9855081de4c5e06a0c9b4219dbeda50373/importlib_metadata-8.7.0-py3-none-any.whl", hash = "sha256:e5dd1551894c77868a30651cef00984d50e1002d06942a7101d34870c5f02afd", size = 27656 }, + { url = "https://files.pythonhosted.org/packages/fa/5e/f8e9a1d23b9c20a551a8a02ea3637b4642e22c2626e3a13a9a29cdea99eb/importlib_metadata-8.7.1-py3-none-any.whl", hash = "sha256:5a1f80bf1daa489495071efbb095d75a634cf28a8bc299581244063b53176151", size = 27865 }, ] [[package]] @@ -1005,45 +1005,45 @@ wheels = [ [[package]] name = "opentelemetry-api" -version = "1.38.0" +version = "1.39.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "importlib-metadata" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/08/d8/0f354c375628e048bd0570645b310797299754730079853095bf000fba69/opentelemetry_api-1.38.0.tar.gz", hash = "sha256:f4c193b5e8acb0912b06ac5b16321908dd0843d75049c091487322284a3eea12", size = 65242 } +sdist = { url = "https://files.pythonhosted.org/packages/97/b9/3161be15bb8e3ad01be8be5a968a9237c3027c5be504362ff800fca3e442/opentelemetry_api-1.39.1.tar.gz", hash = "sha256:fbde8c80e1b937a2c61f20347e91c0c18a1940cecf012d62e65a7caf08967c9c", size = 65767 } wheels = [ - { url = "https://files.pythonhosted.org/packages/ae/a2/d86e01c28300bd41bab8f18afd613676e2bd63515417b77636fc1add426f/opentelemetry_api-1.38.0-py3-none-any.whl", hash = "sha256:2891b0197f47124454ab9f0cf58f3be33faca394457ac3e09daba13ff50aa582", size = 65947 }, + { url = "https://files.pythonhosted.org/packages/cf/df/d3f1ddf4bb4cb50ed9b1139cc7b1c54c34a1e7ce8fd1b9a37c0d1551a6bd/opentelemetry_api-1.39.1-py3-none-any.whl", hash = "sha256:2edd8463432a7f8443edce90972169b195e7d6a05500cd29e6d13898187c9950", size = 66356 }, ] [[package]] name = "opentelemetry-exporter-otlp" -version = "1.38.0" +version = "1.39.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "opentelemetry-exporter-otlp-proto-grpc" }, { name = "opentelemetry-exporter-otlp-proto-http" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/c2/2d/16e3487ddde2dee702bd746dd41950a8789b846d22a1c7e64824aac5ebea/opentelemetry_exporter_otlp-1.38.0.tar.gz", hash = "sha256:2f55acdd475e4136117eff20fbf1b9488b1b0b665ab64407516e1ac06f9c3f9d", size = 6147 } +sdist = { url = "https://files.pythonhosted.org/packages/30/9c/3ab1db90f32da200dba332658f2bbe602369e3d19f6aba394031a42635be/opentelemetry_exporter_otlp-1.39.1.tar.gz", hash = "sha256:7cf7470e9fd0060c8a38a23e4f695ac686c06a48ad97f8d4867bc9b420180b9c", size = 6147 } wheels = [ - { url = "https://files.pythonhosted.org/packages/fd/8a/81cd252b16b7d95ec1147982b6af81c7932d23918b4c3b15372531242ddd/opentelemetry_exporter_otlp-1.38.0-py3-none-any.whl", hash = "sha256:bc6562cef229fac8887ed7109fc5abc52315f39d9c03fd487bb8b4ef8fbbc231", size = 7018 }, + { url = "https://files.pythonhosted.org/packages/00/6c/bdc82a066e6fb1dcf9e8cc8d4e026358fe0f8690700cc6369a6bf9bd17a7/opentelemetry_exporter_otlp-1.39.1-py3-none-any.whl", hash = "sha256:68ae69775291f04f000eb4b698ff16ff685fdebe5cb52871bc4e87938a7b00fe", size = 7019 }, ] [[package]] name = "opentelemetry-exporter-otlp-proto-common" -version = "1.38.0" +version = "1.39.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "opentelemetry-proto" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/19/83/dd4660f2956ff88ed071e9e0e36e830df14b8c5dc06722dbde1841accbe8/opentelemetry_exporter_otlp_proto_common-1.38.0.tar.gz", hash = "sha256:e333278afab4695aa8114eeb7bf4e44e65c6607d54968271a249c180b2cb605c", size = 20431 } +sdist = { url = "https://files.pythonhosted.org/packages/e9/9d/22d241b66f7bbde88a3bfa6847a351d2c46b84de23e71222c6aae25c7050/opentelemetry_exporter_otlp_proto_common-1.39.1.tar.gz", hash = "sha256:763370d4737a59741c89a67b50f9e39271639ee4afc999dadfe768541c027464", size = 20409 } wheels = [ - { url = "https://files.pythonhosted.org/packages/a7/9e/55a41c9601191e8cd8eb626b54ee6827b9c9d4a46d736f32abc80d8039fc/opentelemetry_exporter_otlp_proto_common-1.38.0-py3-none-any.whl", hash = "sha256:03cb76ab213300fe4f4c62b7d8f17d97fcfd21b89f0b5ce38ea156327ddda74a", size = 18359 }, + { url = "https://files.pythonhosted.org/packages/8c/02/ffc3e143d89a27ac21fd557365b98bd0653b98de8a101151d5805b5d4c33/opentelemetry_exporter_otlp_proto_common-1.39.1-py3-none-any.whl", hash = "sha256:08f8a5862d64cc3435105686d0216c1365dc5701f86844a8cd56597d0c764fde", size = 18366 }, ] [[package]] name = "opentelemetry-exporter-otlp-proto-grpc" -version = "1.38.0" +version = "1.39.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "googleapis-common-protos" }, @@ -1054,14 +1054,14 @@ dependencies = [ { name = "opentelemetry-sdk" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/a2/c0/43222f5b97dc10812bc4f0abc5dc7cd0a2525a91b5151d26c9e2e958f52e/opentelemetry_exporter_otlp_proto_grpc-1.38.0.tar.gz", hash = "sha256:2473935e9eac71f401de6101d37d6f3f0f1831db92b953c7dcc912536158ebd6", size = 24676 } +sdist = { url = "https://files.pythonhosted.org/packages/53/48/b329fed2c610c2c32c9366d9dc597202c9d1e58e631c137ba15248d8850f/opentelemetry_exporter_otlp_proto_grpc-1.39.1.tar.gz", hash = "sha256:772eb1c9287485d625e4dbe9c879898e5253fea111d9181140f51291b5fec3ad", size = 24650 } wheels = [ - { url = "https://files.pythonhosted.org/packages/28/f0/bd831afbdba74ca2ce3982142a2fad707f8c487e8a3b6fef01f1d5945d1b/opentelemetry_exporter_otlp_proto_grpc-1.38.0-py3-none-any.whl", hash = "sha256:7c49fd9b4bd0dbe9ba13d91f764c2d20b0025649a6e4ac35792fb8d84d764bc7", size = 19695 }, + { url = "https://files.pythonhosted.org/packages/81/a3/cc9b66575bd6597b98b886a2067eea2693408d2d5f39dad9ab7fc264f5f3/opentelemetry_exporter_otlp_proto_grpc-1.39.1-py3-none-any.whl", hash = "sha256:fa1c136a05c7e9b4c09f739469cbdb927ea20b34088ab1d959a849b5cc589c18", size = 19766 }, ] [[package]] name = "opentelemetry-exporter-otlp-proto-http" -version = "1.38.0" +version = "1.39.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "googleapis-common-protos" }, @@ -1072,48 +1072,48 @@ dependencies = [ { name = "requests" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/81/0a/debcdfb029fbd1ccd1563f7c287b89a6f7bef3b2902ade56797bfd020854/opentelemetry_exporter_otlp_proto_http-1.38.0.tar.gz", hash = "sha256:f16bd44baf15cbe07633c5112ffc68229d0edbeac7b37610be0b2def4e21e90b", size = 17282 } +sdist = { url = "https://files.pythonhosted.org/packages/80/04/2a08fa9c0214ae38880df01e8bfae12b067ec0793446578575e5080d6545/opentelemetry_exporter_otlp_proto_http-1.39.1.tar.gz", hash = "sha256:31bdab9745c709ce90a49a0624c2bd445d31a28ba34275951a6a362d16a0b9cb", size = 17288 } wheels = [ - { url = "https://files.pythonhosted.org/packages/e5/77/154004c99fb9f291f74aa0822a2f5bbf565a72d8126b3a1b63ed8e5f83c7/opentelemetry_exporter_otlp_proto_http-1.38.0-py3-none-any.whl", hash = "sha256:84b937305edfc563f08ec69b9cb2298be8188371217e867c1854d77198d0825b", size = 19579 }, + { url = "https://files.pythonhosted.org/packages/95/f1/b27d3e2e003cd9a3592c43d099d2ed8d0a947c15281bf8463a256db0b46c/opentelemetry_exporter_otlp_proto_http-1.39.1-py3-none-any.whl", hash = "sha256:d9f5207183dd752a412c4cd564ca8875ececba13be6e9c6c370ffb752fd59985", size = 19641 }, ] [[package]] name = "opentelemetry-proto" -version = "1.38.0" +version = "1.39.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "protobuf" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/51/14/f0c4f0f6371b9cb7f9fa9ee8918bfd59ac7040c7791f1e6da32a1839780d/opentelemetry_proto-1.38.0.tar.gz", hash = "sha256:88b161e89d9d372ce723da289b7da74c3a8354a8e5359992be813942969ed468", size = 46152 } +sdist = { url = "https://files.pythonhosted.org/packages/49/1d/f25d76d8260c156c40c97c9ed4511ec0f9ce353f8108ca6e7561f82a06b2/opentelemetry_proto-1.39.1.tar.gz", hash = "sha256:6c8e05144fc0d3ed4d22c2289c6b126e03bcd0e6a7da0f16cedd2e1c2772e2c8", size = 46152 } wheels = [ - { url = "https://files.pythonhosted.org/packages/b6/6a/82b68b14efca5150b2632f3692d627afa76b77378c4999f2648979409528/opentelemetry_proto-1.38.0-py3-none-any.whl", hash = "sha256:b6ebe54d3217c42e45462e2a1ae28c3e2bf2ec5a5645236a490f55f45f1a0a18", size = 72535 }, + { url = "https://files.pythonhosted.org/packages/51/95/b40c96a7b5203005a0b03d8ce8cd212ff23f1793d5ba289c87a097571b18/opentelemetry_proto-1.39.1-py3-none-any.whl", hash = "sha256:22cdc78efd3b3765d09e68bfbd010d4fc254c9818afd0b6b423387d9dee46007", size = 72535 }, ] [[package]] name = "opentelemetry-sdk" -version = "1.38.0" +version = "1.39.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "opentelemetry-api" }, { name = "opentelemetry-semantic-conventions" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/85/cb/f0eee1445161faf4c9af3ba7b848cc22a50a3d3e2515051ad8628c35ff80/opentelemetry_sdk-1.38.0.tar.gz", hash = "sha256:93df5d4d871ed09cb4272305be4d996236eedb232253e3ab864c8620f051cebe", size = 171942 } +sdist = { url = "https://files.pythonhosted.org/packages/eb/fb/c76080c9ba07e1e8235d24cdcc4d125ef7aa3edf23eb4e497c2e50889adc/opentelemetry_sdk-1.39.1.tar.gz", hash = "sha256:cf4d4563caf7bff906c9f7967e2be22d0d6b349b908be0d90fb21c8e9c995cc6", size = 171460 } wheels = [ - { url = "https://files.pythonhosted.org/packages/2f/2e/e93777a95d7d9c40d270a371392b6d6f1ff170c2a3cb32d6176741b5b723/opentelemetry_sdk-1.38.0-py3-none-any.whl", hash = "sha256:1c66af6564ecc1553d72d811a01df063ff097cdc82ce188da9951f93b8d10f6b", size = 132349 }, + { url = "https://files.pythonhosted.org/packages/7c/98/e91cf858f203d86f4eccdf763dcf01cf03f1dae80c3750f7e635bfa206b6/opentelemetry_sdk-1.39.1-py3-none-any.whl", hash = "sha256:4d5482c478513ecb0a5d938dcc61394e647066e0cc2676bee9f3af3f3f45f01c", size = 132565 }, ] [[package]] name = "opentelemetry-semantic-conventions" -version = "0.59b0" +version = "0.60b1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "opentelemetry-api" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/40/bc/8b9ad3802cd8ac6583a4eb7de7e5d7db004e89cb7efe7008f9c8a537ee75/opentelemetry_semantic_conventions-0.59b0.tar.gz", hash = "sha256:7a6db3f30d70202d5bf9fa4b69bc866ca6a30437287de6c510fb594878aed6b0", size = 129861 } +sdist = { url = "https://files.pythonhosted.org/packages/91/df/553f93ed38bf22f4b999d9be9c185adb558982214f33eae539d3b5cd0858/opentelemetry_semantic_conventions-0.60b1.tar.gz", hash = "sha256:87c228b5a0669b748c76d76df6c364c369c28f1c465e50f661e39737e84bc953", size = 137935 } wheels = [ - { url = "https://files.pythonhosted.org/packages/24/7d/c88d7b15ba8fe5c6b8f93be50fc11795e9fc05386c44afaf6b76fe191f9b/opentelemetry_semantic_conventions-0.59b0-py3-none-any.whl", hash = "sha256:35d3b8833ef97d614136e253c1da9342b4c3c083bbaf29ce31d572a1c3825eed", size = 207954 }, + { url = "https://files.pythonhosted.org/packages/7a/5e/5958555e09635d09b75de3c4f8b9cae7335ca545d77392ffe7331534c402/opentelemetry_semantic_conventions-0.60b1-py3-none-any.whl", hash = "sha256:9fa8c8b0c110da289809292b0591220d3a7b53c1526a23021e977d68597893fb", size = 219982 }, ] [[package]] @@ -1229,17 +1229,17 @@ wheels = [ [[package]] name = "protobuf" -version = "6.33.1" +version = "6.33.4" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/0a/03/a1440979a3f74f16cab3b75b0da1a1a7f922d56a8ddea96092391998edc0/protobuf-6.33.1.tar.gz", hash = "sha256:97f65757e8d09870de6fd973aeddb92f85435607235d20b2dfed93405d00c85b", size = 443432 } +sdist = { url = "https://files.pythonhosted.org/packages/53/b8/cda15d9d46d03d4aa3a67cb6bffe05173440ccf86a9541afaf7ac59a1b6b/protobuf-6.33.4.tar.gz", hash = "sha256:dc2e61bca3b10470c1912d166fe0af67bfc20eb55971dcef8dfa48ce14f0ed91", size = 444346 } wheels = [ - { url = "https://files.pythonhosted.org/packages/06/f1/446a9bbd2c60772ca36556bac8bfde40eceb28d9cc7838755bc41e001d8f/protobuf-6.33.1-cp310-abi3-win32.whl", hash = "sha256:f8d3fdbc966aaab1d05046d0240dd94d40f2a8c62856d41eaa141ff64a79de6b", size = 425593 }, - { url = "https://files.pythonhosted.org/packages/a6/79/8780a378c650e3df849b73de8b13cf5412f521ca2ff9b78a45c247029440/protobuf-6.33.1-cp310-abi3-win_amd64.whl", hash = "sha256:923aa6d27a92bf44394f6abf7ea0500f38769d4b07f4be41cb52bd8b1123b9ed", size = 436883 }, - { url = "https://files.pythonhosted.org/packages/cd/93/26213ff72b103ae55bb0d73e7fb91ea570ef407c3ab4fd2f1f27cac16044/protobuf-6.33.1-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:fe34575f2bdde76ac429ec7b570235bf0c788883e70aee90068e9981806f2490", size = 427522 }, - { url = "https://files.pythonhosted.org/packages/c2/32/df4a35247923393aa6b887c3b3244a8c941c32a25681775f96e2b418f90e/protobuf-6.33.1-cp39-abi3-manylinux2014_aarch64.whl", hash = "sha256:f8adba2e44cde2d7618996b3fc02341f03f5bc3f2748be72dc7b063319276178", size = 324445 }, - { url = "https://files.pythonhosted.org/packages/8e/d0/d796e419e2ec93d2f3fa44888861c3f88f722cde02b7c3488fcc6a166820/protobuf-6.33.1-cp39-abi3-manylinux2014_s390x.whl", hash = "sha256:0f4cf01222c0d959c2b399142deb526de420be8236f22c71356e2a544e153c53", size = 339161 }, - { url = "https://files.pythonhosted.org/packages/1d/2a/3c5f05a4af06649547027d288747f68525755de692a26a7720dced3652c0/protobuf-6.33.1-cp39-abi3-manylinux2014_x86_64.whl", hash = "sha256:8fd7d5e0eb08cd5b87fd3df49bc193f5cfd778701f47e11d127d0afc6c39f1d1", size = 323171 }, - { url = "https://files.pythonhosted.org/packages/08/b4/46310463b4f6ceef310f8348786f3cff181cea671578e3d9743ba61a459e/protobuf-6.33.1-py3-none-any.whl", hash = "sha256:d595a9fd694fdeb061a62fbe10eb039cc1e444df81ec9bb70c7fc59ebcb1eafa", size = 170477 }, + { url = "https://files.pythonhosted.org/packages/e0/be/24ef9f3095bacdf95b458543334d0c4908ccdaee5130420bf064492c325f/protobuf-6.33.4-cp310-abi3-win32.whl", hash = "sha256:918966612c8232fc6c24c78e1cd89784307f5814ad7506c308ee3cf86662850d", size = 425612 }, + { url = "https://files.pythonhosted.org/packages/31/ad/e5693e1974a28869e7cd244302911955c1cebc0161eb32dfa2b25b6e96f0/protobuf-6.33.4-cp310-abi3-win_amd64.whl", hash = "sha256:8f11ffae31ec67fc2554c2ef891dcb561dae9a2a3ed941f9e134c2db06657dbc", size = 436962 }, + { url = "https://files.pythonhosted.org/packages/66/15/6ee23553b6bfd82670207ead921f4d8ef14c107e5e11443b04caeb5ab5ec/protobuf-6.33.4-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:2fe67f6c014c84f655ee06f6f66213f9254b3a8b6bda6cda0ccd4232c73c06f0", size = 427612 }, + { url = "https://files.pythonhosted.org/packages/2b/48/d301907ce6d0db75f959ca74f44b475a9caa8fcba102d098d3c3dd0f2d3f/protobuf-6.33.4-cp39-abi3-manylinux2014_aarch64.whl", hash = "sha256:757c978f82e74d75cba88eddec479df9b99a42b31193313b75e492c06a51764e", size = 324484 }, + { url = "https://files.pythonhosted.org/packages/92/1c/e53078d3f7fe710572ab2dcffd993e1e3b438ae71cfc031b71bae44fcb2d/protobuf-6.33.4-cp39-abi3-manylinux2014_s390x.whl", hash = "sha256:c7c64f259c618f0bef7bee042075e390debbf9682334be2b67408ec7c1c09ee6", size = 339256 }, + { url = "https://files.pythonhosted.org/packages/e8/8e/971c0edd084914f7ee7c23aa70ba89e8903918adca179319ee94403701d5/protobuf-6.33.4-cp39-abi3-manylinux2014_x86_64.whl", hash = "sha256:3df850c2f8db9934de4cf8f9152f8dc2558f49f298f37f90c517e8e5c84c30e9", size = 323311 }, + { url = "https://files.pythonhosted.org/packages/75/b1/1dc83c2c661b4c62d56cc081706ee33a4fc2835bd90f965baa2663ef7676/protobuf-6.33.4-py3-none-any.whl", hash = "sha256:1fe3730068fcf2e595816a6c34fe66eeedd37d51d0400b72fabc848811fdc1bc", size = 170532 }, ] [[package]] @@ -1476,15 +1476,15 @@ wheels = [ [[package]] name = "rich" -version = "14.2.0" +version = "14.3.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "markdown-it-py" }, { name = "pygments" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/fb/d2/8920e102050a0de7bfabeb4c4614a49248cf8d5d7a8d01885fbb24dc767a/rich-14.2.0.tar.gz", hash = "sha256:73ff50c7c0c1c77c8243079283f4edb376f0f6442433aecb8ce7e6d0b92d1fe4", size = 219990 } +sdist = { url = "https://files.pythonhosted.org/packages/a1/84/4831f881aa6ff3c976f6d6809b58cdfa350593ffc0dc3c58f5f6586780fb/rich-14.3.1.tar.gz", hash = "sha256:b8c5f568a3a749f9290ec6bddedf835cec33696bfc1e48bcfecb276c7386e4b8", size = 230125 } wheels = [ - { url = "https://files.pythonhosted.org/packages/25/7a/b0178788f8dc6cafce37a212c99565fa1fe7872c70c6c9c1e1a372d9d88f/rich-14.2.0-py3-none-any.whl", hash = "sha256:76bc51fe2e57d2b1be1f96c524b890b816e334ab4c1e45888799bfaab0021edd", size = 243393 }, + { url = "https://files.pythonhosted.org/packages/87/2a/a1810c8627b9ec8c57ec5ec325d306701ae7be50235e8fd81266e002a3cc/rich-14.3.1-py3-none-any.whl", hash = "sha256:da750b1aebbff0b372557426fb3f35ba56de8ef954b3190315eb64076d6fb54e", size = 309952 }, ] [[package]] @@ -1919,7 +1919,7 @@ wheels = [ [[package]] name = "typer" -version = "0.19.2" +version = "0.21.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "click" }, @@ -1927,9 +1927,9 @@ dependencies = [ { name = "shellingham" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/21/ca/950278884e2ca20547ff3eb109478c6baf6b8cf219318e6bc4f666fad8e8/typer-0.19.2.tar.gz", hash = "sha256:9ad824308ded0ad06cc716434705f691d4ee0bfd0fb081839d2e426860e7fdca", size = 104755 } +sdist = { url = "https://files.pythonhosted.org/packages/36/bf/8825b5929afd84d0dabd606c67cd57b8388cb3ec385f7ef19c5cc2202069/typer-0.21.1.tar.gz", hash = "sha256:ea835607cd752343b6b2b7ce676893e5a0324082268b48f27aa058bdb7d2145d", size = 110371 } wheels = [ - { url = "https://files.pythonhosted.org/packages/00/22/35617eee79080a5d071d0f14ad698d325ee6b3bf824fc0467c03b30e7fa8/typer-0.19.2-py3-none-any.whl", hash = "sha256:755e7e19670ffad8283db353267cb81ef252f595aa6834a0d1ca9312d9326cb9", size = 46748 }, + { url = "https://files.pythonhosted.org/packages/a0/1d/d9257dd49ff2ca23ea5f132edf1281a0c4f9de8a762b9ae399b670a59235/typer-0.21.1-py3-none-any.whl", hash = "sha256:7985e89081c636b88d172c2ee0cfe33c253160994d47bdfdc302defd7d1f1d01", size = 47381 }, ] [[package]]