mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
fix: address OCR greptile feedback
This commit is contained in:
parent
65ce6a1522
commit
6b1e1dcbaf
6 changed files with 6 additions and 11 deletions
|
|
@ -1,7 +1,7 @@
|
|||
# Adding a provider / route to litellm-rust
|
||||
|
||||
- Keep the route contract pure in `crates/core/src/<route>/`: define the typed request/response structs and a provider config trait with no network, env, auth, or logging.
|
||||
- Add provider identity to the repo-root `provider_endpoints_support.json`: use the LiteLLM provider slug, display name, docs URL, and endpoint support flags. Put optional stable base URL / API key env var defaults under the top-level `default_creds` map.
|
||||
- Add provider identity to the repo-root `provider_endpoints_support.json`: use the LiteLLM provider slug, display name, docs URL, and endpoint support flags. Put optional stable provider-level base URL defaults under the top-level `default_creds` map; keep route-specific API key env vars in provider config/transform code so key resolution has one owner.
|
||||
- Put provider-specific transforms in `crates/providers/src/<provider>/<route>/transformation.rs`, mirroring the Python provider tree and exposing a `const <PROVIDER>_<ROUTE>_CONFIG`.
|
||||
- The provider config owns three pure steps: map LiteLLM params, transform the LiteLLM request into the provider request, and transform the provider response back into the LiteLLM response.
|
||||
- If the provider has a reverse or normalization step, keep it pure and explicit next to the transforms; do not hide reverse mapping inside the HTTP transport.
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ mod tests {{
|
|||
LlmProvider::Mistral.default_api_base(),
|
||||
Some("https://api.mistral.ai/v1")
|
||||
);
|
||||
assert_eq!(LlmProvider::Mistral.api_key_env_var(), Some("MISTRAL_API_KEY"));
|
||||
assert_eq!(LlmProvider::Mistral.api_key_env_var(), None);
|
||||
}}
|
||||
}}
|
||||
"#,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ To add a provider:
|
|||
- Add a `provider_endpoints_support.json` provider entry using the LiteLLM
|
||||
provider slug, display name, docs URL, and endpoint support flags.
|
||||
- Add optional defaults under the top-level `default_creds` map only when there
|
||||
is a stable provider-level base URL or canonical API key environment variable.
|
||||
is a stable provider-level base URL. Keep route-specific key env var names in
|
||||
the provider transform/config so auth resolution has one owner.
|
||||
- Put request/response logic under
|
||||
`crates/providers/src/<provider>/<route>/transformation.rs`; do not put
|
||||
transforms, signing logic, or secrets in provider metadata.
|
||||
|
|
|
|||
|
|
@ -365,10 +365,6 @@ async def aocr(
|
|||
prepared_request=prepared,
|
||||
resolve_api_key=get_secret_str,
|
||||
)
|
||||
if response is None:
|
||||
raise ValueError(
|
||||
f"Got an unexpected None response from the OCR API: {response}"
|
||||
)
|
||||
return response
|
||||
|
||||
response = base_llm_http_handler.ocr(
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@
|
|||
},
|
||||
"default_creds": {
|
||||
"mistral": {
|
||||
"default_api_base": "https://api.mistral.ai/v1",
|
||||
"api_key_env_var": "MISTRAL_API_KEY"
|
||||
"default_api_base": "https://api.mistral.ai/v1"
|
||||
}
|
||||
},
|
||||
"providers": {
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@
|
|||
},
|
||||
"default_creds": {
|
||||
"mistral": {
|
||||
"default_api_base": "https://api.mistral.ai/v1",
|
||||
"api_key_env_var": "MISTRAL_API_KEY"
|
||||
"default_api_base": "https://api.mistral.ai/v1"
|
||||
}
|
||||
},
|
||||
"providers": {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue