Skip to content

Building AI agents, atomically

Make schema naming more consistent

KennyVaneetvelde132443c705a3
diff --git a/atomic_agents/lib/tools/calculator_tool.py b/atomic_agents/lib/tools/calculator_tool.py
index b0b1018..fccd501 100644
--- a/atomic_agents/lib/tools/calculator_tool.py
+++ b/atomic_agents/lib/tools/calculator_tool.py
@@ -10,7 +10,7 @@ from atomic_agents.lib.tools.base_tool import BaseTool, BaseToolConfig
################
-class CalculatorToolSchema(BaseIOSchema):
+class CalculatorToolInputSchema(BaseIOSchema):
expression: str = Field(..., description="Mathematical expression to evaluate. For example, '2 + 2'.")
class Config:
@@ -43,11 +43,11 @@ class CalculatorTool(BaseTool):
Tool for performing calculations based on the provided mathematical expression.
Attributes:
- input_schema (CalculatorToolSchema): The schema for the input data.
+ input_schema (CalculatorToolInputSchema): The schema for the input data.
output_schema (CalculatorToolOutputSchema): The schema for the output data.
"""
- input_schema = CalculatorToolSchema
+ input_schema = CalculatorToolInputSchema
output_schema = CalculatorToolOutputSchema
def __init__(self, config: CalculatorToolConfig = CalculatorToolConfig()):
@@ -59,12 +59,12 @@ class CalculatorTool(BaseTool):
"""
super().__init__(config)
- def run(self, params: CalculatorToolSchema) -> CalculatorToolOutputSchema:
+ def run(self, params: CalculatorToolInputSchema) -> CalculatorToolOutputSchema:
"""
Runs the CalculatorTool with the given parameters.
Args:
- params (CalculatorToolSchema): The input parameters for the tool, adhering to the input schema.
+ params (CalculatorToolInputSchema): The input parameters for the tool, adhering to the input schema.
Returns:
CalculatorToolOutputSchema: The output of the tool, adhering to the output schema.
@@ -81,4 +81,4 @@ class CalculatorTool(BaseTool):
#################
if __name__ == "__main__":
rich_console = Console()
- rich_console.print(CalculatorTool().run(CalculatorToolSchema(expression="2 + 2")))
+ rich_console.print(CalculatorTool().run(CalculatorToolInputSchema(expression="2 + 2")))
diff --git a/atomic_agents/lib/tools/content_scraping_tool.py b/atomic_agents/lib/tools/content_scraping_tool.py
index a621d14..7aeadc8 100644
--- a/atomic_agents/lib/tools/content_scraping_tool.py
+++ b/atomic_agents/lib/tools/content_scraping_tool.py
@@ -18,7 +18,7 @@ from atomic_agents.lib.utils.scraping.url_to_markdown import UrlToMarkdownConver
################
-class ContentScrapingToolSchema(BaseIOSchema):
+class ContentScrapingToolInputSchema(BaseIOSchema):
url: str = Field(..., description="URL of the web page or PDF to scrape.")
class Config:
@@ -52,11 +52,11 @@ class ContentScrapingTool(BaseTool):
Tool for scraping web pages or PDFs and converting content to markdown.
Attributes:
- input_schema (ContentScrapingToolSchema): The schema for the input data.
+ input_schema (ContentScrapingToolInputSchema): The schema for the input data.
output_schema (ContentScrapingToolOutputSchema): The schema for the output data.
"""
- input_schema = ContentScrapingToolSchema
+ input_schema = ContentScrapingToolInputSchema
output_schema = ContentScrapingToolOutputSchema
def __init__(self, config: ContentScrapingToolConfig = ContentScrapingToolConfig()):
@@ -68,12 +68,12 @@ class ContentScrapingTool(BaseTool):
"""
super().__init__(config)
- def run(self, params: ContentScrapingToolSchema) -> ContentScrapingToolOutputSchema:
+ def run(self, params: ContentScrapingToolInputSchema) -> ContentScrapingToolOutputSchema:
"""
Runs the ContentScrapingTool with the given parameters.
Args:
- params (ContentScrapingToolSchema): The input parameters for the tool, adhering to the input schema.
+ params (ContentScrapingToolInputSchema): The input parameters for the tool, adhering to the input schema.
Returns:
ContentScrapingToolOutputSchema: The output of the tool, adhering to the output schema.
diff --git a/atomic_agents/lib/tools/search/searx_tool.py b/atomic_agents/lib/tools/search/searx_tool.py
index 50cc943..3739b3b 100644
--- a/atomic_agents/lib/tools/search/searx_tool.py
+++ b/atomic_agents/lib/tools/search/searx_tool.py
@@ -13,14 +13,14 @@ from atomic_agents.lib.tools.base_tool import BaseTool, BaseToolConfig
################
-class SearxNGSearchToolSchema(BaseIOSchema):
+class SearxNGToolInputSchema(BaseIOSchema):
queries: List[str] = Field(..., description="List of search queries.")
category: Optional[Literal["general", "news", "social_media"]] = Field(
"general", description="Category of the search queries."
)
class Config:
- title = "SearxNGSearchTool"
+ title = "SearxNGTool"
description = (
"Tool for searching for information, news, references, and other content on the SearxNG. "
"Returns a list of search results with a short description or content snippet and URLs for further exploration."
@@ -33,61 +33,61 @@ class SearxNGSearchToolSchema(BaseIOSchema):
####################
-class SearxNGSearchResultSchema(BaseIOSchema):
+class SearxNGResultSchema(BaseIOSchema):
url: str
title: str
content: Optional[str] = None
-class SearxNGSearchToolOutputSchema(BaseIOSchema):
- results: List[SearxNGSearchResultSchema]
+class SearxNGToolOutputSchema(BaseIOSchema):
+ results: List[SearxNGResultSchema]
category: Optional[str] = None
##############
# TOOL LOGIC #
##############
-class SearxNGSearchToolConfig(BaseToolConfig):
+class SearxNGToolConfig(BaseToolConfig):
base_url: str = ""
max_results: int = 10
-class SearxNGSearchTool(BaseTool):
+class SearxNGTool(BaseTool):
"""
Tool for performing searches on SearxNG based on the provided queries and category.
Attributes:
- input_schema (SearxNGSearchToolSchema): The schema for the input data.
- output_schema (SearxNGSearchToolOutputSchema): The schema for the output data.
+ input_schema (SearxNGToolInputSchema): The schema for the input data.
+ output_schema (SearxNGToolOutputSchema): The schema for the output data.
max_results (int): The maximum number of search results to return.
base_url (str): The base URL for the SearxNG instance to use.
"""
- input_schema = SearxNGSearchToolSchema
- output_schema = SearxNGSearchToolOutputSchema
+ input_schema = SearxNGToolInputSchema
+ output_schema = SearxNGToolOutputSchema
- def __init__(self, config: SearxNGSearchToolConfig = SearxNGSearchToolConfig()):
+ def __init__(self, config: SearxNGToolConfig = SearxNGToolConfig()):
"""
- Initializes the SearxNGSearchTool.
+ Initializes the SearxNGTool.
Args:
- config (SearxNGSearchToolConfig):
+ config (SearxNGToolConfig):
Configuration for the tool, including base URL, max results, and optional title and description overrides.
"""
super().__init__(config)
self.base_url = config.base_url
self.max_results = config.max_results
- def run(self, params: SearxNGSearchToolSchema, max_results: Optional[int] = None) -> SearxNGSearchToolOutputSchema:
+ def run(self, params: SearxNGToolInputSchema, max_results: Optional[int] = None) -> SearxNGToolOutputSchema:
"""
- Runs the SearxNGSearchTool with the given parameters.
+ Runs the SearxNGTool with the given parameters.
Args:
- params (SearxNGSearchToolSchema): The input parameters for the tool, adhering to the input schema.
+ params (SearxNGToolInputSchema): The input parameters for the tool, adhering to the input schema.
max_results (Optional[int]): The maximum number of search results to return.
Returns:
- SearxNGSearchToolOutputSchema: The output of the tool, adhering to the output schema.
+ SearxNGToolOutputSchema: The output of the tool, adhering to the output schema.
Raises:
ValueError: If the base URL is not provided.
@@ -146,7 +146,7 @@ class SearxNGSearchTool(BaseTool):
filtered_results = filtered_results[: max_results or self.max_results]
- return SearxNGSearchToolOutputSchema(results=filtered_results, category=params.category)
+ return SearxNGToolOutputSchema(results=filtered_results, category=params.category)
#################
@@ -154,11 +154,11 @@ class SearxNGSearchTool(BaseTool):
#################
if __name__ == "__main__":
rich_console = Console()
- search_tool_instance = SearxNGSearchTool(
- config=SearxNGSearchToolConfig(base_url=os.getenv("SEARXNG_BASE_URL"), max_results=5)
+ search_tool_instance = SearxNGTool(
+ config=SearxNGToolConfig(base_url=os.getenv("SEARXNG_BASE_URL"), max_results=5)
)
- search_input = SearxNGSearchTool.input_schema(
+ search_input = SearxNGTool.input_schema(
queries=["Python programming", "Machine learning", "Artificial intelligence"],
category="news",
)
diff --git a/atomic_agents/lib/tools/search/serper_tool.py b/atomic_agents/lib/tools/search/serper_tool.py
index 8bbb7d0..43df555 100644
--- a/atomic_agents/lib/tools/search/serper_tool.py
+++ b/atomic_agents/lib/tools/search/serper_tool.py
@@ -14,11 +14,11 @@ from atomic_agents.lib.tools.base_tool import BaseTool, BaseToolConfig
################
-class SerperSearchToolSchema(BaseIOSchema):
+class SerperToolSchema(BaseIOSchema):
queries: List[str] = Field(..., description="List of search queries.")
class Config:
- title = "SerperSearchTool"
+ title = "SerperTool"
description = (
"Tool for searching for information, news, references, and other content using the Serper API. "
"Returns a list of search results with a short description or content snippet and URLs for further exploration."
@@ -31,15 +31,15 @@ class SerperSearchToolSchema(BaseIOSchema):
####################
-class SerperSearchResultSchema(BaseIOSchema):
+class SerperResultSchema(BaseIOSchema):
url: str
title: str
content: Optional[str] = None
position: Optional[int] = None
-class SerperSearchToolOutputSchema(BaseIOSchema):
- results: List[SerperSearchResultSchema]
+class SerperToolOutputSchema(BaseIOSchema):
+ results: List[SerperResultSchema]
##############
@@ -47,47 +47,47 @@ class SerperSearchToolOutputSchema(BaseIOSchema):
##############
-class SerperSearchToolConfig(BaseToolConfig):
+class SerperToolConfig(BaseToolConfig):
api_key: str = ""
max_results: int = 10
-class SerperSearchTool(BaseTool):
+class SerperTool(BaseTool):
"""
Tool for performing searches using the Serper API based on the provided queries.
Attributes:
- input_schema (SerperSearchToolSchema): The schema for the input data.
- output_schema (SerperSearchToolOutputSchema): The schema for the output data.
+ input_schema (SerperToolSchema): The schema for the input data.
+ output_schema (SerperToolOutputSchema): The schema for the output data.
api_key (str): The API key for the Serper API.
max_results (int): The maximum number of search results to return.
"""
- input_schema = SerperSearchToolSchema
- output_schema = SerperSearchToolOutputSchema
+ input_schema = SerperToolSchema
+ output_schema = SerperToolOutputSchema
- def __init__(self, config: SerperSearchToolConfig = SerperSearchToolConfig()):
+ def __init__(self, config: SerperToolConfig = SerperToolConfig()):
"""
- Initializes the SerperSearchTool.
+ Initializes the SerperTool.
Args:
- config (SerperSearchToolConfig):
+ config (SerperToolConfig):
Configuration for the tool, including API key, max results, and optional title and description overrides.
"""
super().__init__(config)
self.api_key = config.api_key
self.max_results = config.max_results
- def run(self, params: SerperSearchToolSchema, max_results: Optional[int] = None) -> SerperSearchToolOutputSchema:
+ def run(self, params: SerperToolSchema, max_results: Optional[int] = None) -> SerperToolOutputSchema:
"""
- Runs the SerperSearchTool with the given parameters.
+ Runs the SerperTool with the given parameters.
Args:
- params (SerperSearchToolSchema): The input parameters for the tool, adhering to the input schema.
+ params (SerperToolSchema): The input parameters for the tool, adhering to the input schema.
max_results (Optional[int]): The maximum number of search results to return.
Returns:
- SerperSearchToolOutputSchema: The output of the tool, adhering to the output schema.
+ SerperToolOutputSchema: The output of the tool, adhering to the output schema.
Raises:
ValueError: If the API key is not provided.
@@ -129,7 +129,7 @@ class SerperSearchTool(BaseTool):
# Convert to output schema format
output_results = [
- SerperSearchResultSchema(
+ SerperResultSchema(
url=result["link"],
title=result["title"],
content=result.get("snippet"),
@@ -138,7 +138,7 @@ class SerperSearchTool(BaseTool):
for result in filtered_results
]
- return SerperSearchToolOutputSchema(results=output_results)
+ return SerperToolOutputSchema(results=output_results)
#################
@@ -146,9 +146,9 @@ class SerperSearchTool(BaseTool):
#################
if __name__ == "__main__":
rich_console = Console()
- search_tool_instance = SerperSearchTool(config=SerperSearchToolConfig(api_key=os.getenv("SERPER_API_KEY"), max_results=5))
+ search_tool_instance = SerperTool(config=SerperToolConfig(api_key=os.getenv("SERPER_API_KEY"), max_results=5))
- search_input = SerperSearchTool.input_schema(queries=["Python programming", "Machine learning", "Quantum computing"])
+ search_input = SerperTool.input_schema(queries=["Python programming", "Machine learning", "Quantum computing"])
output = search_tool_instance.run(search_input)
diff --git a/atomic_agents/lib/tools/yelp_restaurant_finder_tool.py b/atomic_agents/lib/tools/yelp_restaurant_finder_tool.py
index 59b0664..3f9a3be 100644
--- a/atomic_agents/lib/tools/yelp_restaurant_finder_tool.py
+++ b/atomic_agents/lib/tools/yelp_restaurant_finder_tool.py
@@ -43,7 +43,7 @@ class PriceRange(Enum):
FOUR = "4"
-class YelpSearchToolSchema(BaseIOSchema):
+class YelpSearchToolInputSchema(BaseIOSchema):
location: str = Field(..., description="Location to search for food.")
term: Optional[str] = Field(None, description="Search term (e.g., 'pizza', 'sushi').")
categories: Optional[List[YelpCategory]] = Field(None, description="Categories to filter by (e.g., 'italian, mexican').")
@@ -112,13 +112,13 @@ class YelpSearchTool(BaseTool):
Tool for performing searches using the Yelp API based on the provided queries.
Attributes:
- input_schema (YelpSearchToolSchema): The schema for the input data.
+ input_schema (YelpSearchToolInputSchema): The schema for the input data.
output_schema (YelpSearchToolOutputSchema): The schema for the output data.
api_key (str): The API key for the Yelp API.
max_results (int): The maximum number of search results to return.
"""
- input_schema = YelpSearchToolSchema
+ input_schema = YelpSearchToolInputSchema
output_schema = YelpSearchToolOutputSchema
def __init__(self, config: YelpSearchToolConfig = YelpSearchToolConfig()):
@@ -133,12 +133,12 @@ class YelpSearchTool(BaseTool):
self.api_key = config.api_key
self.max_results = config.max_results
- def run(self, params: YelpSearchToolSchema) -> YelpSearchToolOutputSchema:
+ def run(self, params: YelpSearchToolInputSchema) -> YelpSearchToolOutputSchema:
"""
Runs the YelpSearchTool with the given parameters.
Args:
- params (YelpSearchToolSchema): The input parameters for the tool, adhering to the input schema.
+ params (YelpSearchToolInputSchema): The input parameters for the tool, adhering to the input schema.
max_results (Optional[int]): The maximum number of search results to return.
Returns:
diff --git a/atomic_agents/lib/tools/yt_transcript_scraper_tool.py b/atomic_agents/lib/tools/yt_transcript_scraper_tool.py
index c16f594..6410a5f 100644
--- a/atomic_agents/lib/tools/yt_transcript_scraper_tool.py
+++ b/atomic_agents/lib/tools/yt_transcript_scraper_tool.py
@@ -14,7 +14,7 @@ from atomic_agents.lib.tools.base_tool import BaseTool, BaseToolConfig
################
-class YouTubeTranscriptToolSchema(BaseIOSchema):
+class YouTubeTranscriptToolInputSchema(BaseIOSchema):
video_url: str = Field(..., description="URL of the YouTube video to fetch the transcript for.")
language: Optional[str] = Field(None, description="Language code for the transcript (e.g., 'en' for English).")
@@ -61,11 +61,11 @@ class YouTubeTranscriptTool(BaseTool):
Tool for fetching the transcript of a YouTube video using the YouTube Transcript API.
Attributes:
- input_schema (YouTubeTranscriptToolSchema): The schema for the input data.
+ input_schema (YouTubeTranscriptToolInputSchema): The schema for the input data.
output_schema (YouTubeTranscriptToolOutputSchema): The schema for the output data.
"""
- input_schema = YouTubeTranscriptToolSchema
+ input_schema = YouTubeTranscriptToolInputSchema
output_schema = YouTubeTranscriptToolOutputSchema
def __init__(self, config: YouTubeTranscriptToolConfig):
@@ -78,12 +78,12 @@ class YouTubeTranscriptTool(BaseTool):
super().__init__(config)
self.api_key = config.api_key
- def run(self, params: YouTubeTranscriptToolSchema) -> YouTubeTranscriptToolOutputSchema:
+ def run(self, params: YouTubeTranscriptToolInputSchema) -> YouTubeTranscriptToolOutputSchema:
"""
Runs the YouTubeTranscriptTool with the given parameters.
Args:
- params (YouTubeTranscriptToolSchema): The input parameters for the tool, adhering to the input schema.
+ params (YouTubeTranscriptToolInputSchema): The input parameters for the tool, adhering to the input schema.
Returns:
YouTubeTranscriptToolOutputSchema: The output of the tool, adhering to the output schema.
diff --git a/docs/api/atomic_agents/lib/tools/calculator_tool.md b/docs/api/atomic_agents/lib/tools/calculator_tool.md
index 1c22a34..c3123d2 100644
--- a/docs/api/atomic_agents/lib/tools/calculator_tool.md
+++ b/docs/api/atomic_agents/lib/tools/calculator_tool.md
@@ -9,7 +9,7 @@
- [CalculatorTool().run](#calculatortool()run)
- [CalculatorToolConfig](#calculatortoolconfig)
- [CalculatorToolOutputSchema](#calculatortooloutputschema)
- - [CalculatorToolSchema](#calculatortoolschema)
+ - [CalculatorToolInputSchema](#CalculatorToolInputSchema)
## CalculatorTool
@@ -19,7 +19,7 @@ Tool for performing calculations based on the provided mathematical expression.
#### Attributes
-- `input_schema` *CalculatorToolSchema* - The schema for the input data.
+- `input_schema` *CalculatorToolInputSchema* - The schema for the input data.
- `output_schema` *CalculatorToolOutputSchema* - The schema for the output data.
#### Signature
@@ -42,7 +42,7 @@ Runs the CalculatorTool with the given parameters.
#### Arguments
-- `params` *CalculatorToolSchema* - The input parameters for the tool, adhering to the input schema.
+- `params` *CalculatorToolInputSchema* - The input parameters for the tool, adhering to the input schema.
#### Returns
@@ -51,13 +51,13 @@ Runs the CalculatorTool with the given parameters.
#### Signature
```python
-def run(self, params: CalculatorToolSchema) -> CalculatorToolOutputSchema: ...
+def run(self, params: CalculatorToolInputSchema) -> CalculatorToolOutputSchema: ...
```
#### See also
- [CalculatorToolOutputSchema](#calculatortooloutputschema)
-- [CalculatorToolSchema](#calculatortoolschema)
+- [CalculatorToolInputSchema](#CalculatorToolInputSchema)
@@ -93,14 +93,14 @@ class CalculatorToolOutputSchema(BaseIOSchema): ...
-## CalculatorToolSchema
+## CalculatorToolInputSchema
[Show source in calculator_tool.py:13](../../../../../atomic_agents/lib/tools/calculator_tool.py#L13)
#### Signature
```python
-class CalculatorToolSchema(BaseIOSchema): ...
+class CalculatorToolInputSchema(BaseIOSchema): ...
```
#### See also
diff --git a/docs/api/atomic_agents/lib/tools/content_scraping_tool.md b/docs/api/atomic_agents/lib/tools/content_scraping_tool.md
index c28575e..3d2cb47 100644
--- a/docs/api/atomic_agents/lib/tools/content_scraping_tool.md
+++ b/docs/api/atomic_agents/lib/tools/content_scraping_tool.md
@@ -20,7 +20,7 @@
- [ContentScrapingTool().run](#contentscrapingtool()run)
- [ContentScrapingToolConfig](#contentscrapingtoolconfig)
- [ContentScrapingToolOutputSchema](#contentscrapingtooloutputschema)
- - [ContentScrapingToolSchema](#contentscrapingtoolschema)
+ - [ContentScrapingToolInputSchema](#ContentScrapingToolInputSchema)
## ContentScrapingTool
@@ -30,7 +30,7 @@ Tool for scraping web pages or PDFs and converting content to markdown.
#### Attributes
-- `input_schema` *ContentScrapingToolSchema* - The schema for the input data.
+- `input_schema` *ContentScrapingToolInputSchema* - The schema for the input data.
- `output_schema` *ContentScrapingToolOutputSchema* - The schema for the output data.
#### Signature
@@ -55,7 +55,7 @@ Runs the ContentScrapingTool with the given parameters.
#### Arguments
-- `params` *ContentScrapingToolSchema* - The input parameters for the tool, adhering to the input schema.
+- `params` *ContentScrapingToolInputSchema* - The input parameters for the tool, adhering to the input schema.
#### Returns
@@ -64,13 +64,13 @@ Runs the ContentScrapingTool with the given parameters.
#### Signature
```python
-def run(self, params: ContentScrapingToolSchema) -> ContentScrapingToolOutputSchema: ...
+def run(self, params: ContentScrapingToolInputSchema) -> ContentScrapingToolOutputSchema: ...
```
#### See also
- [ContentScrapingToolOutputSchema](#contentscrapingtooloutputschema)
-- [ContentScrapingToolSchema](#contentscrapingtoolschema)
+- [ContentScrapingToolInputSchema](#ContentScrapingToolInputSchema)
@@ -106,14 +106,14 @@ class ContentScrapingToolOutputSchema(BaseIOSchema): ...
-## ContentScrapingToolSchema
+## ContentScrapingToolInputSchema
[Show source in content_scraping_tool.py:21](../../../../../atomic_agents/lib/tools/content_scraping_tool.py#L21)
#### Signature
```python
-class ContentScrapingToolSchema(BaseIOSchema): ...
+class ContentScrapingToolInputSchema(BaseIOSchema): ...
```
#### See also
diff --git a/docs/api/atomic_agents/lib/tools/yelp_restaurant_finder_tool.md b/docs/api/atomic_agents/lib/tools/yelp_restaurant_finder_tool.md
index 9e21fb4..35f0e75 100644
--- a/docs/api/atomic_agents/lib/tools/yelp_restaurant_finder_tool.md
+++ b/docs/api/atomic_agents/lib/tools/yelp_restaurant_finder_tool.md
@@ -12,7 +12,7 @@
- [YelpSearchTool().run](#yelpsearchtool()run)
- [YelpSearchToolConfig](#yelpsearchtoolconfig)
- [YelpSearchToolOutputSchema](#yelpsearchtooloutputschema)
- - [YelpSearchToolSchema](#yelpsearchtoolschema)
+ - [YelpSearchToolInputSchema](#YelpSearchToolInputSchema)
## PriceRange
@@ -62,7 +62,7 @@ Tool for performing searches using the Yelp API based on the provided queries.
#### Attributes
-- `input_schema` *YelpSearchToolSchema* - The schema for the input data.
+- `input_schema` *YelpSearchToolInputSchema* - The schema for the input data.
- `output_schema` *YelpSearchToolOutputSchema* - The schema for the output data.
- `api_key` *str* - The API key for the Yelp API.
- `max_results` *int* - The maximum number of search results to return.
@@ -87,7 +87,7 @@ Runs the YelpSearchTool with the given parameters.
#### Arguments
-- `params` *YelpSearchToolSchema* - The input parameters for the tool, adhering to the input schema.
+- `params` *YelpSearchToolInputSchema* - The input parameters for the tool, adhering to the input schema.
- `max_results` *Optional[int]* - The maximum number of search results to return.
#### Returns
@@ -102,13 +102,13 @@ Runs the YelpSearchTool with the given parameters.
#### Signature
```python
-def run(self, params: YelpSearchToolSchema) -> YelpSearchToolOutputSchema: ...
+def run(self, params: YelpSearchToolInputSchema) -> YelpSearchToolOutputSchema: ...
```
#### See also
- [YelpSearchToolOutputSchema](#yelpsearchtooloutputschema)
-- [YelpSearchToolSchema](#yelpsearchtoolschema)
+- [YelpSearchToolInputSchema](#YelpSearchToolInputSchema)
@@ -144,14 +144,14 @@ class YelpSearchToolOutputSchema(BaseIOSchema): ...
-## YelpSearchToolSchema
+## YelpSearchToolInputSchema
[Show source in yelp_restaurant_finder_tool.py:46](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L46)
#### Signature
```python
-class YelpSearchToolSchema(BaseIOSchema): ...
+class YelpSearchToolInputSchema(BaseIOSchema): ...
```
#### See also
diff --git a/docs/api/atomic_agents/lib/tools/yt_transcript_scraper.md b/docs/api/atomic_agents/lib/tools/yt_transcript_scraper.md
index f50d108..2c8b9b4 100644
--- a/docs/api/atomic_agents/lib/tools/yt_transcript_scraper.md
+++ b/docs/api/atomic_agents/lib/tools/yt_transcript_scraper.md
@@ -11,7 +11,7 @@
- [YouTubeTranscriptTool().run](#youtubetranscripttool()run)
- [YouTubeTranscriptToolConfig](#youtubetranscripttoolconfig)
- [YouTubeTranscriptToolOutputSchema](#youtubetranscripttooloutputschema)
- - [YouTubeTranscriptToolSchema](#youtubetranscripttoolschema)
+ - [YouTubeTranscriptToolInputSchema](#YouTubeTranscriptToolInputSchema)
## YouTubeTranscriptTool
@@ -21,7 +21,7 @@ Tool for fetching the transcript of a YouTube video using the YouTube Transcript
#### Attributes
-- `input_schema` *YouTubeTranscriptToolSchema* - The schema for the input data.
+- `input_schema` *YouTubeTranscriptToolInputSchema* - The schema for the input data.
- `output_schema` *YouTubeTranscriptToolOutputSchema* - The schema for the output data.
#### Signature
@@ -85,7 +85,7 @@ Runs the YouTubeTranscriptTool with the given parameters.
#### Arguments
-- `params` *YouTubeTranscriptToolSchema* - The input parameters for the tool, adhering to the input schema.
+- `params` *YouTubeTranscriptToolInputSchema* - The input parameters for the tool, adhering to the input schema.
#### Returns
@@ -99,14 +99,14 @@ Runs the YouTubeTranscriptTool with the given parameters.
```python
def run(
- self, params: YouTubeTranscriptToolSchema
+ self, params: YouTubeTranscriptToolInputSchema
) -> YouTubeTranscriptToolOutputSchema: ...
```
#### See also
- [YouTubeTranscriptToolOutputSchema](#youtubetranscripttooloutputschema)
-- [YouTubeTranscriptToolSchema](#youtubetranscripttoolschema)
+- [YouTubeTranscriptToolInputSchema](#YouTubeTranscriptToolInputSchema)
@@ -142,14 +142,14 @@ class YouTubeTranscriptToolOutputSchema(BaseIOSchema): ...
-## YouTubeTranscriptToolSchema
+## YouTubeTranscriptToolInputSchema
[Show source in yt_transcript_scraper_tool.py:17](../../../../../atomic_agents/lib/tools/yt_transcript_scraper_tool.py#L17)
#### Signature
```python
-class YouTubeTranscriptToolSchema(BaseIOSchema): ...
+class YouTubeTranscriptToolInputSchema(BaseIOSchema): ...
```
#### See also
diff --git a/examples/deep_research_multi_agent/agents/query_agent.py b/examples/deep_research_multi_agent/agents/query_agent.py
index 26546d4..8602289 100644
--- a/examples/deep_research_multi_agent/agents/query_agent.py
+++ b/examples/deep_research_multi_agent/agents/query_agent.py
@@ -2,7 +2,7 @@ import instructor
import openai
from atomic_agents.agents.base_agent import BaseIOSchema, BaseAgent, BaseAgentConfig
from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo
-from atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool
+from atomic_agents.lib.tools.search.searx_tool import SearxNGTool
class QueryAgentInputSchema(BaseIOSchema):
instruction: str = 'A detailed instruction or request to generate deep research queries for.'
@@ -31,6 +31,6 @@ query_agent = BaseAgent(
)
),
input_schema=QueryAgentInputSchema,
- output_schema=SearxNGSearchTool.input_schema
+ output_schema=SearxNGTool.input_schema
)
)
\ No newline at end of file
diff --git a/examples/deep_research_multi_agent/main.py b/examples/deep_research_multi_agent/main.py
index bdc150d..fb2d226 100644
--- a/examples/deep_research_multi_agent/main.py
+++ b/examples/deep_research_multi_agent/main.py
@@ -5,7 +5,7 @@ from examples.deep_research_multi_agent.agents.top_urls_selector_agent import to
from examples.deep_research_multi_agent.agents.info_refiner_agent import refine_answer_agent
from examples.deep_research_multi_agent.providers import search_results_provider, vector_db_chunks_provider
from examples.deep_research_multi_agent.in_memory_faiss import InMemFaiss
-from atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool, SearxNGSearchToolConfig
+from atomic_agents.lib.tools.search.searx_tool import SearxNGTool, SearxNGToolConfig
from rich.console import Console
import asyncio
@@ -14,7 +14,7 @@ async def main():
console = Console()
# Initialize the search tool
- search_tool = SearxNGSearchTool(SearxNGSearchToolConfig(base_url=os.getenv('SEARXNG_BASE_URL'), max_results=30))
+ search_tool = SearxNGTool(SearxNGToolConfig(base_url=os.getenv('SEARXNG_BASE_URL'), max_results=30))
in_mem_faiss = InMemFaiss(openai_api_key=os.getenv('OPENAI_API_KEY'))
user_input = input("Enter your question (or type 'exit' to quit): ")
diff --git a/examples/mesop_example.py b/examples/mesop_example.py
index 594ad85..ab31950 100644
--- a/examples/mesop_example.py
+++ b/examples/mesop_example.py
@@ -16,7 +16,7 @@ import mesop.labs as mel
from dataclasses import field
from atomic_agents.agents.tool_interface_agent import ToolInterfaceAgent, ToolInterfaceAgentConfig
-from atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool, SearxNGSearchToolConfig
+from atomic_agents.lib.tools.search.searx_tool import SearxNGTool, SearxNGToolConfig
# Initialize the console, client, and tools
console = Console()
@@ -24,8 +24,8 @@ client = instructor.from_openai(openai.OpenAI())
def initialize_searx_tool():
base_url = os.getenv('SEARXNG_BASE_URL')
- config = SearxNGSearchToolConfig(base_url=base_url, max_results=10)
- return SearxNGSearchTool(config)
+ config = SearxNGToolConfig(base_url=base_url, max_results=10)
+ return SearxNGTool(config)
searx_tool = initialize_searx_tool()
@@ -48,7 +48,7 @@ class State:
# Mesop transform function
def transform(input: str, history: list[mel.ChatMessage]):
state = me.state(State)
- response = agent.run(agent.input_schema(tool_input_SearxNGSearchTool=input))
+ response = agent.run(agent.input_schema(tool_input_SearxNGTool=input))
state.chat_history.append(mel.ChatMessage(content=f"You: {input}"))
state.chat_history.append(mel.ChatMessage(content=f"Agent: {response.chat_message}"))
yield response.chat_message
@@ -60,7 +60,7 @@ def transform(input: str, history: list[mel.ChatMessage]):
title="ToolInterfaceAgent Chat"
)
def page():
- mel.chat(transform, title="ToolInterfaceAgent with SearxNGSearchTool", bot_user="Agent")
+ mel.chat(transform, title="ToolInterfaceAgent with SearxNGTool", bot_user="Agent")
# Main function to run the Mesop app
if __name__ == "__main__":
diff --git a/examples/minimal_multi_agent_tool_use.py b/examples/minimal_multi_agent_tool_use.py
index 7b58a33..a097420 100644
--- a/examples/minimal_multi_agent_tool_use.py
+++ b/examples/minimal_multi_agent_tool_use.py
@@ -6,12 +6,12 @@ from pydantic import create_model
from rich.console import Console
from atomic_agents.agents.base_agent import BaseIOSchema, BaseAgent, BaseAgentConfig
from atomic_agents.agents.tool_interface_agent import ToolInterfaceAgent, ToolInterfaceAgentConfig
-from atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool, SearxNGSearchToolConfig
+from atomic_agents.lib.tools.search.searx_tool import SearxNGTool, SearxNGToolConfig
from atomic_agents.lib.tools.calculator_tool import CalculatorTool, CalculatorToolConfig
console = Console()
client = instructor.from_openai(openai.OpenAI())
-searx_tool = SearxNGSearchTool(SearxNGSearchToolConfig(base_url=os.getenv('SEARXNG_BASE_URL'), max_results=10))
+searx_tool = SearxNGTool(SearxNGToolConfig(base_url=os.getenv('SEARXNG_BASE_URL'), max_results=10))
calc_tool = CalculatorTool(CalculatorToolConfig())
search_agent_config = ToolInterfaceAgentConfig(client=client, model='gpt-3.5-turbo', tool_instance=searx_tool, return_raw_output=False)
diff --git a/examples/notebooks/multi_agent_quickstart.ipynb b/examples/notebooks/multi_agent_quickstart.ipynb
index 9d6444d..8565f94 100644
--- a/examples/notebooks/multi_agent_quickstart.ipynb
+++ b/examples/notebooks/multi_agent_quickstart.ipynb
@@ -67,7 +67,7 @@
"from rich.console import Console\n",
"from atomic_agents.agents.base_agent import BaseIOSchema, BaseAgent, BaseAgentConfig\n",
"from atomic_agents.agents.tool_interface_agent import ToolInterfaceAgent, ToolInterfaceAgentConfig\n",
- "from atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool, SearxNGSearchToolConfig\n",
+ "from atomic_agents.lib.tools.search.searx_tool import SearxNGTool, SearxNGToolConfig\n",
"from atomic_agents.lib.tools.calculator_tool import CalculatorTool, CalculatorToolConfig"
]
},
@@ -93,7 +93,7 @@
"client = instructor.from_openai(openai.OpenAI())\n",
"\n",
"# Initialize the SearxNG search tool\n",
- "searx_tool = SearxNGSearchTool(SearxNGSearchToolConfig(base_url=os.getenv('SEARXNG_BASE_URL'), max_results=10))\n",
+ "searx_tool = SearxNGTool(SearxNGToolConfig(base_url=os.getenv('SEARXNG_BASE_URL'), max_results=10))\n",
"\n",
"# Initialize the calculator tool\n",
"calc_tool = CalculatorTool(CalculatorToolConfig())"
diff --git a/examples/notebooks/what_is_atomic_agents.ipynb b/examples/notebooks/what_is_atomic_agents.ipynb
index da6dbd2..5834459 100644
--- a/examples/notebooks/what_is_atomic_agents.ipynb
+++ b/examples/notebooks/what_is_atomic_agents.ipynb
@@ -433,7 +433,7 @@
" THREE = \"3\"\n",
" FOUR = \"4\"\n",
"\n",
- "class YelpSearchToolSchema(BaseIOSchema):\n",
+ "class YelpSearchToolInputSchema(BaseIOSchema):\n",
" location: str = Field(..., description=\"Location to search for food.\")\n",
" term: Optional[str] = Field(None, description=\"Search term (e.g., 'pizza', 'sushi').\")\n",
" categories: Optional[List[YelpCategory]] = Field(None, description=\"Categories to filter by (e.g., 'italian, mexican').\")\n",
@@ -603,19 +603,19 @@
"from rich.console import Console\n",
"\n",
"from atomic_agents.agents.tool_interface_agent import ToolInterfaceAgent, ToolInterfaceAgentConfig\n",
- "from atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool, SearxNGSearchToolConfig\n",
+ "from atomic_agents.lib.tools.search.searx_tool import SearxNGTool, SearxNGToolConfig\n",
"\n",
"def initialize_searx_tool():\n",
" \"\"\"\n",
- " Initialize the SearxNGSearchTool with configuration.\n",
+ " Initialize the SearxNGTool with configuration.\n",
" \"\"\"\n",
" base_url = os.getenv('SEARXNG_BASE_URL')\n",
- " config = SearxNGSearchToolConfig(base_url=base_url, max_results=10)\n",
- " return SearxNGSearchTool(config)\n",
+ " config = SearxNGToolConfig(base_url=base_url, max_results=10)\n",
+ " return SearxNGTool(config)\n",
"\n",
"def initialize_agent(client, searx_tool):\n",
" \"\"\"\n",
- " Initialize the ToolInterfaceAgent with the given client and SearxNGSearchTool.\n",
+ " Initialize the ToolInterfaceAgent with the given client and SearxNGTool.\n",
" \"\"\"\n",
" agent_config = ToolInterfaceAgentConfig(\n",
" client=client,\n",
@@ -635,7 +635,7 @@
" searx_tool = initialize_searx_tool()\n",
" agent = initialize_agent(client, searx_tool)\n",
"\n",
- " console.print(\"ToolInterfaceAgent with SearxNGSearchTool is ready.\")\n",
+ " console.print(\"ToolInterfaceAgent with SearxNGTool is ready.\")\n",
"\n",
" while True:\n",
" user_input = input('You: ')\n",
diff --git a/examples/notebooks/yelp_agent.ipynb b/examples/notebooks/yelp_agent.ipynb
index 5f8ef9f..76d3652 100644
--- a/examples/notebooks/yelp_agent.ipynb
+++ b/examples/notebooks/yelp_agent.ipynb
@@ -70,7 +70,7 @@
"from atomic_agents.lib.components.agent_memory import AgentMemory\n",
"from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo\n",
"from atomic_agents.agents.base_agent import BaseAgent, BaseAgentOutputSchema, BaseAgentConfig\n",
- "from atomic_agents.lib.tools.yelp_restaurant_finder_tool import YelpSearchTool, YelpSearchToolConfig, YelpSearchToolSchema"
+ "from atomic_agents.lib.tools.yelp_restaurant_finder_tool import YelpSearchTool, YelpSearchToolConfig, YelpSearchToolInputSchema"
]
},
{
@@ -194,7 +194,7 @@
"source": [
"# Define a custom response schema that can handle both chat responses and Yelp search tool responses\n",
"class ResponseSchema(BaseModel):\n",
- " chosen_schema: Union[BaseAgentOutputSchema, YelpSearchToolSchema] = Field(..., description='The response from the chat agent.')\n",
+ " chosen_schema: Union[BaseAgentOutputSchema, YelpSearchToolInputSchema] = Field(..., description='The response from the chat agent.')\n",
"\n",
" class Config:\n",
" title = 'OutputSchema'\n",
@@ -260,7 +260,7 @@
" response = agent.run(agent.input_schema(chat_message=user_input).model_dump())\n",
" \n",
" # Check the type of the response schema\n",
- " if isinstance(response.chosen_schema, YelpSearchToolSchema):\n",
+ " if isinstance(response.chosen_schema, YelpSearchToolInputSchema):\n",
" output = yelp_tool.run(response.chosen_schema)\n",
" agent.memory.add_message('system', f'The following information was found: {output.results}\\n\\n Please summarize the results for the user.')\n",
" output = agent.run().chosen_schema.chat_message\n",
diff --git a/examples/notebooks/youtube_knowledge_extraction.ipynb b/examples/notebooks/youtube_knowledge_extraction.ipynb
index 8593625..ea8865d 100644
--- a/examples/notebooks/youtube_knowledge_extraction.ipynb
+++ b/examples/notebooks/youtube_knowledge_extraction.ipynb
@@ -102,7 +102,7 @@
"\n",
"from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig\n",
"from atomic_agents.lib.components.system_prompt_generator import SystemPromptContextProviderBase, SystemPromptGenerator, SystemPromptInfo\n",
- "from atomic_agents.lib.tools.yt_transcript_scraper import YouTubeTranscriptTool, YouTubeTranscriptToolConfig, YouTubeTranscriptToolSchema"
+ "from atomic_agents.lib.tools.yt_transcript_scraper import YouTubeTranscriptTool, YouTubeTranscriptToolConfig, YouTubeTranscriptToolInputSchema"
]
},
{
@@ -236,7 +236,7 @@
"outputs": [],
"source": [
"video_url = input('Enter the YouTube video URL: ')\n",
- "scraped_transcript = yt_scraper_tool.run(YouTubeTranscriptToolSchema(video_url=video_url))\n",
+ "scraped_transcript = yt_scraper_tool.run(YouTubeTranscriptToolInputSchema(video_url=video_url))\n",
"transcript_provider.transcript = scraped_transcript.transcript\n",
"transcript_provider.duration = scraped_transcript.duration\n",
"transcript_provider.metadata = scraped_transcript.metadata\n",
diff --git a/examples/product_finder.py b/examples/product_finder.py
index a75b430..66f838e 100644
--- a/examples/product_finder.py
+++ b/examples/product_finder.py
@@ -9,7 +9,7 @@ from rich.console import Console
from atomic_agents.lib.components.agent_memory import AgentMemory
from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo
from atomic_agents.agents.base_agent import BaseAgent, BaseAgentOutputSchema, BaseAgentConfig
-from atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool, SearxNGSearchToolConfig, SearxNGSearchToolSchema
+from atomic_agents.lib.tools.search.searx_tool import SearxNGTool, SearxNGToolConfig, SearxNGToolInputSchema
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
@@ -24,7 +24,7 @@ system_prompt = SystemPromptInfo(
'Greet the user and introduce yourself as a product finder assistant.',
'Ask the user questions to gather information about the product they are looking for.',
'Use the chat responses to gather all necessary information from the user.',
- 'Once sufficient information is gathered, use the SearxNGSearchTool to search for products.',
+ 'Once sufficient information is gathered, use the SearxNGTool to search for products.',
'Summarize the search results and provide recommendations to the user.',
],
output_instructions=[
@@ -49,12 +49,12 @@ console = Console()
# Initialize the client
client = instructor.from_openai(openai.OpenAI())
-# Initialize the SearxNGSearchTool
-searx_tool = SearxNGSearchTool(SearxNGSearchToolConfig(base_url=os.getenv('SEARXNG_BASE_URL'), max_results=5))
+# Initialize the SearxNGTool
+searx_tool = SearxNGTool(SearxNGToolConfig(base_url=os.getenv('SEARXNG_BASE_URL'), max_results=5))
# Define a custom response schema
class OutputSchema(BaseModel):
- chosen_schema: Union[BaseAgentOutputSchema, SearxNGSearchToolSchema] = Field(..., description='The response from the chat agent.')
+ chosen_schema: Union[BaseAgentOutputSchema, SearxNGToolInputSchema] = Field(..., description='The response from the chat agent.')
class Config:
title = 'OutputSchema'
@@ -85,7 +85,7 @@ while True:
logger.info(f'Chosen schema: {response.chosen_schema}')
- if isinstance(response.chosen_schema, SearxNGSearchToolSchema):
+ if isinstance(response.chosen_schema, SearxNGToolInputSchema):
search_results = searx_tool.run(response.chosen_schema)
agent.memory.add_message('assistant', f'INTERNAL THOUGHT: I have found the following products: {search_results.results}\n\n I will now summarize the results for the user.')
diff --git a/examples/simple_web_search_agent.py b/examples/simple_web_search_agent.py
index 722c520..92b012a 100644
--- a/examples/simple_web_search_agent.py
+++ b/examples/simple_web_search_agent.py
@@ -5,19 +5,19 @@ import openai
from rich.console import Console
from atomic_agents.agents.tool_interface_agent import ToolInterfaceAgent, ToolInterfaceAgentConfig
-from atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool, SearxNGSearchToolConfig
+from atomic_agents.lib.tools.search.searx_tool import SearxNGTool, SearxNGToolConfig
def initialize_searx_tool():
"""
- Initialize the SearxNGSearchTool with configuration.
+ Initialize the SearxNGTool with configuration.
"""
base_url = os.getenv('SEARXNG_BASE_URL')
- config = SearxNGSearchToolConfig(base_url=base_url, max_results=10)
- return SearxNGSearchTool(config)
+ config = SearxNGToolConfig(base_url=base_url, max_results=10)
+ return SearxNGTool(config)
def initialize_agent(client, searx_tool):
"""
- Initialize the ToolInterfaceAgent with the given client and SearxNGSearchTool.
+ Initialize the ToolInterfaceAgent with the given client and SearxNGTool.
"""
agent_config = ToolInterfaceAgentConfig(
client=client,
@@ -33,7 +33,7 @@ def main():
searx_tool = initialize_searx_tool()
agent = initialize_agent(client, searx_tool)
- console.print("ToolInterfaceAgent with SearxNGSearchTool is ready.")
+ console.print("ToolInterfaceAgent with SearxNGTool is ready.")
while True:
user_input = input('You: ')
@@ -42,7 +42,7 @@ def main():
break
# Fix this
- response = agent.run(agent.input_schema(tool_input_SearxNGSearchTool=user_input))
+ response = agent.run(agent.input_schema(tool_input_SearxNGTool=user_input))
console.print(f'Agent: {response.chat_message}')
if __name__ == "__main__":
diff --git a/examples/yelp_restaurant_finder.py b/examples/yelp_restaurant_finder.py
index 4656c1b..cb0d76f 100644
--- a/examples/yelp_restaurant_finder.py
+++ b/examples/yelp_restaurant_finder.py
@@ -9,7 +9,7 @@ from rich.console import Console
from atomic_agents.lib.components.agent_memory import AgentMemory
from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo
from atomic_agents.agents.base_agent import BaseAgent, BaseAgentOutputSchema, BaseAgentConfig
-from atomic_agents.lib.tools.yelp_restaurant_finder_tool import YelpSearchTool, YelpSearchToolConfig, YelpSearchToolSchema
+from atomic_agents.lib.tools.yelp_restaurant_finder_tool import YelpSearchTool, YelpSearchToolConfig, YelpSearchToolInputSchema
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
@@ -57,7 +57,7 @@ yelp_tool = YelpSearchTool(YelpSearchToolConfig(api_key=os.getenv('YELP_API_KEY'
# Define a custom response schema that can handle both chat responses and Yelp search tool responses
class OutputSchema(BaseModel):
- chosen_schema: Union[BaseAgentOutputSchema, YelpSearchToolSchema] = Field(..., description='The response from the chat agent.')
+ chosen_schema: Union[BaseAgentOutputSchema, YelpSearchToolInputSchema] = Field(..., description='The response from the chat agent.')
class Config:
title = 'OutputSchema'
@@ -94,7 +94,7 @@ while True:
logger.info(f'Chosen schema: {response.chosen_schema}')
# Check the type of the response schema
- if isinstance(response.chosen_schema, YelpSearchToolSchema):
+ if isinstance(response.chosen_schema, YelpSearchToolInputSchema):
output = yelp_tool.run(response.chosen_schema)
# In this example, we will add a simple "internal thought" to the chat memory followed by an empty agent.run() call.
diff --git a/examples/youtube_knowledge_extraction.py b/examples/youtube_knowledge_extraction.py
index 9ee85ef..40584bd 100644
--- a/examples/youtube_knowledge_extraction.py
+++ b/examples/youtube_knowledge_extraction.py
@@ -8,7 +8,7 @@ from typing import List, Optional
from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig
from atomic_agents.lib.components.system_prompt_generator import SystemPromptContextProviderBase, SystemPromptGenerator, SystemPromptInfo
-from atomic_agents.lib.tools.yt_transcript_scraper import YouTubeTranscriptTool, YouTubeTranscriptToolConfig, YouTubeTranscriptToolSchema
+from atomic_agents.lib.tools.yt_transcript_scraper import YouTubeTranscriptTool, YouTubeTranscriptToolConfig, YouTubeTranscriptToolInputSchema
console = Console()
@@ -68,7 +68,7 @@ agent = BaseAgent(
)
video_url = input('Enter the YouTube video URL: ')
-scraped_transcript = yt_scraper_tool.run(YouTubeTranscriptToolSchema(video_url=video_url))
+scraped_transcript = yt_scraper_tool.run(YouTubeTranscriptToolInputSchema(video_url=video_url))
transcript_provider.transcript = scraped_transcript.transcript
transcript_provider.duration = scraped_transcript.duration
transcript_provider.metadata = scraped_transcript.metadata
diff --git a/tests/lib/tools/test_calculator_tool.py b/tests/lib/tools/test_calculator_tool.py
index de3615a..9290dc0 100644
--- a/tests/lib/tools/test_calculator_tool.py
+++ b/tests/lib/tools/test_calculator_tool.py
@@ -1,5 +1,5 @@
import pytest
-from atomic_agents.lib.tools.calculator_tool import CalculatorTool, CalculatorToolSchema, CalculatorToolOutputSchema, CalculatorToolConfig
+from atomic_agents.lib.tools.calculator_tool import CalculatorTool, CalculatorToolInputSchema, CalculatorToolOutputSchema, CalculatorToolConfig
from atomic_agents.lib.tools.base_tool import BaseTool, BaseToolConfig
def test_calculator_tool_initialization():
@@ -16,7 +16,7 @@ def test_calculator_tool_with_custom_config():
def test_calculator_tool_input_schema():
tool = CalculatorTool()
- assert tool.input_schema == CalculatorToolSchema
+ assert tool.input_schema == CalculatorToolInputSchema
def test_calculator_tool_output_schema():
tool = CalculatorTool()
@@ -32,33 +32,33 @@ def test_calculator_tool_output_schema():
])
def test_calculator_tool_run_valid_expressions(expression, expected_result):
tool = CalculatorTool()
- result = tool.run(CalculatorToolSchema(expression=expression))
+ result = tool.run(CalculatorToolInputSchema(expression=expression))
assert isinstance(result, CalculatorToolOutputSchema)
assert result.result == expected_result
def test_calculator_tool_run_complex_expression():
tool = CalculatorTool()
expression = "sqrt(3**2 + 4**2)"
- result = tool.run(CalculatorToolSchema(expression=expression))
+ result = tool.run(CalculatorToolInputSchema(expression=expression))
assert isinstance(result, CalculatorToolOutputSchema)
assert result.result == "5.00000000000000"
def test_calculator_tool_run_invalid_expression():
tool = CalculatorTool()
invalid_expression = "invalid + expression"
- result = tool.run(CalculatorToolSchema(expression=invalid_expression))
+ result = tool.run(CalculatorToolInputSchema(expression=invalid_expression))
assert isinstance(result, CalculatorToolOutputSchema)
assert set(result.result.split(' + ')) == set(invalid_expression.split(' + '))
def test_calculator_tool_run_division_by_zero():
tool = CalculatorTool()
- result = tool.run(CalculatorToolSchema(expression="1/0"))
+ result = tool.run(CalculatorToolInputSchema(expression="1/0"))
assert isinstance(result, CalculatorToolOutputSchema)
assert result.result == "zoo" # SymPy returns "zoo" for complex infinity
def test_calculator_tool_run_with_variables():
tool = CalculatorTool()
- result = tool.run(CalculatorToolSchema(expression="x + y"))
+ result = tool.run(CalculatorToolInputSchema(expression="x + y"))
assert isinstance(result, CalculatorToolOutputSchema)
assert result.result == "x + y" # The tool doesn't evaluate expressions with variables
diff --git a/tests/lib/tools/test_content_scraping_tool.py b/tests/lib/tools/test_content_scraping_tool.py
index a9aaee4..bef15c0 100644
--- a/tests/lib/tools/test_content_scraping_tool.py
+++ b/tests/lib/tools/test_content_scraping_tool.py
@@ -2,7 +2,7 @@ import pytest
from unittest.mock import patch, MagicMock
from atomic_agents.lib.tools.content_scraping_tool import (
ContentScrapingTool,
- ContentScrapingToolSchema,
+ ContentScrapingToolInputSchema,
ContentScrapingToolOutputSchema,
ContentScrapingToolConfig,
)
@@ -24,7 +24,7 @@ def test_content_scraping_tool_with_custom_config():
def test_content_scraping_tool_input_schema():
tool = ContentScrapingTool()
- assert tool.input_schema == ContentScrapingToolSchema
+ assert tool.input_schema == ContentScrapingToolInputSchema
def test_content_scraping_tool_output_schema():
tool = ContentScrapingTool()
@@ -46,7 +46,7 @@ def test_content_scraping_tool_run(mock_head, content_type, expected_converter):
with patch.object(expected_converter, "convert", return_value=mock_document):
tool = ContentScrapingTool()
- result = tool.run(ContentScrapingToolSchema(url="https://example.com"))
+ result = tool.run(ContentScrapingToolInputSchema(url="https://example.com"))
assert isinstance(result, ContentScrapingToolOutputSchema)
assert result.content == "Mocked content"
@@ -64,14 +64,14 @@ def test_content_scraping_tool_run_unknown_content_type(mock_head):
with patch.object(UrlToMarkdownConverter, "convert", return_value=mock_document):
tool = ContentScrapingTool()
- result = tool.run(ContentScrapingToolSchema(url="https://example.com"))
+ result = tool.run(ContentScrapingToolInputSchema(url="https://example.com"))
assert isinstance(result, ContentScrapingToolOutputSchema)
assert result.content == "Mocked content"
assert result.metadata == {"key": "value"}
def test_content_scraping_tool_schema_fields():
- schema = ContentScrapingToolSchema(url="https://example.com")
+ schema = ContentScrapingToolInputSchema(url="https://example.com")
assert schema.url == "https://example.com"
def test_content_scraping_tool_output_schema_fields():
diff --git a/tests/lib/tools/test_yelp_restaurant_finder_tool.py b/tests/lib/tools/test_yelp_restaurant_finder_tool.py
index 55aa98a..0c8811d 100644
--- a/tests/lib/tools/test_yelp_restaurant_finder_tool.py
+++ b/tests/lib/tools/test_yelp_restaurant_finder_tool.py
@@ -5,7 +5,7 @@ from pydantic import ValidationError
from atomic_agents.lib.tools.yelp_restaurant_finder_tool import (
YelpSearchTool,
YelpSearchToolConfig,
- YelpSearchToolSchema,
+ YelpSearchToolInputSchema,
YelpSearchToolOutputSchema,
YelpCategory,
PriceRange
@@ -39,11 +39,11 @@ def test_yelp_search_tool_initialization(yelp_search_tool):
assert yelp_search_tool.max_results == 10
def test_yelp_search_tool_input_schema():
- assert issubclass(YelpSearchToolSchema, BaseIOSchema)
- assert "location" in YelpSearchToolSchema.model_fields
- assert "term" in YelpSearchToolSchema.model_fields
- assert "categories" in YelpSearchToolSchema.model_fields
- assert "price" in YelpSearchToolSchema.model_fields
+ assert issubclass(YelpSearchToolInputSchema, BaseIOSchema)
+ assert "location" in YelpSearchToolInputSchema.model_fields
+ assert "term" in YelpSearchToolInputSchema.model_fields
+ assert "categories" in YelpSearchToolInputSchema.model_fields
+ assert "price" in YelpSearchToolInputSchema.model_fields
def test_yelp_search_tool_output_schema():
assert issubclass(YelpSearchToolOutputSchema, BaseIOSchema)
@@ -56,7 +56,7 @@ def test_run_success(mock_get, yelp_search_tool):
mock_response.json.return_value = SAMPLE_YELP_RESPONSE
mock_get.return_value = mock_response
- input_data = YelpSearchToolSchema(
+ input_data = YelpSearchToolInputSchema(
location="Sample City",
term="pizza",
categories=[YelpCategory.ITALIAN],
@@ -88,7 +88,7 @@ def test_run_api_error(mock_get, yelp_search_tool):
mock_response.reason = "Bad Request"
mock_get.return_value = mock_response
- input_data = YelpSearchToolSchema(location="Sample City")
+ input_data = YelpSearchToolInputSchema(location="Sample City")
with pytest.raises(Exception, match="Failed to fetch search results: 400 Bad Request"):
yelp_search_tool.run(input_data)
@@ -100,7 +100,7 @@ def test_run_with_all_parameters(mock_get, yelp_search_tool):
mock_response.json.return_value = SAMPLE_YELP_RESPONSE
mock_get.return_value = mock_response
- input_data = YelpSearchToolSchema(
+ input_data = YelpSearchToolInputSchema(
location="Sample City",
term="pizza",
categories=[YelpCategory.ITALIAN, YelpCategory.PIZZA],
@@ -126,7 +126,7 @@ def test_run_no_results(mock_get, yelp_search_tool):
mock_response.json.return_value = {"businesses": []}
mock_get.return_value = mock_response
- input_data = YelpSearchToolSchema(location="Sample City")
+ input_data = YelpSearchToolInputSchema(location="Sample City")
result = yelp_search_tool.run(input_data)
assert isinstance(result, YelpSearchToolOutputSchema)
@@ -135,7 +135,7 @@ def test_run_no_results(mock_get, yelp_search_tool):
def test_run_missing_api_key():
config = YelpSearchToolConfig(api_key="", max_results=10)
tool = YelpSearchTool(config)
- input_data = YelpSearchToolSchema(location="Sample City")
+ input_data = YelpSearchToolInputSchema(location="Sample City")
with pytest.raises(ValueError, match="API key is required to use the Yelp API."):
tool.run(input_data)
\ No newline at end of file
diff --git a/tests/lib/tools/test_yt_transcript_scraper_tool.py b/tests/lib/tools/test_yt_transcript_scraper_tool.py
index bea171a..321a0df 100644
--- a/tests/lib/tools/test_yt_transcript_scraper_tool.py
+++ b/tests/lib/tools/test_yt_transcript_scraper_tool.py
@@ -2,11 +2,11 @@ import pytest
from unittest.mock import patch, Mock
from pydantic import ValidationError
from youtube_transcript_api import YouTubeTranscriptApi, NoTranscriptFound, TranscriptsDisabled
-from atomic_agents.lib.tools.yt_transcript_scraper_tool import YouTubeTranscriptToolSchema
+from atomic_agents.lib.tools.yt_transcript_scraper_tool import YouTubeTranscriptToolInputSchema
from atomic_agents.lib.tools.yt_transcript_scraper_tool import (
YouTubeTranscriptTool,
YouTubeTranscriptToolConfig,
- YouTubeTranscriptToolSchema,
+ YouTubeTranscriptToolInputSchema,
YouTubeTranscriptToolOutputSchema,
)
from atomic_agents.lib.tools.base_tool import BaseTool
@@ -37,9 +37,9 @@ def test_youtube_transcript_tool_initialization(youtube_transcript_tool):
assert youtube_transcript_tool.api_key == "dummy_api_key"
def test_youtube_transcript_tool_input_schema():
- assert issubclass(YouTubeTranscriptToolSchema, BaseIOSchema)
- assert "video_url" in YouTubeTranscriptToolSchema.model_fields
- assert "language" in YouTubeTranscriptToolSchema.model_fields
+ assert issubclass(YouTubeTranscriptToolInputSchema, BaseIOSchema)
+ assert "video_url" in YouTubeTranscriptToolInputSchema.model_fields
+ assert "language" in YouTubeTranscriptToolInputSchema.model_fields
def test_youtube_transcript_tool_output_schema():
assert issubclass(YouTubeTranscriptToolOutputSchema, BaseIOSchema)
@@ -61,7 +61,7 @@ def test_run(mock_get_transcript, mock_fetch_metadata, mock_extract_video_id, yo
mock_fetch_metadata.return_value = SAMPLE_VIDEO_INFO
mock_get_transcript.return_value = SAMPLE_TRANSCRIPT
- input_data = YouTubeTranscriptToolSchema(video_url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
+ input_data = YouTubeTranscriptToolInputSchema(video_url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
result = youtube_transcript_tool.run(input_data)
assert isinstance(result, YouTubeTranscriptToolOutputSchema)
@@ -78,7 +78,7 @@ def test_run_with_language(mock_get_transcript, mock_fetch_metadata, mock_extrac
mock_fetch_metadata.return_value = SAMPLE_VIDEO_INFO
mock_get_transcript.return_value = SAMPLE_TRANSCRIPT
- input_data = YouTubeTranscriptToolSchema(
+ input_data = YouTubeTranscriptToolInputSchema(
video_url="https://www.youtube.com/watch?v=dQw4w9WgXcQ",
language="en"
)
@@ -94,7 +94,7 @@ def test_run_transcript_not_found(mock_get_transcript, mock_fetch_metadata, mock
mock_fetch_metadata.return_value = SAMPLE_VIDEO_INFO
mock_get_transcript.side_effect = Exception("No transcript found")
- input_data = YouTubeTranscriptToolSchema(video_url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
+ input_data = YouTubeTranscriptToolInputSchema(video_url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
with pytest.raises(Exception, match="No transcript found"):
youtube_transcript_tool.run(input_data)
@@ -114,7 +114,7 @@ def test_run_no_transcript_found(mock_extract_video_id, mock_fetch_metadata, moc
mock_fetch_metadata.return_value = SAMPLE_VIDEO_INFO
mock_get_transcript.side_effect = NoTranscriptFound("dQw4w9WgXcQ", "en", "Transcript not found")
- input_data = YouTubeTranscriptToolSchema(video_url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
+ input_data = YouTubeTranscriptToolInputSchema(video_url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
with pytest.raises(Exception, match="Failed to fetch transcript for video 'dQw4w9WgXcQ': "):
youtube_transcript_tool.run(input_data)
@@ -127,7 +127,7 @@ def test_run_transcripts_disabled(mock_extract_video_id, mock_fetch_metadata, mo
mock_fetch_metadata.return_value = SAMPLE_VIDEO_INFO
mock_get_transcript.side_effect = TranscriptsDisabled("Transcripts are disabled for this video")
- input_data = YouTubeTranscriptToolSchema(video_url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
+ input_data = YouTubeTranscriptToolInputSchema(video_url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
with pytest.raises(Exception, match="Failed to fetch transcript for video 'dQw4w9WgXcQ': "):
youtube_transcript_tool.run(input_data)