feat(llm): extract BaseAnthropicLLM, add base_url, export extension points#563
Closed
matteomedioli wants to merge 8 commits into
Closed
feat(llm): extract BaseAnthropicLLM, add base_url, export extension points#563matteomedioli wants to merge 8 commits into
matteomedioli wants to merge 8 commits into
Conversation
…d schema logic Moves the message-building, schema-conversion, and response-parsing logic that lived directly on AnthropicLLM into a new BaseAnthropicLLM base class, mirroring the BaseOpenAILLM/OpenAILLM split. AnthropicLLM becomes a subclass responsible only for constructing the SDK clients, paving the way for alternate Anthropic-compatible client implementations.
Allows routing Anthropic requests to a custom Anthropic-compatible endpoint by passing base_url through to both the sync and async SDK clients, alongside the existing http_client routing logic.
Add both base classes to neo4j_graphrag.llm's imports and __all__ so they are documented, supported entry points for subclassing custom LLM clients, with a test verifying the exports.
Covers the AnthropicLLM/BaseAnthropicLLM split: confirms AnthropicLLM subclasses BaseAnthropicLLM, exercises invoke/schema logic through a minimal BaseAnthropicLLM subclass, and verifies the new base_url parameter reaches both the sync and async Anthropic SDK clients (alone and combined with an explicit http_client).
…sses Adds a Sphinx docs page explaining what BaseAnthropicLLM and BaseOpenAILLM are for and how the http_client/base_url injection contract works, with a worked example of subclassing BaseAnthropicLLM to reach a custom endpoint. Links the page and adds API reference entries for both base classes.
Adds a changelog entry covering the new BaseAnthropicLLM base class, the base_url parameter on AnthropicLLM, the BaseAnthropicLLM/BaseOpenAILLM exports, and the new LLM extensibility docs page.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
15 tasks
Contributor
Author
|
Accidentally closed by a branch rename (no content lost, no review activity on this PR). Reopened as #566. |
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.
No description provided.