Skip to content

Commit

Permalink
Adding a new code block
Browse files Browse the repository at this point in the history
  • Loading branch information
ajosh0504 committed Jun 15, 2024
1 parent 89f89c4 commit 3e6131a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions docs/50-agent-tools/5-create-agent-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ MongoDBAtlasVectorSearch.from_connection_string(
<summary>Answer</summary>
<div>
```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
```
</div>
</details>
Expand All @@ -71,7 +73,7 @@ vector_store.as_retriever(search_type="similarity", search_kwargs={"k": 5})
<div>
```python
retrieve = {
"context": retriever
"context": RunnableLambda(get_context)
| (lambda docs: "\n\n".join([d.page_content for d in docs])),
"question": RunnablePassthrough(),
}
Expand Down Expand Up @@ -125,4 +127,15 @@ get_paper_summary_from_arxiv.invoke("808.09236")
answer_questions_about_topics.invoke("What are partial cubes?")
```
</div>
</details>

**CODE_BLOCK_15**

<details>
<summary>Answer</summary>
<div>
```python
answer_questions_about_topics.invoke("What is Tree of Thought prompting?")
```
</div>
</details>

0 comments on commit 3e6131a

Please sign in to comment.