# Generated by SnakeBridge v0.13.0 - DO NOT EDIT MANUALLY # Regenerate with: mix compile # Library: dspy 3.1.2 # Python module: dspy.utils.magicattr defmodule Dspy.Utils.Magicattr do @moduledoc """ Compatibility layer for magicattr that works with Python 3.14+ This module provides a patched version of magicattr's functionality that is compatible with Python 3.14's removal of ast.Num and ast.Str. Based on magicattr 0.1.6 by Jairus Martin (MIT License) https://github.com/frmdstryr/magicattr ## 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.Magicattr.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.Magicattr.predict(data, __runtime__: [timeout_profile: :ml_inference]) # Or explicit timeout Dspy.Utils.Magicattr.predict(data, __runtime__: [timeout: 600_000]) # Route to a pool and enforce strict affinity Dspy.Utils.Magicattr.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.magicattr" @doc false def __snakebridge_library__, do: "dspy" @doc """ A delattr that supports deletion of a nested lookups on objects, dicts, lists, and any combination in between. ## Parameters - `obj` (term()) - `attr` (term()) ## Returns - `term()` """ @spec delete(term(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def delete(obj, attr, opts \\ []) do SnakeBridge.Runtime.call(__MODULE__, :delete, [obj, attr], opts) end @doc """ A getattr that supports nested lookups on objects, dicts, lists, and any combination in between. ## Parameters - `obj` (term()) - `attr` (term()) - `kwargs` (term()) ## Returns - `term()` """ @spec get(term(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def get(obj, attr, opts \\ []) do SnakeBridge.Runtime.call(__MODULE__, :get, [obj, attr], opts) end @doc """ Like get but instead of returning the final value it returns the object and action that will be done. ## Parameters - `obj` (term()) - `attr` (term()) ## Returns - `term()` """ @spec lookup(term(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def lookup(obj, attr, opts \\ []) do SnakeBridge.Runtime.call(__MODULE__, :lookup, [obj, attr], opts) end @doc """ A setattr that supports nested lookups on objects, dicts, lists, and any combination in between. ## Parameters - `obj` (term()) - `attr` (term()) - `val` (term()) ## Returns - `term()` """ @spec set(term(), term(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def set(obj, attr, val, opts \\ []) do SnakeBridge.Runtime.call(__MODULE__, :set, [obj, attr, val], opts) end end