MCPcopy Create free account
hub / github.com/BerriAI/litellm / python_settings

Function python_settings

litellm-rust/crates/python-bridge/src/http.rs:219–243  ·  view source on GitHub ↗
(py: Python<'py>, overrides: &str)

Source from the content-addressed store, hash-verified

217 }
218
219 fn python_settings<'py>(py: Python<'py>, overrides: &str) -> Snapshot<'py> {
220 let source = format!(
221 "
222import types
223defaults = dict(
224 ssl_verify=True,
225 ssl_certificate=None,
226 ssl_security_level=None,
227 ssl_ecdh_curve=None,
228 force_ipv4=False,
229 http2=False,
230 aiohttp_trust_env=False,
231 disable_aiohttp_trust_env=False,
232 disable_aiohttp_transport=False,
233 user_agent='litellm/test',
234)
235defaults.update(dict({overrides}))
236settings = types.SimpleNamespace(**defaults)
237"
238 );
239 let locals = PyDict::new(py);
240 let source = std::ffi::CString::new(source).unwrap();
241 py.run(&source, Some(&locals), Some(&locals)).unwrap();
242 PythonSettings::Http.snapshot(locals.get_item("settings").unwrap().unwrap())
243 }
244
245 #[test]
246 fn default_python_settings_resolve_to_default_settings_with_verification_on() {

Calls 3

unwrapMethod · 0.45
runMethod · 0.45
snapshotMethod · 0.45