Current section
Files
Jump to
Current section
Files
lib/snakebridge_generated/dspy/dsp/utils/settings/__init__.ex
# Generated by SnakeBridge v0.13.0 - DO NOT EDIT MANUALLY
# Regenerate with: mix compile
# Library: dspy 3.1.2
# Python module: dspy.dsp.utils.settings
defmodule Dspy.Dsp.Utils.Settings do
@moduledoc """
Submodule bindings for `dspy.dsp.utils.settings`.
## Version
- Requested: 3.1.2
- Observed at generation: 3.1.2
## Runtime Options
All functions accept a `__runtime__` option for controlling execution behavior:
Dspy.Dsp.Utils.Settings.some_function(args, __runtime__: [timeout: 120_000])
### Supported runtime options
- `:timeout` - Call timeout in milliseconds (default: 120,000ms / 2 minutes)
- `:timeout_profile` - Use a named profile (`:default`, `:ml_inference`, `:batch_job`, `:streaming`)
- `:stream_timeout` - Timeout for streaming operations (default: 1,800,000ms / 30 minutes)
- `:session_id` - Override the session ID for this call
- `:pool_name` - Target a specific Snakepit pool (multi-pool setups)
- `:affinity` - Override session affinity (`:hint`, `:strict_queue`, `:strict_fail_fast`)
### Timeout Profiles
- `:default` - 2 minute timeout for regular calls
- `:ml_inference` - 10 minute timeout for ML/LLM workloads
- `:batch_job` - Unlimited timeout for long-running jobs
- `:streaming` - 2 minute timeout, 30 minute stream_timeout
### Example with timeout override
# For a long-running ML inference call
Dspy.Dsp.Utils.Settings.predict(data, __runtime__: [timeout_profile: :ml_inference])
# Or explicit timeout
Dspy.Dsp.Utils.Settings.predict(data, __runtime__: [timeout: 600_000])
# Route to a pool and enforce strict affinity
Dspy.Dsp.Utils.Settings.predict(data, __runtime__: [pool_name: :strict_pool, affinity: :strict_queue])
See `SnakeBridge.Defaults` for global timeout configuration.
"""
@doc false
def __snakebridge_python_name__, do: "dspy.dsp.utils.settings"
@doc false
def __snakebridge_library__, do: "dspy"
@doc """
A singleton class for DSPy configuration settings.
Thread-safe global configuration.
- 'configure' can be called by only one 'owner' thread (the first thread that calls it).
- Other threads see the configured global values from 'main_thread_config'.
- 'context' sets thread-local overrides. These overrides propagate to threads spawned
inside that context block, when (and only when!) using a ParallelExecutor that copies overrides.
1. Only one unique thread (which can be any thread!) can call dspy.configure.
2. It affects a global state, visible to all. As a result, user threads work, but they shouldn't be
mixed with concurrent changes to dspy.configure from the "main" thread.
(TODO: In the future, add warnings: if there are near-in-time user-thread reads followed by .configure calls.)
3. Any thread can use dspy.context. It propagates to child threads created with DSPy primitives: Parallel, asyncify, etc.
## Returns
- `Dspy.Dsp.Utils.Settings.Settings.t()`
"""
@spec settings() :: {:ok, Dspy.Dsp.Utils.Settings.Settings.t()} | {:error, Snakepit.Error.t()}
def settings() do
SnakeBridge.Runtime.get_module_attr(__MODULE__, :settings)
end
end