Repository navigation
Fix Desearch tools for desearch-py 1.1+ and pydantic v2 - #1
Merged
Merged
Conversation
Fresh installs pulled desearch-py 1.2.1, which no longer provides basic_web_search or basic_twitter_search. Call web_search, x_search, and the current X endpoints, and require desearch-py>=1.1.0,<2.0.0. The AI-search validator now reads the pydantic v2 model instead of calling dict.get, which made every DesearchTool invoke fail. Co-authored-by: Giga <cosmic@desearch.ai>
Chkhikvadze
marked this pull request as ready for review
October 1, 2026 19:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
langchain-desearch 1.0.6 fails on a fresh install because it is built against desearch-py 1.0.x and a pydantic v1-style validator. This release, 1.0.7, targets the current 1.x client (latest published release is 1.2.1) without renaming the public tools.
BasicWebSearchToolcallsDesearch.web_searchinstead of the removedbasic_web_search.numstill limits how many hits are returned, and the existing 1-basedstartindex is converted to the SDK's zero-based skip offset.BasicTwitterSearchToolcallsDesearch.x_searchinstead of the removedbasic_twitter_search, and forwards the current X search filters (user, dates, language, verification, media, and engagement thresholds).DesearchToolcallsai_searchwith the current parameters.modelandstreamingare still accepted so existing callers keep working; desearch-py 1.1+ does not send either of them (streamingis always false in the SDK).x_posts_by_urls,x_post_by_id,x_user_posts,x_user_replies,x_post_replies, andx_post_retweeters. Class names and tool names are unchanged.FetchRetweetsByPostToolfollows the current retweeters endpoint (idplus optionalcursor).DesearchToolInput.check_tool_non_emptyis a pydantic v2mode="after"validator, so it readsself.toolon the model. The previousvalues.get("tool")raisedAttributeErroron everyDesearchTool.invoke.Dependency
desearch-pyis now>=1.1.0,<2.0.0in bothpyproject.tomlandsetup.py. 1.1.0 is the first release withweb_search/x_search; the upper bound keeps a future 2.0 from being installed automatically. Python requirement is>=3.9, matching desearch-py. Package version is 1.0.7. This change does not publish to PyPI and does not create a tag or GitHub release.Tests
Mocked unit tests cover the validator, the method migration, pydantic model serialization, a missing API key, SDK errors, and sync calls made from inside a running event loop.
.github/workflows/test.ymlruns those tests on pull requests and on pushes tomain.A live smoke test was not run:
DESEARCH_API_KEYis not set in this environment. Integration tests still skip unless that variable is present.