1from kern.agent import Agent
2from kern.knowledge.knowledge import Knowledge
3from kern.vectordb.mongodb import MongoVectorDb
4
5mdb_connection_string = "mongodb://localhost:27017"
6knowledge = Knowledge(
7 vector_db=MongoVectorDb(
8 collection_name="recipes",
9 db_url=mdb_connection_string,
10 search_index_name="recipes",
11 ),
12)
13
14knowledge.insert(
15 name="Recipes",
16 url="https://kern-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf",
17 metadata={"doc_type": "recipe_book"},
18)
19
20# Create and use the agent
21agent = Agent(knowledge=knowledge)
22agent.print_response("How to make Thai curry?", markdown=True)