# Generated by SnakeBridge v0.13.0 - DO NOT EDIT MANUALLY # Regenerate with: mix compile # Library: dspy 3.1.2 # Python module: dspy.propose.utils defmodule Dspy.Propose.Utils do @moduledoc """ Submodule bindings for `dspy.propose.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.Propose.Utils.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.Propose.Utils.predict(data, __runtime__: [timeout_profile: :ml_inference]) # Or explicit timeout Dspy.Propose.Utils.predict(data, __runtime__: [timeout: 600_000]) # Route to a pool and enforce strict affinity Dspy.Propose.Utils.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.propose.utils" @doc false def __snakebridge_library__, do: "dspy" @doc """ Python binding for `dspy.propose.utils.create_example_string`. ## Parameters - `fields` (term()) - `example` (term()) ## Returns - `term()` """ @spec create_example_string(term(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def create_example_string(fields, example, opts \\ []) do SnakeBridge.Runtime.call(__MODULE__, :create_example_string, [fields, example], opts) end @doc """ Python binding for `dspy.propose.utils.create_instruction_set_history_string`. ## Parameters - `base_program` (term()) - `trial_logs` (term()) - `top_n` (term()) ## Returns - `term()` """ @spec create_instruction_set_history_string(term(), term(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def create_instruction_set_history_string(base_program, trial_logs, top_n, opts \\ []) do SnakeBridge.Runtime.call( __MODULE__, :create_instruction_set_history_string, [base_program, trial_logs, top_n], opts ) end @doc """ Python binding for `dspy.propose.utils.create_predictor_level_history_string`. ## Parameters - `base_program` (term()) - `predictor_i` (term()) - `trial_logs` (term()) - `top_n` (term()) ## Returns - `term()` """ @spec create_predictor_level_history_string(term(), term(), term(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def create_predictor_level_history_string( base_program, predictor_i, trial_logs, top_n, opts \\ [] ) do SnakeBridge.Runtime.call( __MODULE__, :create_predictor_level_history_string, [base_program, predictor_i, trial_logs, top_n], opts ) end @doc """ Python binding for `dspy.propose.utils.get_dspy_source_code`. ## Parameters - `module` (term()) ## Returns - `term()` """ @spec get_dspy_source_code(term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def get_dspy_source_code(module, opts \\ []) do SnakeBridge.Runtime.call(__MODULE__, :get_dspy_source_code, [module], opts) end @doc """ Python binding for `dspy.propose.utils.get_program_instruction_set_string`. ## Parameters - `program` (term()) ## Returns - `term()` """ @spec get_program_instruction_set_string(term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def get_program_instruction_set_string(program, opts \\ []) do SnakeBridge.Runtime.call(__MODULE__, :get_program_instruction_set_string, [program], opts) end @doc """ Python binding for `dspy.propose.utils.parse_list_of_instructions`. ## Parameters - `instruction_string` (term()) ## Returns - `term()` """ @spec parse_list_of_instructions(term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def parse_list_of_instructions(instruction_string, opts \\ []) do SnakeBridge.Runtime.call(__MODULE__, :parse_list_of_instructions, [instruction_string], opts) end @doc """ Python binding for `dspy.propose.utils.strip_prefix`. ## Parameters - `text` (term()) ## Returns - `term()` """ @spec strip_prefix(term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def strip_prefix(text, opts \\ []) do SnakeBridge.Runtime.call(__MODULE__, :strip_prefix, [text], opts) end end