mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-15 09:12:18 +00:00
style(rust-bridge): rustfmt the secrets source
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b74bd81eda
commit
4351906ca7
2 changed files with 15 additions and 8 deletions
|
|
@ -23,12 +23,11 @@ use crate::python_settings::missing_module;
|
|||
pub(crate) fn source(py: Python<'_>) -> PyResult<Arc<dyn SecretSource>> {
|
||||
match PythonSecrets::new(py) {
|
||||
Ok(secrets) => Ok(Arc::new(secrets)),
|
||||
Err(error) if missing_module(py, &error, "litellm")? => Ok(Arc::new(
|
||||
EnvironmentSecrets::python_compatible(crate::http::host_client(
|
||||
py,
|
||||
litellm_http::ClientVariant::Provider,
|
||||
)?),
|
||||
)),
|
||||
Err(error) if missing_module(py, &error, "litellm")? => {
|
||||
Ok(Arc::new(EnvironmentSecrets::python_compatible(
|
||||
crate::http::host_client(py, litellm_http::ClientVariant::Provider)?,
|
||||
)))
|
||||
}
|
||||
Err(error) => Err(error),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,12 @@ impl PythonSecrets {
|
|||
PyTuple::new(py, names)
|
||||
.and_then(|names| read_secrets.bind(py).call1((names,)))
|
||||
.and_then(|values| values.extract::<Vec<Option<String>>>())
|
||||
.map(|values| values.into_iter().map(|value| value.map(SecretValue::new)).collect())
|
||||
.map(|values| {
|
||||
values
|
||||
.into_iter()
|
||||
.map(|value| value.map(SecretValue::new))
|
||||
.collect()
|
||||
})
|
||||
.map_err(|error| external_error(py, error))
|
||||
})
|
||||
.await
|
||||
|
|
@ -196,7 +201,10 @@ def read_secrets(names):
|
|||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(resolved.get("MISTRAL_API_KEY").as_deref(), Some("vault-key"));
|
||||
assert_eq!(
|
||||
resolved.get("MISTRAL_API_KEY").as_deref(),
|
||||
Some("vault-key")
|
||||
);
|
||||
assert_eq!(resolved.get("OTHER"), None);
|
||||
assert_eq!(
|
||||
resolved.get("MISTRAL_API_BASE").as_deref(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue