8000 feat: add azure cosmosdb mongodb (vcore) by kausmeows · Pull Request #3160 · agno-agi/agno · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add azure cosmosdb mongodb (vcore) #3160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import urllib.parse

from agno.agent import Agent
from agno.knowledge.pdf_url import PDFUrlKnowledgeBase
from agno.vectordb.mongodb import MongoDb

"""
Example connection strings:
"mongodb+srv://<username>:<encoded_password>@cluster0.mongocluster.cosmos.azure.com/?tls=true&authMechanism=SCRAM-SHA-256&retrywrites=false&maxIdleTimeMS=120000"
"""

mdb_connection_string = f"mongodb+srv://<username>:<encoded_password>@cluster0.mongocluster.cosmos.azure.com/?tls=true&authMechanism=SCRAM-SHA-256&retrywrites=false&maxIdleTimeMS=120000"

knowledge_base = PDFUrlKnowledgeBase(
urls=["https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"],
vector_db=MongoDb(
collection_name="recipes",
db_url=mdb_connection_string,
search_index_name="recipes",
cosmos_compatibility=True,
),
)

# Comment out after first run
knowledge_base.load(recreate=True)

# Create and use the agent
agent = Agent(knowledge=knowledge_base, show_tool_calls=True)

agent.print_response("How to make Thai curry?", markdown=True)
2 changes: 1 addition & 1 deletion cookbook/observability/langtrace_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
debug_mode=True,
)

agent.print_response("What is the current price of Tesla?")
agent.print_response("What is the current price of Tesla?")
2 changes: 1 addition & 1 deletion libs/agno/agno/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ def _run(
event=RunEvent.tool_call_started,
session_id=session_id,
run_response=run_response,
)
)

# If the model response is a tool_call_completed, update the existing tool call in the run_response
elif model_response_chunk.event == ModelResponseEvent.tool_call_completed.value:
Expand Down
1 change: 1 addition & 0 deletions libs/agno/agno/playground/async_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ async def chat_response_streamer(
yield run_response_chunk.to_json()
except Exception as e:
import traceback

traceback.print_exc(limit=3)
error_response = RunResponse(
content=str(e),
Expand Down
4 changes: 1 addition & 3 deletions libs/agno/agno/vectordb/mongodb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from agno.vectordb.mongodb.mongodb import MongoDb

__all__ = [
"MongoDb",
]
__all__ = ["MongoDb"]
Loading
0