Current section
Files
Jump to
Current section
Files
lib/snakebridge_generated/dspy/utils/logging_utils/__init__.ex
# Generated by SnakeBridge v0.13.0 - DO NOT EDIT MANUALLY
# Regenerate with: mix compile
# Library: dspy 3.1.2
# Python module: dspy.utils.logging_utils
defmodule Dspy.Utils.LoggingUtils do
@moduledoc """
Submodule bindings for `dspy.utils.logging_utils`.
## Version
- Requested: 3.1.2
- Observed at generation: 3.1.2
## Runtime Options
All functions accept a `__runtime__` option for controlling execution behavior:
Dspy.Utils.LoggingUtils.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.Utils.LoggingUtils.predict(data, __runtime__: [timeout_profile: :ml_inference])
# Or explicit timeout
Dspy.Utils.LoggingUtils.predict(data, __runtime__: [timeout: 600_000])
# Route to a pool and enforce strict affinity
Dspy.Utils.LoggingUtils.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.utils.logging_utils"
@doc false
def __snakebridge_library__, do: "dspy"
@doc """
Python binding for `dspy.utils.logging_utils.configure_dspy_loggers`.
## Parameters
- `root_module_name` (term())
## Returns
- `term()`
"""
@spec configure_dspy_loggers(term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
def configure_dspy_loggers(root_module_name, opts \\ []) do
SnakeBridge.Runtime.call(__MODULE__, :configure_dspy_loggers, [root_module_name], opts)
end
@doc """
Disables the `DSPyLoggingStream` used by event logging APIs throughout DSPy
(`eprint()`, `logger.info()`, etc), silencing all subsequent event logs.
## Returns
- `term()`
"""
@spec disable_logging(keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
def disable_logging(opts \\ []) do
SnakeBridge.Runtime.call(__MODULE__, :disable_logging, [], opts)
end
@doc """
A Python stream for use with event logging APIs throughout DSPy (`eprint()`,
`logger.info()`, etc.). This stream wraps `sys.stderr`, forwarding `write()` and
`flush()` calls to the stream referred to by `sys.stderr` at the time of the call.
It also provides capabilities for disabling the stream to silence event logs.
## Returns
- `Dspy.Utils.LoggingUtils.DSPyLoggingStream.t()`
"""
@spec dspy_logging_stream() ::
{:ok, Dspy.Utils.LoggingUtils.DSPyLoggingStream.t()} | {:error, Snakepit.Error.t()}
def dspy_logging_stream() do
SnakeBridge.Runtime.get_module_attr(__MODULE__, "DSPY_LOGGING_STREAM")
end
@doc """
Enables the `DSPyLoggingStream` used by event logging APIs throughout DSPy
(`eprint()`, `logger.info()`, etc), emitting all subsequent event logs. This
reverses the effects of `disable_logging()`.
## Returns
- `term()`
"""
@spec enable_logging(keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
def enable_logging(opts \\ []) do
SnakeBridge.Runtime.call(__MODULE__, :enable_logging, [], opts)
end
end