OLS-3755: Add Anthropic Provider - #3036
Conversation
Signed-off-by: Haoyu Sun <hasun@redhat.com>
Signed-off-by: Haoyu Sun <hasun@redhat.com>
|
@raptorsun: This pull request references OLS-3755 which is a valid jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/hold |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
📝 WalkthroughWalkthroughThe change adds direct Anthropic provider support. It introduces configuration, API-key loading, HTTP clients, reasoning parameters, provider registration, dependency metadata, documentation, and unit tests. ChangesAnthropic provider support
Build metadata updates
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ProviderConfig
participant SecretStore
participant Anthropic
participant ChatAnthropic
ProviderConfig->>SecretStore: Read Anthropic API key
ProviderConfig->>Anthropic: Create AnthropicConfig
Anthropic->>Anthropic: Build endpoint, clients, and model parameters
Anthropic->>ChatAnthropic: Load configured chat model
ChatAnthropic-->>Anthropic: Return BaseChatModel
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
tests/unit/llms/providers/test_anthropic.py (1)
48-69: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd coverage for
anthropic_configwithouturl.None of the fixtures set
anthropic_configwith onlycredentials_path(omittingurl). This is the exact configuration shape that triggers thestr(anthropic_config.url)bug flagged inols/src/llms/providers/anthropic.py(lines 26-33). Add a fixture/test for this case once that fix lands, to prevent regression.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unit/llms/providers/test_anthropic.py` around lines 48 - 69, Add a fixture or test alongside provider_config_with_specific_parameters that defines anthropic_config with credentials_path only and omits url, then exercise Anthropic provider configuration to verify it initializes successfully without attempting to stringify a missing anthropic_config.url value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.ai/spec/what/llm-providers.md:
- Line 209: Align Rule 17 with the certificate-store provider list: update the
rule and the startup certificate-store description together so Anthropic and
Bedrock are consistently included only if they use certificates_store; otherwise
remove them from the list. Ensure both documentation references define the same
provider scope.
In `@ols/src/llms/providers/anthropic.py`:
- Around line 26-33: Update the provider-specific URL assignment in the
Anthropic provider initialization to fall back to the existing self.url when
anthropic_config.url is unset, matching the earlier provider_config.url
behavior; avoid converting None into the literal string "None" while preserving
the configured Anthropic URL when present.
- Around line 35-44: Update the `default_parameters` construction used by
`load()` so `ChatAnthropic` receives only supported constructor arguments:
replace `http_client` and `http_async_client` with pre-built clients via
`anthropic_client` and `anthropic_client_async`, or remove them after validating
the installed `langchain-anthropic` signature. Preserve the existing client
configuration and all other parameters.
---
Nitpick comments:
In `@tests/unit/llms/providers/test_anthropic.py`:
- Around line 48-69: Add a fixture or test alongside
provider_config_with_specific_parameters that defines anthropic_config with
credentials_path only and omits url, then exercise Anthropic provider
configuration to verify it initializes successfully without attempting to
stringify a missing anthropic_config.url value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 77104973-e943-4648-b8f7-6e1496fcb540
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock,!uv.lock
📒 Files selected for processing (15)
.ai/spec/README.md.ai/spec/how/llm-providers.md.ai/spec/what/config.md.ai/spec/what/llm-providers.md.ai/spec/what/system-overview.md.konflux/requirements-build.txt.konflux/requirements.hashes.source.txtdocs/ai/providers.mdols/app/models/config.pyols/constants.pyols/src/llms/providers/anthropic.pyols/src/llms/providers/provider.pypyproject.tomltests/unit/llms/providers/test_anthropic.pytests/unit/llms/providers/test_providers.py
| 6. Credentials are never logged. Parameters containing keys, tokens, or HTTP client objects must be redacted from log output. | ||
|
|
||
| 7. The certificate store path is computed at startup and points to a PEM bundle file in the certificate directory. It is only used by OpenAI-family providers (OpenAI, Azure OpenAI, RHOAI vLLM, RHELAI vLLM, Bedrock). | ||
| 7. The certificate store path is computed at startup and points to a PEM bundle file in the certificate directory. It is only used by OpenAI-family providers and direct Anthropic (OpenAI, Azure OpenAI, RHOAI vLLM, RHELAI vLLM, Anthropic, Bedrock). |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
Align the certificate-store contract.
Line 209 includes Anthropic and Bedrock, but Rule 17 at Line 58 omits both providers. Update Rule 17 and this list together, or remove providers that do not use certificates_store. Inconsistent TLS documentation can cause incorrect provider configuration.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.ai/spec/what/llm-providers.md at line 209, Align Rule 17 with the
certificate-store provider list: update the rule and the startup
certificate-store description together so Anthropic and Bedrock are consistently
included only if they use certificates_store; otherwise remove them from the
list. Ensure both documentation references define the same provider scope.
| self.url = str(self.provider_config.url or self.url) | ||
| self.credentials = self.provider_config.credentials | ||
| # provider-specific configuration has precedence over regular configuration | ||
| if self.provider_config.anthropic_config is not None: | ||
| anthropic_config = self.provider_config.anthropic_config | ||
| self.url = str(anthropic_config.url) | ||
| if anthropic_config.api_key is not None: | ||
| self.credentials = anthropic_config.api_key |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Fix missing None fallback for anthropic_config.url.
AnthropicConfig only requires credentials_path; url is optional. If anthropic_config is set but url is omitted, anthropic_config.url is None, and str(anthropic_config.url) produces the literal string "None". Line 26 correctly falls back with or self.url when the general provider_config.url is unset. Apply the same fallback here.
🐛 Proposed fix
if self.provider_config.anthropic_config is not None:
anthropic_config = self.provider_config.anthropic_config
- self.url = str(anthropic_config.url)
+ self.url = str(anthropic_config.url or self.url)
if anthropic_config.api_key is not None:
self.credentials = anthropic_config.api_key📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| self.url = str(self.provider_config.url or self.url) | |
| self.credentials = self.provider_config.credentials | |
| # provider-specific configuration has precedence over regular configuration | |
| if self.provider_config.anthropic_config is not None: | |
| anthropic_config = self.provider_config.anthropic_config | |
| self.url = str(anthropic_config.url) | |
| if anthropic_config.api_key is not None: | |
| self.credentials = anthropic_config.api_key | |
| if self.provider_config.anthropic_config is not None: | |
| anthropic_config = self.provider_config.anthropic_config | |
| self.url = str(anthropic_config.url or self.url) | |
| if anthropic_config.api_key is not None: | |
| self.credentials = anthropic_config.api_key |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@ols/src/llms/providers/anthropic.py` around lines 26 - 33, Update the
provider-specific URL assignment in the Anthropic provider initialization to
fall back to the existing self.url when anthropic_config.url is unset, matching
the earlier provider_config.url behavior; avoid converting None into the literal
string "None" while preserving the configured Anthropic URL when present.
| default_parameters: dict[str, Any] = { | ||
| "model": self.model, | ||
| "anthropic_api_key": self.credentials, | ||
| "base_url": self.url, | ||
| "max_tokens": constants.DEFAULT_MAX_TOKENS_FOR_RESPONSE, | ||
| "temperature": 0.01, | ||
| "top_p": 0.95, | ||
| "http_client": self._construct_httpx_client(True, False), | ||
| "http_async_client": self._construct_httpx_client(True, True), | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🌐 Web query:
Does langchain-anthropic ChatAnthropic 0.3.x support http_client or http_async_client constructor parameters, or is custom httpx client injection unsupported?
💡 Result:
In langchain-anthropic 0.3.x, ChatAnthropic does not natively support http_client or http_async_client as direct constructor parameters [1][2]. Providing these parameters directly to the ChatAnthropic constructor will raise a TypeError (unexpected keyword argument) [1][2]. While there has been ongoing development to add these fields to match other integrations (such as ChatOpenAI) [3][4], versions within the 0.3.x range typically manage the httpx client internally, creating it automatically using default settings [3][2][5]. To inject a custom httpx client, the standard workaround in 0.3.x is to initialize the underlying Anthropic SDK client yourself and inject it into ChatAnthropic using the anthropic_client (or anthropic_client_async) constructor parameter [2]: import httpx from anthropic import Anthropic from langchain_anthropic import ChatAnthropic # 1. Create your custom client custom_http = httpx.Client(proxy="http://proxy.corp:8080",...) anth_client = Anthropic(http_client=custom_http,...) # 2. Inject it into ChatAnthropic llm = ChatAnthropic( model="claude-3-5-sonnet-20240620", anthropic_client=anth_client,) If you require fine-tuned control over the default httpx client (e.g., custom timeouts or proxy settings) without building the entire client manually, newer updates have introduced a client_args parameter in some branches to pass arguments directly to the internally created httpx client [6]. Always verify your specific version, as the integration logic is subject to frequent updates [2].
Citations:
- 1: Setting a custom
http_clientfails with unexpected keyword argument when usingChatAnthropiclangchain-ai/langchain#30146 - 2: https://itsourcecode.com/typeerror/langchain-chatanthropic-http-client-keyword/
- 3: feat(anthropic): add http_client and http_async_client fields to ChatAnthropic (parity with ChatOpenAI) langchain-ai/langchain#36056
- 4: feat(anthropic): support custom httpx client for mTLS and certificate-based authentication langchain-ai/langchain#35843
- 5: https://github.com/langchain-ai/langchain/blob/50febb79/libs/partners/anthropic/langchain_anthropic/chat_models.py
- 6: feat(anthropic): Add
client_argsto pass args directly to the created httpx client addressing #30146 langchain-ai/langchain#34808
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== files =="
git ls-files | rg '(^|/)anthropic\.py$|pyproject\.toml|poetry\.lock|requirements.*|uv\.lock|pdm\.lock|constraints|requirements\.txt' || true
echo "== target slice =="
if [ -f ols/src/llms/providers/anthropic.py ]; then
nl -ba ols/src/llms/providers/anthropic.py | sed -n '1,120p'
fi
echo "== dependency mentions =="
rg -n 'langchain-anthropic|langchain_anthropic|langchain' -S pyproject.toml poetry.lock uv.lock pdm.lock requirements*.txt constraints* 2>/dev/null || true
echo "== ChatAnthropic usages/tests =="
rg -n 'ChatAnthropic|anthropic_client|anthropic_client_async|http_client|http_async_client' -S . --glob '!*.lock' --glob '!**/.venv/**' --glob '!**/dist/**' --glob '!**/build/**' || trueRepository: openshift/lightspeed-service
Length of output: 713
🌐 Web query:
langchain-anthropic ChatAnthropic constructor anthropic_client anthropic_client_async source
💡 Result:
In the langchain-anthropic package, ChatAnthropic manages Anthropic API clients internally through cached properties rather than exposing them as constructor arguments. The ChatAnthropic class utilizes the following mechanisms for client management: 1. Internal Client Access: The synchronous anthropic.Client and asynchronous anthropic.AsyncClient instances are accessed via private cached properties named _client and _async_client, respectively [1][2][3]. 2. Configuration and Initialization: These clients are constructed on-demand based on configuration parameters provided to the ChatAnthropic constructor, such as base_url, timeout, and anthropic_proxy [1][2]. These parameters are stored in an internal _client_params dictionary, which is used to initialize the underlying Anthropic SDK clients during the first property access [1][4]. 3. Implementation Details: - The sync client is returned by the @cached_property def _client(self) -> anthropic.Client method [1][4]. - The async client is returned by the @cached_property def _async_client(self) -> anthropic.AsyncClient method [1][4]. Because these are implemented as cached properties, they are intended for internal use by the ChatAnthropic integration logic rather than for external configuration via the constructor [1][3]. Users should configure the client's behavior by passing relevant parameters (e.g., timeout, base_url, anthropic_proxy) directly to the ChatAnthropic constructor, which the class then propagates to the underlying SDK clients [1][5][4].
Citations:
- 1: https://github.com/langchain-ai/langchain/blob/b3dff4a04ce19947a2f41217fdce85ce92510578/libs/partners/anthropic/langchain_anthropic/chat_models.py
- 2: https://github.com/langchain-ai/langchain/blob/85a5a04210452aec2eb3a06a02961c8fefd5c8b6/libs/partners/anthropic/langchain_anthropic/chat_models.py
- 3: https://github.com/langchain-ai/langchain/blob/e495651f/libs/partners/anthropic/tests/unit_tests/test_chat_models.py
- 4: https://github.com/langchain-ai/langchain/blob/e8ca09d54e9a04c2c8906d3b238a32dfa898ec28/libs/partners/anthropic/langchain_anthropic/chat_models.py
- 5: https://reference.langchain.com/python/langchain-anthropic/chat_models/ChatAnthropic
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== target slice =="
if [ -f ols/src/llms/providers/anthropic.py ]; then
python3 - <<'PY'
with open("ols/src/llms/providers/anthropic.py", encoding="utf-8") as f:
for i, line in enumerate(f, 1):
if 1 <= i <= 130:
print(f"{i:4d}\t{line.rstrip()}")
PY
fi
echo "== dependency mentions =="
rg -n 'langchain-anthropic|langchain_anthropic|langchain|anthropic>=|anthropic<|anthropic==' pyproject.toml uv.lock requirements.txt .konflux || true
echo "== ChatAnthropic usages/tests =="
rg -n 'ChatAnthropic|anthropic_client|anthropic_client_async|http_client|http_async_client|_construct_httpx_client' sos ols . --glob '!*.lock' --glob '!**/.venv/**' --glob '!**/dist/**' --glob '!**/build/**' 2>/dev/null || true
echo "== uv lock langchain-anthropic package entries =="
python3 - <<'PY'
path='uv.lock'
try:
with open(path, encoding='utf-8') as f:
txt=f.read()
except FileNotFoundError:
print("uv.lock not found")
raise SystemExit
for i,line in enumerate(txt.splitlines(),1):
if 'langchain-anthropic' in line or 'name = "langchain-anthropic"' in line:
print(f"{i}: {line}")
PYRepository: openshift/lightspeed-service
Length of output: 35013
🌐 Web query:
langchain_anthropic ChatAnthropic source http_client http_async_client anthropic_client_async
💡 Result:
In the langchain-anthropic library, the ChatAnthropic class manages its underlying HTTP connections using internal helper functions—_get_default_httpx_client and _get_default_async_httpx_client—located in the _client_utils.py module [1][2][3][4]. These helpers return configured httpx.Client and httpx.AsyncClient instances, respectively, which are then passed to the official Anthropic SDK's client constructors [1][2][3][4]. For a significant period, ChatAnthropic did not allow users to inject custom httpx clients, which limited support for scenarios requiring custom proxy configurations, mutual TLS (mTLS), or specific certificate paths [5][6][7][8]. To address these limitations, community efforts and development prioritized adding explicit http_client and http_async_client fields to the ChatAnthropic class, bringing it to parity with other integrations like ChatOpenAI [5][6][9]. As of May 2026, work has been merged (via pull requests such as #37526) to introduce these optional http_client and http_async_client fields [7][9]. When these are provided, the ChatAnthropic class uses the user-supplied client instead of generating a default one, allowing for advanced transport-layer customization [5][6]. Before this addition, users frequently had to resort to manual workarounds, such as monkey-patching the internal client attributes or attempting to pass unsupported parameters [7].
Citations:
- 1: https://github.com/langchain-ai/langchain/blob/50febb79/libs/partners/anthropic/langchain_anthropic/chat_models.py
- 2: https://github.com/langchain-ai/langchain/blob/5c6fa28192505ad1caf5126520f2a0dc218d0c75/libs/partners/anthropic/langchain_anthropic/chat_models.py
- 3: https://github.com/langchain-ai/langchain/blob/273d282a/libs/partners/anthropic/langchain_anthropic/_client_utils.py
- 4: https://github.com/langchain-ai/langchain/blob/0e97e85a/libs/partners/anthropic/langchain_anthropic/_client_utils.py
- 5: feat(anthropic): add http_client and http_async_client fields to ChatAnthropic (parity with ChatOpenAI) langchain-ai/langchain#36056
- 6: feat(anthropic): support custom httpx client for mTLS and certificate-based authentication langchain-ai/langchain#35843
- 7: Setting a custom
http_clientfails with unexpected keyword argument when usingChatAnthropiclangchain-ai/langchain#30146 - 8: langchain_anthropic does not support set verify=False and cert filepath langchain-ai/langchain#35977
- 9: https://github.com/langchain-ai/langchain/actions/runs/23322354914
🌐 Web query:
langchain-anthropic 1.5.3 ChatAnthropic source default_async_client custom_client _client_utils
💡 Result:
In langchain-anthropic version 1.5.3, the ChatAnthropic class manages its interaction with the Anthropic API using cached client instances [1][2]. The terms you mentioned relate to the internal mechanism for managing these clients: _client and _async_client: These are @cached_property methods defined within ChatAnthropic that handle the initialization and retrieval of the underlying Anthropic SDK clients (anthropic.Client and anthropic.AsyncClient, respectively) [1]. By caching these, the model avoids re-initializing the client on every invocation [2]. _client_utils.py: This module was introduced (e.g., via PR #31659) to centralize utility logic for client management, including the caching mechanism [2]. Custom Client Usage: While ChatAnthropic is designed to automatically manage the Anthropic SDK client based on provided configuration (such as api_key, base_url, and timeout), it does not natively expose a parameter to inject a pre-constructed custom client instance directly into its constructor [3][4][5]. Developers requiring specific custom client behavior—such as using an azure_ad_token_provider—typically achieve this by subclassing ChatAnthropic and overriding the _client and _async_client cached properties to return the desired client instance [1]. The version 1.5.3 of langchain-anthropic was released on July 28, 2026, and included fixes related to streaming and message content handling [6][7].
Citations:
- 1: https://forum.langchain.com/t/how-to-use-chatanthropic-with-azure-ad-token-provider/2907
- 2: langchain-ai/langchain@b02bd67
- 3: https://github.com/langchain-ai/langchain/blob/85a5a04210452aec2eb3a06a02961c8fefd5c8b6/libs/partners/anthropic/langchain_anthropic/chat_models.py
- 4: https://github.com/langchain-ai/langchain/blob/master/libs/partners/anthropic/langchain_anthropic/chat_models.py
- 5: https://reference.langchain.com/python/langchain-anthropic/chat_models/ChatAnthropic
- 6: https://github.com/langchain-ai/langchain/releases/tag/langchain-anthropic==1.5.3
- 7: release(anthropic): 1.5.3 langchain-ai/langchain#39109
🌐 Web query:
langchain-anthropic 1.5.3 ChatAnthropic source __init__ http_client anthropic_client_async
💡 Result:
In recent versions of the langchain-anthropic package, including 1.5.3, the ChatAnthropic class has been updated to support custom HTTP clients, bringing it into parity with other integrations like ChatOpenAI [1]. Users can now pass custom httpx.Client and httpx.AsyncClient instances directly to ChatAnthropic via the http_client and http_async_client initialization parameters, respectively [1]. These parameters allow for advanced network customization, such as configuring custom SSL settings, proxies, or corporate network environments [1]. In the internal implementation of ChatAnthropic, these parameters are utilized within the _client and _async_client cached properties [1]. If a user provides an http_client or http_async_client, the class uses the provided client; otherwise, it falls back to the default internal client creation logic (using utility functions _get_default_httpx_client or _get_default_async_httpx_client) [1]. Previously, ChatAnthropic relied exclusively on its internal mechanisms for creating and managing HTTP clients, making it difficult to inject pre-configured clients [1]. This addition ensures that the Anthropic SDK, which natively supports http_client as a constructor argument, can be fully leveraged through the LangChain wrapper [1].
Citations:
🌐 Web query:
langchain-anthropic 1.5.3 ChatAnthropic http_async_client anthropic_client_async constructor
💡 Result:
In langchain-anthropic version 1.5.3, the ChatAnthropic class does not accept http_client or http_async_client as direct constructor parameters [1][2][3]. While there have been community requests and discussions to add these fields to provide parity with other integration classes like ChatOpenAI—specifically to support custom httpx clients for use cases such as mTLS, proxy configuration, or certificate-based authentication [1][2]—the official implementation in the langchain-anthropic package historically relies on internal mechanisms to manage clients [2][4]. To inject a custom client into ChatAnthropic, the recommended and supported approach is to instantiate the underlying Anthropic SDK client yourself and pass it to the constructor using the anthropic_client or anthropic_client_async parameters [3]: from anthropic import AsyncAnthropic import httpx from langchain_anthropic import ChatAnthropic # 1. Create your custom httpx client async_http = httpx.AsyncClient(...) # 2. Instantiate the Anthropic client with your custom httpx client anth_async = AsyncAnthropic(http_client=async_http) # 3. Inject it into ChatAnthropic llm = ChatAnthropic( model="claude-3-5-sonnet-20241022", anthropic_client_async=anth_async,) Passing http_client directly to the ChatAnthropic constructor will typically raise a TypeError in recent versions of the library, as the wrapper class strictly validates its arguments [3]. If you need to use both synchronous and asynchronous invocation methods (invoke and ainvoke), you should provide both anthropic_client and anthropic_client_async respectively [3].
Citations:
- 1: feat(anthropic): support custom httpx client for mTLS and certificate-based authentication langchain-ai/langchain#35843
- 2: feat(anthropic): add http_client and http_async_client fields to ChatAnthropic (parity with ChatOpenAI) langchain-ai/langchain#36056
- 3: https://itsourcecode.com/typeerror/langchain-chatanthropic-http-client-keyword/
- 4: https://github.com/langchain-ai/langchain/blob/8fed1dd641f49b96d69ad3bfbb922ba6e45c2878/libs/partners/anthropic/langchain_anthropic/chat_models.py
Remove unsupported Anthropic HTTP-client kwargs.
load() passes self.params to ChatAnthropic, and default_params currently includes http_client/http_async_client. ChatAnthropic does not expose these constructor kwargs, so every Anthropic load fails with an unrecognized argument error. Use anthropic_client/anthropic_client_async with pre-built Anthropic clients, or remove these kwargs after checking the installed langchain-anthropic signature.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@ols/src/llms/providers/anthropic.py` around lines 35 - 44, Update the
`default_parameters` construction used by `load()` so `ChatAnthropic` receives
only supported constructor arguments: replace `http_client` and
`http_async_client` with pre-built clients via `anthropic_client` and
`anthropic_client_async`, or remove them after validating the installed
`langchain-anthropic` signature. Preserve the existing client configuration and
all other parameters.
|
@raptorsun: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
Add a new anthropic provider type to lightspeed-service that uses ChatAnthropic from langchain-anthropic with a direct API key, enabling Claude models without requiring Google Vertex AI or AWS Bedrock as intermediaries.
Type of change
Related Tickets & Documents
Checklist before requesting a review
Testing
Summary by CodeRabbit
New Features
Documentation
Tests