-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Adds native Live Search support to xAI provider #9537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds native Live Search support to xAI provider #9537
Conversation
Adds support for xAI's native `live_search` tool, enabling models to search the web for real-time information. This includes the ability to bind the `live_search` tool, configure search parameters, and override search parameters per request. It also allows combining `live_search` with custom tools. The changes introduce the `XAILiveSearchTool`, `XAIBuiltInTool`, and `XAISearchParameters` types to provide better type safety and control over the search functionality.
🦋 Changeset detectedLatest commit: a5dc397 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…earch' into implement-native-live-search
7bdcd86 to
bbe6a7b
Compare
Introduces native Live Search capabilities, allowing users to configure various search sources such as web, news, X, and RSS feeds. Replaces domain-based filtering with a more flexible source-based approach, providing tailored results and aligning with xAI's API updates.
Moves the XAILiveSearchTool interface definition to the live_search tool file. This improves code organization and maintainability by grouping related tool definitions together.
Adds an example demonstrating how to use the built-in `xaiLiveSearch` tool with optional parameters. This enhances clarity and provides a practical guide for users integrating the `live_search` functionality.
Refactors the xAI provider to export the tools via a dedicated module. This change improves code organization and makes it easier to import and use the available tools. The `xaiLiveSearch` tool is now accessed through `tools.xaiLiveSearch` instead of direct import.
Converts snake_case `xaiLiveSearch` parameters to camelCase for easier use and configuration. Simplifies tool configuration by accepting user-friendly options, and automatically translates them into the format expected by the xAI API.
Improves the xAI live search tool by adopting the `ServerTool` interface. This change aligns with the xAI API's server-side execution model and simplifies the tool definition. It also addresses upcoming deprecation of the Live Search API. Removes the previous `DynamicStructuredTool` implementation and adds support for specifying web, news, X, and RSS sources.
Refactors the XAI Live Search tool to directly define properties, removing the intermediate `searchParams` object. This simplifies the tool's structure and improves readability. Also, the tool definition is updated to reflect the change from a ServerTool to a regular tool.
Updates the live search tool type to a deprecated version. This prepares the codebase for a future transition, ensuring a smoother upgrade path. The old tool type is replaced with "live_search_deprecated_20251215".
Refactors the README to use the `tools.xaiLiveSearch` constructor for creating the live search tool, providing a more accurate representation of its usage. Corrects casing of options from camel case to camel case.
Updates the XAI Live Search tool to use default parameters, simplifying its invocation and configuration.
Clarifies that the xAI Live Search tool options in TypeScript use camelCase field names, which are then mapped to snake_case field names in the underlying JSON API. This ensures users understand the expected casing when using the tool options in TypeScript.
|
Maybe good to test it with a real connection? |
Updates the XAI provider to use constants for the live search tool type instead of hardcoding the string. This improves consistency and maintainability. Also introduces tests for live search utilities.
|
And I think we should move towards tool implementation in the next steps https://docs.x.ai/docs/guides/tools/overview |
christian-bromann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
What do you mean by that?
Yes! Let's add more xAI tools 🙌 |
This change updates the versioning of the '@langchain/xai' package from patch to minor and adds native Live Search support.
Do we have any integration set up so that we can test how it works with a live connection to xAI? |
|
@pawel-twardziak I've added a key to the GitHub actions environment. |
|
hi @christian-bromann I'll kick off the next work today - more tools and integration tests |
Adds support for xAI's native
live_searchtool, enabling models to search the web for real-time information. This includes the ability to bind thelive_searchtool, configure search parameters, and override search parameters per request. It also allows combininglive_searchwith custom tools.The changes introduce the
XAILiveSearchTool,XAIBuiltInTool, andXAISearchParameterstypes to provide better type safety and control over the search functionality.Fixes #9465