Current section

Files

Jump to
dspex lib snakebridge_generated dspy utils saving __init__.ex
Raw

lib/snakebridge_generated/dspy/utils/saving/__init__.ex

# Generated by SnakeBridge v0.12.0 - DO NOT EDIT MANUALLY
# Regenerate with: mix compile
# Library: dspy 3.1.2
# Python module: dspy.utils.saving
defmodule Dspy.Utils.Saving do
@moduledoc """
Submodule bindings for `dspy.utils.saving`.
"""
def __snakebridge_python_name__, do: "dspy.utils.saving"
def __snakebridge_library__, do: "dspy"
@doc """
"""
@spec get_dependency_versions(keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
def get_dependency_versions(opts \\ []) do
SnakeBridge.Runtime.call(__MODULE__, :get_dependency_versions, [], opts)
end
@doc """
Load saved DSPy model.
This method is used to load a saved DSPy model with `save_program=True`, i.e., the model is saved with cloudpickle.
## Parameters
- `path` - Path to the saved model. (type: `String.t()`)
- `allow_pickle` - Whether to allow loading the model with pickle. This is dangerous and should only be used if you are sure you trust the source of the model. (type: `boolean()`)
Parameters:
- `path` (String.t())
- `allow_pickle` (boolean() default: False)
Returns:
- `term()`
"""
@spec load(String.t()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec load(String.t(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec load(String.t(), boolean()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec load(String.t(), boolean(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
def load(path) do
SnakeBridge.Runtime.call(__MODULE__, :load, [path], [])
end
def load(path, opts)
when is_list(opts) and
(opts == [] or
(is_tuple(hd(opts)) and tuple_size(hd(opts)) == 2 and is_atom(elem(hd(opts), 0)))) do
SnakeBridge.Runtime.call(__MODULE__, :load, [path], opts)
end
def load(path, allow_pickle) do
SnakeBridge.Runtime.call(__MODULE__, :load, [path, allow_pickle], [])
end
def load(path, allow_pickle, opts)
when is_list(opts) and
(opts == [] or
(is_tuple(hd(opts)) and tuple_size(hd(opts)) == 2 and is_atom(elem(hd(opts), 0)))) do
SnakeBridge.Runtime.call(__MODULE__, :load, [path, allow_pickle], opts)
end
end