diff --git a/docs/50-agent-tools/5-create-agent-tools.mdx b/docs/50-agent-tools/5-create-agent-tools.mdx index b078222..59d153d 100644 --- a/docs/50-agent-tools/5-create-agent-tools.mdx +++ b/docs/50-agent-tools/5-create-agent-tools.mdx @@ -59,7 +59,9 @@ MongoDBAtlasVectorSearch.from_connection_string( Answer
```python -vector_store.as_retriever(search_type="similarity", search_kwargs={"k": 5}) +context = vector_store.similarity_search_with_score(query=query) +context = [doc for doc, score in context if score > 0.8] +return context ```
@@ -71,7 +73,7 @@ vector_store.as_retriever(search_type="similarity", search_kwargs={"k": 5})
```python retrieve = { - "context": retriever + "context": RunnableLambda(get_context) | (lambda docs: "\n\n".join([d.page_content for d in docs])), "question": RunnablePassthrough(), } @@ -125,4 +127,15 @@ get_paper_summary_from_arxiv.invoke("808.09236") answer_questions_about_topics.invoke("What are partial cubes?") ```
+ + +**CODE_BLOCK_15** + +
+Answer +
+```python +answer_questions_about_topics.invoke("What is Tree of Thought prompting?") +``` +
\ No newline at end of file