Current section

Files

Jump to
dspex lib snakebridge_generated dspy bootstrap_rs.ex
Raw

lib/snakebridge_generated/dspy/bootstrap_rs.ex

# Generated by SnakeBridge v0.16.0 - DO NOT EDIT MANUALLY
# Regenerate with: mix compile
# Library: dspy 3.2.0
# Python module: dspy
# Python class: BootstrapRS
defmodule Dspy.BootstrapRS do
@moduledoc """
Wrapper for Python class BootstrapRS.
"""
def __snakebridge_python_name__, do: "dspy"
def __snakebridge_python_class__, do: "BootstrapRS"
def __snakebridge_library__, do: "dspy"
@opaque t :: SnakeBridge.Ref.t()
@doc """
Initialize self. See help(type(self)) for accurate signature.
## Parameters
- `metric` (term())
- `teacher_settings` (term() default: None)
- `max_bootstrapped_demos` (term() default: 4)
- `max_labeled_demos` (term() default: 16)
- `max_rounds` (term() default: 1)
- `num_candidate_programs` (term() default: 16)
- `num_threads` (term() default: None)
- `max_errors` (term() default: None)
- `stop_at_score` (term() default: None)
- `metric_threshold` (term() default: None)
"""
@spec new(term(), list(term()), keyword()) ::
{:ok, SnakeBridge.Ref.t()} | {:error, Snakepit.Error.t()}
def new(metric, args, opts \\ []) do
{args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts)
SnakeBridge.Runtime.call_class(__MODULE__, :__init__, [metric] ++ List.wrap(args), opts)
end
@doc """
Optimize the student program.
## Parameters
- `student` - The student program to optimize.
- `trainset` - The training set to use for optimization.
- `teacher` - The teacher program to use for optimization.
- `valset` - The validation set to use for optimization.
## Returns
- `term()`
"""
@spec compile(SnakeBridge.Ref.t(), term(), keyword()) ::
{:ok, term()} | {:error, Snakepit.Error.t()}
def compile(ref, student, opts \\ []) do
kw_keys = opts |> Keyword.keys() |> Enum.map(&to_string/1)
missing_kw = ["trainset"] |> Enum.reject(&(&1 in kw_keys))
if missing_kw != [] do
raise ArgumentError,
"Missing required keyword-only arguments: " <> Enum.join(missing_kw, ", ")
end
SnakeBridge.Runtime.call_method(ref, :compile, [student], opts)
end
@doc """
Get the parameters of the teleprompter.
## Returns
- `%{optional(String.t()) => term()}`
"""
@spec get_params(SnakeBridge.Ref.t(), keyword()) ::
{:ok, %{optional(String.t()) => term()}} | {:error, Snakepit.Error.t()}
def get_params(ref, opts \\ []) do
SnakeBridge.Runtime.call_method(ref, :get_params, [], opts)
end
end