Skip to content

Upgrade LLM deps, add Anthropic/Google providers, fix tiktoken crash … - #516

Open
cybr-wisp wants to merge 1 commit into
Aggregate-Intellect:mainfrom
cybr-wisp:fix/upgrade-llm-dependencies
Open

Upgrade LLM deps, add Anthropic/Google providers, fix tiktoken crash …#516
cybr-wisp wants to merge 1 commit into
Aggregate-Intellect:mainfrom
cybr-wisp:fix/upgrade-llm-dependencies

Conversation

@cybr-wisp

Copy link
Copy Markdown

Description:

Closes #511

The LLM dependencies were outdated -> langchain-openai was pinned to <0.3, langchain-anthropic and langchain-google-genai were missing entirely, and tiktoken crashed on non-OpenAI model names at utils.py:221.

What changed:

Bumped langchain-core (0.3.x → 1.4+), langchain-openai (0.2.x → 1.0+), langchain-community (0.3.x → 0.4+), tiktoken (0.6+ → 0.8+), langchain-chroma (0.2.x → 1.0+)
Added langchain-anthropic and langchain-google-genai as optional extras, installable via pip install sherpa-ai[anthropic] or pip install sherpa-ai[google]
Fixed tiktoken.encoding_for_model() crash by adding a try/except KeyError with cl100k_base fallback for non-OpenAI models
Created SherpaChatAnthropic and SherpaChatGoogle model wrappers following the existing SherpaChatOpenAI pattern
Fixed deprecated ChatOpenAI import in test_utils/llms.py (moved from langchain_community to langchain_openai)
Relaxed spacy version constraint for Python 3.13 compatibility
Regenerated poetry.lock

After pulling these changes, run:

poetry lock && poetry install --with test -E anthropic -E google

Note on test results: 242/306 tests pass. The 61 failures fall into three categories, none caused by this PR: Windows file-locking errors (PermissionError on .db teardown), missing optional tokenizers package, and pre-existing get_relevant_documents deprecation in upstream langchain.

Type of change:

New feature (non-breaking change that adds functionality)

Related issues:
Closes #511, related to #510

@20001LastOrder

Copy link
Copy Markdown
Collaborator

Thank you for creating the PR. I think some of the test failures are due to langchain upgrades. langchain upgrades are already handled in #509; please wait for it to be merged and rebase this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade LLM dependencies and add Anthropic and Google providers

2 participants