# Generated by SnakeBridge v0.13.0 - DO NOT EDIT MANUALLY # Regenerate with: mix compile # Library: dspy 3.1.2 # Python module: dspy # Python class: Prediction defmodule Dspy.Prediction do @moduledoc """ A prediction object that contains the output of a DSPy module. Prediction inherits from Example. To allow feedback-augmented scores, Prediction supports comparison operations (<, >, <=, >=) for Predictions with a `score` field. The comparison operations compare the 'score' values as floats. For equality comparison, Predictions are equal if their underlying data stores are equal (inherited from Example). Arithmetic operations (+, /, etc.) are also supported for Predictions with a 'score' field, operating on the score value. """ def __snakebridge_python_name__, do: "dspy" def __snakebridge_python_class__, do: "Prediction" def __snakebridge_library__, do: "dspy" @opaque t :: SnakeBridge.Ref.t() @doc """ Initialize an Example instance. ## Parameters - `base` - Optional base data source. Can be: - Another Example instance (copies its data) - A dictionary (copies its key-value pairs) - None (creates empty Example) **kwargs: Additional key-value pairs to store in the Example. """ @spec new(list(term()), keyword()) :: {:ok, SnakeBridge.Ref.t()} | {:error, Snakepit.Error.t()} def new(args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_class(__MODULE__, :__init__, [] ++ List.wrap(args), opts) end @doc """ Python method `Prediction.copy`. ## Parameters - `kwargs` (term()) ## Returns - `term()` """ @spec copy(SnakeBridge.Ref.t(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def copy(ref, opts \\ []) do SnakeBridge.Runtime.call_method(ref, :copy, [], opts) end @doc """ Python method `Prediction.from_completions`. ## Parameters - `list_or_dict` (term()) - `signature` (term() default: None) ## Returns - `term()` """ @spec from_completions(SnakeBridge.Ref.t(), term(), list(term()), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def from_completions(ref, list_or_dict, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method( ref, :from_completions, [list_or_dict] ++ List.wrap(args), opts ) end @doc """ Python method `Prediction.get`. ## Parameters - `key` (term()) - `default` (term() default: None) ## Returns - `term()` """ @spec get(SnakeBridge.Ref.t(), term(), list(term()), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def get(ref, key, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :get, [key] ++ List.wrap(args), opts) end @doc """ Python method `Prediction.get_lm_usage`. ## Returns - `term()` """ @spec get_lm_usage(SnakeBridge.Ref.t(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def get_lm_usage(ref, opts \\ []) do SnakeBridge.Runtime.call_method(ref, :get_lm_usage, [], opts) end @doc """ Python method `Prediction.inputs`. ## Returns - `term()` """ @spec inputs(SnakeBridge.Ref.t(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def inputs(ref, opts \\ []) do SnakeBridge.Runtime.call_method(ref, :inputs, [], opts) end @doc """ Python method `Prediction.items`. ## Parameters - `include_dspy` (term() default: False) ## Returns - `term()` """ @spec items(SnakeBridge.Ref.t(), list(term()), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def items(ref, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :items, [] ++ List.wrap(args), opts) end @doc """ Python method `Prediction.keys`. ## Parameters - `include_dspy` (term() default: False) ## Returns - `term()` """ @spec keys(SnakeBridge.Ref.t(), list(term()), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def keys(ref, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :keys, [] ++ List.wrap(args), opts) end @doc """ Python method `Prediction.labels`. ## Returns - `term()` """ @spec labels(SnakeBridge.Ref.t(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def labels(ref, opts \\ []) do SnakeBridge.Runtime.call_method(ref, :labels, [], opts) end @doc """ Python method `Prediction.set_lm_usage`. ## Parameters - `value` (term()) ## Returns - `term()` """ @spec set_lm_usage(SnakeBridge.Ref.t(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def set_lm_usage(ref, value, opts \\ []) do SnakeBridge.Runtime.call_method(ref, :set_lm_usage, [value], opts) end @doc """ Python method `Prediction.toDict`. ## Returns - `term()` """ @spec to_dict(SnakeBridge.Ref.t(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def to_dict(ref, opts \\ []) do SnakeBridge.Runtime.call_method(ref, "toDict", [], opts) end @doc """ Python method `Prediction.values`. ## Parameters - `include_dspy` (term() default: False) ## Returns - `term()` """ @spec values(SnakeBridge.Ref.t(), list(term()), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def values(ref, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :values, [] ++ List.wrap(args), opts) end @doc """ Python method `Prediction.with_inputs`. ## Parameters - `keys` (term()) ## Returns - `term()` """ @spec with_inputs(SnakeBridge.Ref.t(), list(term()), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def with_inputs(ref, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :with_inputs, [] ++ List.wrap(args), opts) end @doc """ Python method `Prediction.without`. ## Parameters - `keys` (term()) ## Returns - `term()` """ @spec without(SnakeBridge.Ref.t(), list(term()), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def without(ref, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :without, [] ++ List.wrap(args), opts) end @spec completions(SnakeBridge.Ref.t()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def completions(ref) do SnakeBridge.Runtime.get_attr(ref, :completions) end end