Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test_on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ jobs:

# Run tests for Cohere
test-cohere:
if: false # Disable cohere tests until we get a production account
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -225,6 +226,7 @@ jobs:

# Run tests for Fireworks
test-fireworks:
if: false # Disable fireworks tests until we get a production account
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -375,6 +377,7 @@ jobs:

# Run tests for Perplexity
test-perplexity:
if: false # Disable perplexity tests until we get a production account
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
29 changes: 29 additions & 0 deletions cookbook/agent_concepts/knowledge/pdf_kb_async.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from agno.agent import Agent
from agno.knowledge.pdf import PDFKnowledgeBase, PDFReader
from agno.vectordb.qdrant import Qdrant
import asyncio

COLLECTION_NAME = "pdf-reader"

vector_db = Qdrant(collection=COLLECTION_NAME, url="http://localhost:6333")

# Create a knowledge base with the PDFs from the data/pdfs directory
knowledge_base = PDFKnowledgeBase(
path="data/pdf",
vector_db=vector_db,
reader=PDFReader(chunk=True),
)

# Create an agent with the knowledge base
agent = Agent(
knowledge=knowledge_base,
search_knowledge=True,
)

if __name__ == "__main__":
# Comment out after first run
asyncio.run(knowledge_base.aload(recreate=False))

# Create and use the agent
asyncio.run(agent.aprint_response(
"How to make Thai curry?", markdown=True))
29 changes: 29 additions & 0 deletions cookbook/agent_concepts/knowledge/pdf_url_kb_async.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from agno.agent import Agent
from agno.knowledge.pdf_url import PDFUrlKnowledgeBase, PDFUrlReader
from agno.vectordb.qdrant import Qdrant
import asyncio

COLLECTION_NAME = "pdf-url-reader"

vector_db = Qdrant(collection=COLLECTION_NAME, url="http://localhost:6333")

# Create a knowledge base with the PDFs from the data/pdfs directory
knowledge_base = PDFUrlKnowledgeBase(
urls=["https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"],
vector_db=vector_db,
reader=PDFUrlReader(chunk=True),
)

# Create an agent with the knowledge base
agent = Agent(
knowledge=knowledge_base,
search_knowledge=True,
)

if __name__ == "__main__":
# Comment out after first run
asyncio.run(knowledge_base.aload(recreate=False))

# Create and use the agent
asyncio.run(agent.aprint_response(
"How to make Thai curry?", markdown=True))
7 changes: 0 additions & 7 deletions libs/agno/agno/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,7 @@ def __init__(
self.add_history_to_messages = add_history_to_messages
self.num_history_responses = num_history_responses
self.num_history_runs = num_history_runs

if num_history_responses is not None:
warnings.warn(
"num_history_responses is deprecated and will be removed in a future version. "
"Use num_history_runs instead.",
DeprecationWarning,
stacklevel=2,
)
self.num_history_runs = num_history_responses

self.knowledge = knowledge
Expand Down
2 changes: 2 additions & 0 deletions libs/agno/agno/team/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -3775,6 +3775,8 @@ def get_members_system_message_content(self, indent: int = 0) -> str:
system_message_content += f"{indent * ' '} - Name: {member.name}\n"
if member.role is not None:
system_message_content += f"{indent * ' '} - Role: {member.role}\n"
if member.description is not None:
system_message_content += f"{indent * ' '} - Description: {member.description}\n"
if member.tools is not None:
system_message_content += f"{indent * ' '} - Available tools:\n"
tool_name_and_description = []
Expand Down
2 changes: 1 addition & 1 deletion libs/agno/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "agno"
version = "1.2.6"
version = "1.2.7"
description = "Agno: a lightweight framework for building multi-modal Agents"
requires-python = ">=3.7,<4"
readme = "README.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ async def test_arxiv_knowledge_base_async_integration(setup_vector_db):
# Check that we have at least the papers we requested
assert await setup_vector_db.async_get_count() >= 2

agent = Agent(knowledge=kb)
agent = Agent(knowledge=kb, search_knowledge=True, instructions=[
"You are a helpful assistant that can answer questions.",
"You can use the async_search_knowledge_base tool to search the knowledge base of journal articles for information.",
])
response = await agent.arun("What are the key capabilities of GPT-3?", markdown=True)

tool_calls = []
Expand All @@ -101,7 +104,7 @@ async def test_arxiv_knowledge_base_async_integration(setup_vector_db):
tool_calls.extend(msg.tool_calls)

function_calls = [call for call in tool_calls if call.get("type") == "function"]
assert any(call["function"]["name"] == "search_knowledge_base" for call in function_calls)
assert any(call["function"]["name"] == "async_search_knowledge_base" for call in function_calls)


def test_arxiv_knowledge_base_empty_query_integration(setup_vector_db):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def test_csv_url_knowledge_base():
assert doc_count < 100, f"Got {doc_count} documents, which seems too many"

# Query the agent
agent = Agent(knowledge=knowledge_base)
agent = Agent(knowledge=knowledge_base, search_knowledge=True, instructions=[
"You are a helpful assistant that can answer questions.",
"You can use the search_knowledge_base tool to search the knowledge base of CSVs for information.",
])
response = agent.run("Give me top rated movies", markdown=True)

# Check that we got relevant content
Expand Down Expand Up @@ -69,7 +72,10 @@ async def test_csv_url_knowledge_base_async():
assert doc_count < 100, f"Got {doc_count} documents, which seems too many"

# Query the agent
agent = Agent(knowledge=knowledge_base)
agent = Agent(knowledge=knowledge_base, search_knowledge=True, instructions=[
"You are a helpful assistant that can answer questions.",
"You can use the async_search_knowledge_base tool to search the knowledge base of CSVs for information.",
])
response = await agent.arun("Which employees have salaries above 50000?", markdown=True)

assert "employees" in response.content.lower()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def test_json_knowledge_base_async():
tool_calls.extend(msg.tool_calls)
for call in tool_calls:
if call.get("type", "") == "function":
assert call["function"]["name"] == "search_knowledge_base"
assert call["function"]["name"] == "async_search_knowledge_base"

assert any(ingredient in response.content.lower() for ingredient in ["coconut", "chicken", "galangal"])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def test_pdf_knowledge_base_async():
tool_calls.extend(msg.tool_calls)
for call in tool_calls:
if call.get("type", "") == "function":
assert call["function"]["name"] == "search_knowledge_base"
assert call["function"]["name"] == "async_search_knowledge_base"

assert any(ingredient in response.content.lower() for ingredient in ["coconut", "chicken", "galangal"])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async def test_pdf_url_knowledge_base_async():
tool_calls.extend(msg.tool_calls)
for call in tool_calls:
if call.get("type", "") == "function":
assert call["function"]["name"] == "search_knowledge_base"
assert call["function"]["name"] == "async_search_knowledge_base"

assert any(ingredient in response.content.lower() for ingredient in ["coconut", "chicken", "galangal"])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async def test_text_knowledge_base_async_directory(setup_vector_db):
tool_calls.extend(msg.tool_calls)

function_calls = [call for call in tool_calls if call.get("type") == "function"]
assert any(call["function"]["name"] == "search_knowledge_base" for call in function_calls)
assert any(call["function"]["name"] == "async_search_knowledge_base" for call in function_calls)


@pytest.mark.asyncio
Expand All @@ -114,4 +114,4 @@ async def test_text_knowledge_base_async_single_file(setup_vector_db):
tool_calls.extend(msg.tool_calls)

function_calls = [call for call in tool_calls if call.get("type") == "function"]
assert any(call["function"]["name"] == "search_knowledge_base" for call in function_calls)
assert any(call["function"]["name"] == "async_search_knowledge_base" for call in function_calls)
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def setup_vector_db():
vector_db.drop()


@pytest.mark.skip(reason="They block requests from CI")
def test_youtube_knowledge_base_directory(setup_vector_db):
"""Test loading multiple YouTube videos into the knowledge base."""
urls = ["https://www.youtube.com/watch?v=NwZ26lxl8wU", "https://www.youtube.com/watch?v=lrg8ZWI7MCg"]
Expand All @@ -39,6 +40,7 @@ def test_youtube_knowledge_base_directory(setup_vector_db):
assert any(call["function"]["name"] == "search_knowledge_base" for call in function_calls)


@pytest.mark.skip(reason="They block requests from CI")
def test_youtube_knowledge_base_single_url(setup_vector_db):
"""Test loading a single YouTube video into the knowledge base."""
kb = YouTubeKnowledgeBase(
Expand Down Expand Up @@ -69,6 +71,7 @@ def test_youtube_knowledge_base_single_url(setup_vector_db):
assert any(call["function"]["name"] == "search_knowledge_base" for call in function_calls)


@pytest.mark.skip(reason="They block requests from CI")
@pytest.mark.asyncio
async def test_youtube_knowledge_base_async_directory(setup_vector_db):
"""Test asynchronously loading multiple YouTube videos."""
Expand Down Expand Up @@ -100,6 +103,7 @@ async def test_youtube_knowledge_base_async_directory(setup_vector_db):
]


@pytest.mark.skip(reason="They block requests from CI")
@pytest.mark.asyncio
async def test_youtube_knowledge_base_async_single_url(setup_vector_db):
"""Test asynchronously loading a single YouTube video."""
Expand Down
4 changes: 0 additions & 4 deletions libs/agno/tests/integration/models/google/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,6 @@ def test_history():
assert len(agent.run_response.messages) == 2
agent.run("Hello 2")
assert len(agent.run_response.messages) == 4
agent.run("Hello 3")
assert len(agent.run_response.messages) == 6
agent.run("Hello 4")
assert len(agent.run_response.messages) == 8


@pytest.mark.skip(reason="Need to fix this by getting credentials in Github actions")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def test_parallel_tool_calls():
tool_calls.extend(msg.tool_calls)
assert len([call for call in tool_calls if call.get("type", "") == "function"]) == 2 # Total of 2 tool calls made
assert response.content is not None
assert "TSLA" in response.content and "AAPL" in response.content


def test_multiple_tool_calls():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CompanyAnalysis(BaseModel):
company_info_agent = Agent(
name="Company Info Searcher",
model=OpenAIChat("gpt-4o"),
role="Searches for information about companies and recent news.",
role="Searches for general information about companies and recent news.",
response_model=CompanyAnalysis,
tools=[
YFinanceTools(
Expand Down
Loading