Skip to content

Commit fd6addf

Browse files
committed
address review comments
1 parent f4a4191 commit fd6addf

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

notebooks/agent_powered_retrieval.ipynb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@
657657
},
658658
{
659659
"cell_type": "code",
660-
"execution_count": 21,
660+
"execution_count": null,
661661
"metadata": {
662662
"id": "ptPCVVRKghQY"
663663
},
@@ -668,7 +668,7 @@
668668
"def retrieval_function(\n",
669669
" query: Optional[str] = None,\n",
670670
" metadata_filters: Optional[Dict[str, Any]] = None,\n",
671-
" top_k: Optional[int] = 5\n",
671+
" top_k: int = 5\n",
672672
") -> List[Document]:\n",
673673
"\n",
674674
" retrieved_documents = []\n",
@@ -685,8 +685,7 @@
685685
" # If there's only `metadata_filters`\n",
686686
" else:\n",
687687
" retrieved_documents = filter_retriever.run(filters=metadata_filters)\n",
688-
" if len(retrieved_documents.get(\"documents\")) > top_k:\n",
689-
" retrieved_documents[\"documents\"] = retrieved_documents[\"documents\"][:top_k]\n",
688+
" retrieved_documents[\"documents\"] = retrieved_documents[\"documents\"][:top_k]\n",
690689
"\n",
691690
" return retrieved_documents"
692691
]
@@ -697,7 +696,9 @@
697696
"id": "bcCbVu9PDWTG"
698697
},
699698
"source": [
700-
"Define the JSON schema for tool parameters, including `query`, `top_k`, and `metadata_filters`, to validate and structure tool calls."
699+
"Define the JSON schema for your tool parameters, such as `query`, `top_k`, and `metadata_filters`, to ensure tool calls are properly structured and validated.\n",
700+
"\n",
701+
"> In most cases, you don’t need to define `parameters` manually. When you use the [@tool decorator](https://docs.haystack.deepset.ai/docs/tool#tool-decorator) or [create_tool_from_function](https://docs.haystack.deepset.ai/docs/tool#create_tool_from_function), Haystack automatically infers the tool’s name, description, and parameters from the function and generates a matching JSON schema for you."
701702
]
702703
},
703704
{

0 commit comments

Comments
 (0)