Current section
Files
Jump to
Current section
Files
lib/snakebridge_generated/dspy/utils/hasher/hasher.ex
# Generated by SnakeBridge v0.14.0 - DO NOT EDIT MANUALLY
# Regenerate with: mix compile
# Library: dspy 3.1.2
# Python module: dspy.utils.hasher
# Python class: Hasher
defmodule Dspy.Utils.Hasher do
@moduledoc """
Hasher that accepts python objects as inputs.
"""
def __snakebridge_python_name__, do: "dspy.utils.hasher"
def __snakebridge_python_class__, do: "Hasher"
def __snakebridge_library__, do: "dspy"
@opaque t :: SnakeBridge.Ref.t()
@doc """
Initialize self. See help(type(self)) for accurate signature.
"""
@spec new(keyword()) :: {:ok, SnakeBridge.Ref.t()} | {:error, Snakepit.Error.t()}
def new(opts \\ []) do
SnakeBridge.Runtime.call_class(__MODULE__, :__init__, [], opts)
end
@doc """
Python method `Hasher.hash`.
## Parameters
- `value` (term())
## Returns
- `String.t()`
"""
@spec hash(SnakeBridge.Ref.t(), term(), keyword()) ::
{:ok, String.t()} | {:error, Snakepit.Error.t()}
def hash(ref, value, opts \\ []) do
SnakeBridge.Runtime.call_method(ref, :hash, [value], opts)
end
@doc """
Python method `Hasher.hash_bytes`.
## Parameters
- `value` (term())
## Returns
- `String.t()`
"""
@spec hash_bytes(SnakeBridge.Ref.t(), term(), keyword()) ::
{:ok, String.t()} | {:error, Snakepit.Error.t()}
def hash_bytes(ref, value, opts \\ []) do
SnakeBridge.Runtime.call_method(ref, :hash_bytes, [value], opts)
end
@doc """
Python method `Hasher.hexdigest`.
## Returns
- `String.t()`
"""
@spec hexdigest(SnakeBridge.Ref.t(), keyword()) ::
{:ok, String.t()} | {:error, Snakepit.Error.t()}
def hexdigest(ref, opts \\ []) do
SnakeBridge.Runtime.call_method(ref, :hexdigest, [], opts)
end
@doc """
Python method `Hasher.update`.
## Parameters
- `value` (term())
## Returns
- `nil`
"""
@spec update(SnakeBridge.Ref.t(), term(), keyword()) ::
{:ok, nil} | {:error, Snakepit.Error.t()}
def update(ref, value, opts \\ []) do
SnakeBridge.Runtime.call_method(ref, :update, [value], opts)
end
@spec dispatch(SnakeBridge.Ref.t()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
def dispatch(ref) do
SnakeBridge.Runtime.get_attr(ref, :dispatch)
end
end