import asynciofrom agno.agent import Agentfrom agno.knowledge.knowledge import Knowledgefrom agno.vectordb.search import SearchTypefrom agno.vectordb.weaviate import Distance, VectorIndex, Weaviatevector_db = Weaviate( collection="recipes_async", search_type=SearchType.hybrid, vector_index=VectorIndex.HNSW, distance=Distance.COSINE, local=True, # Set to False if using Weaviate Cloud and True if using local instance)# Create knowledge baseknowledge = Knowledge( vector_db=vector_db,)agent = Agent( knowledge=knowledge, search_knowledge=True,)if __name__ == "__main__": # Comment out after first run asyncio.run( knowledge.ainsert( name="Recipes", url="https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf", ) ) # Create and use the agent asyncio.run(agent.aprint_response("How to make Tom Kha Gai", markdown=True))
# 1. Create account at https://console.weaviate.cloud/# 2. Create a cluster and copy the "REST endpoint" and "Admin" API Key# 3. Set environment variables:export WCD_URL="your-cluster-url"export WCD_API_KEY="your-api-key"# 4. Set local=False in the code