Integrate Anthropic Web Search Tool for Supported Models #7311
Closed
Dual-0
started this conversation in
Feature Requests & Suggestions
Replies: 1 comment
-
Closed by #8281 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Anthropic's Web Search tool enhances the capability of their models by providing access to current information, overcoming knowledge cutoffs. Implementing this feature in LibreChat would significantly improve the utility of supported Anthropic models within the platform, offering users more accurate, timely, and verifiable responses, especially for topics requiring recent information.
Technical Details (Based on Anthropic API Documentation):
API Endpoint: The web search functionality is provided via the standard
messages
API endpoint by including atools
parameter in the request payload.Tool Definition: The tool is defined as follows:
LibreChat would need to allow users to enable this tool and potentially configure the optional parameters (
max_uses
,allowed_domains
,blocked_domains
,user_location
).API Flow:
1. User sends a message.
2. LibreChat constructs the API request including the
tools
array with the web search definition if enabled for the selected model.3. The Anthropic API decides if a search is needed based on the prompt.
4. If a search is performed, the API returns
server_tool_use
andweb_search_tool_result
content blocks in the response.5. LibreChat needs to parse these blocks to display the search activity (e.g., "Searching...") and the search results.
6. Anthropics final response will include
text
blocks withcitations
referencing the search results. LibreChat needs to parse and display these citations correctly.7. Handle multi-turn conversations: Encrypted content/indices (
encrypted_content
,encrypted_index
) from search results and citations must be passed back to the API in subsequent turns within theweb_search_tool_result
blocks to maintain context and citations.Error Handling: LibreChat should handle potential
web_search_tool_result_error
responses and inform the user (e.g.,max_uses_exceeded
,too_many_requests
,unavailable
).Streaming: If streaming is used, LibreChat must process streamed
content_block_start
andcontent_block_delta
events forserver_tool_use
andweb_search_tool_result
blocks, including the pause while the search executes.Usage/Pricing: Note that Anthropic charges separately for web searches ($10 per 1,000 searches) in addition to token usage. This might be relevant information for users.
Implementation Considerations:
max_uses
, location).server_tool_use
,web_search_tool_result
, andcitations
content blocks in the chat interface.This feature would bring parity with the native Anthropic web search experience for users of supported models within LibreChat.
Beta Was this translation helpful? Give feedback.
All reactions