mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-08 22:15:08 +00:00
docs: Anthropic search_result nits (#31855)
This commit is contained in:
parent
ade642b7c5
commit
df06041eb2
@ -988,9 +988,10 @@
|
||||
" return [\n",
|
||||
" {\n",
|
||||
" \"type\": \"search_result\",\n",
|
||||
" \"title\": \"Leave policy\",\n",
|
||||
" \"source\": \"HR Leave Policy 2025\",\n",
|
||||
" \"citations\": { \"enabled\": True },\n",
|
||||
" # Customize fields as desired, using document metadata or otherwise\n",
|
||||
" \"title\": \"My Document Title\",\n",
|
||||
" \"source\": \"Source description or provenance\",\n",
|
||||
" \"citations\": {\"enabled\": True},\n",
|
||||
" \"content\": [{\"type\": \"text\", \"text\": doc.page_content}],\n",
|
||||
" }\n",
|
||||
" for doc in results\n",
|
||||
@ -1026,12 +1027,20 @@
|
||||
" \"To request vacation days, submit a leave request form through the \"\n",
|
||||
" \"HR portal. Approval will be sent by email.\"\n",
|
||||
" ),\n",
|
||||
" metadata={\"category\": \"HR Policy\"},\n",
|
||||
" metadata={\n",
|
||||
" \"category\": \"HR Policy\",\n",
|
||||
" \"doc_title\": \"Leave Policy\",\n",
|
||||
" \"provenance\": \"Leave Policy - page 1\",\n",
|
||||
" },\n",
|
||||
")\n",
|
||||
"document_2 = Document(\n",
|
||||
" id=\"2\",\n",
|
||||
" page_content=\"Managers will review vacation requests within 3 business days.\",\n",
|
||||
" metadata={\"category\": \"HR Policy\"},\n",
|
||||
" metadata={\n",
|
||||
" \"category\": \"HR Policy\",\n",
|
||||
" \"doc_title\": \"Leave Policy\",\n",
|
||||
" \"provenance\": \"Leave Policy - page 2\",\n",
|
||||
" },\n",
|
||||
")\n",
|
||||
"document_3 = Document(\n",
|
||||
" id=\"3\",\n",
|
||||
@ -1039,7 +1048,11 @@
|
||||
" \"Employees with over 6 months tenure are eligible for 20 paid vacation days \"\n",
|
||||
" \"per year.\"\n",
|
||||
" ),\n",
|
||||
" metadata={\"category\": \"Benefits Policy\"},\n",
|
||||
" metadata={\n",
|
||||
" \"category\": \"Benefits Policy\",\n",
|
||||
" \"doc_title\": \"Benefits Guide 2025\",\n",
|
||||
" \"provenance\": \"Benefits Policy - page 1\",\n",
|
||||
" },\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"documents = [document_1, document_2, document_3]\n",
|
||||
@ -1062,9 +1075,9 @@
|
||||
" return [\n",
|
||||
" {\n",
|
||||
" \"type\": \"search_result\",\n",
|
||||
" \"title\": \"Leave policy\",\n",
|
||||
" \"source\": \"HR Leave Policy 2025\",\n",
|
||||
" \"citations\": { \"enabled\": True },\n",
|
||||
" \"title\": doc.metadata[\"doc_title\"],\n",
|
||||
" \"source\": doc.metadata[\"provenance\"],\n",
|
||||
" \"citations\": {\"enabled\": True},\n",
|
||||
" \"content\": [{\"type\": \"text\", \"text\": doc.page_content}],\n",
|
||||
" }\n",
|
||||
" for doc in results\n",
|
||||
|
Loading…
Reference in New Issue
Block a user