Current section
Files
Jump to
Current section
Files
lib/snakebridge_generated/dspy/clients/cache/__init__.ex
# Generated by SnakeBridge v0.12.0 - DO NOT EDIT MANUALLY
# Regenerate with: mix compile
# Library: dspy 3.1.2
# Python module: dspy.clients.cache
defmodule Dspy.Clients.Cache do
@moduledoc """
Submodule bindings for `dspy.clients.cache`.
"""
def __snakebridge_python_name__, do: "dspy.clients.cache"
def __snakebridge_library__, do: "dspy"
@doc """
Decorator for applying caching to a function based on the request argument.
## Parameters
- `cache_arg_name` - The name of the argument that contains the request. If not provided, the entire kwargs is used as the request.
- `ignored_args_for_cache_key` - A list of arguments to ignore when computing the cache key from the request.
- `enable_memory_cache` - Whether to enable in-memory cache at call time. If False, the memory cache will not be written to on new data.
Parameters:
- `cache_arg_name` (term() default: None)
- `ignored_args_for_cache_key` (term() default: None)
- `enable_memory_cache` (boolean() default: True)
- `maxsize` (term() keyword-only default: None)
Returns:
- `term()`
"""
@spec request_cache() :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec request_cache(keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec request_cache(term()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec request_cache(term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec request_cache(term(), term()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec request_cache(term(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec request_cache(term(), term(), boolean()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec request_cache(term(), term(), boolean(), keyword()) ::
{:ok, term()} | {:error, Snakepit.Error.t()}
def request_cache() do
SnakeBridge.Runtime.call(__MODULE__, :request_cache, [], [])
end
def request_cache(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__, :request_cache, [], opts)
end
def request_cache(cache_arg_name) do
SnakeBridge.Runtime.call(__MODULE__, :request_cache, [cache_arg_name], [])
end
def request_cache(cache_arg_name, 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__, :request_cache, [cache_arg_name], opts)
end
def request_cache(cache_arg_name, ignored_args_for_cache_key) do
SnakeBridge.Runtime.call(
__MODULE__,
:request_cache,
[cache_arg_name, ignored_args_for_cache_key],
[]
)
end
def request_cache(cache_arg_name, ignored_args_for_cache_key, 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__,
:request_cache,
[cache_arg_name, ignored_args_for_cache_key],
opts
)
end
def request_cache(cache_arg_name, ignored_args_for_cache_key, enable_memory_cache) do
SnakeBridge.Runtime.call(
__MODULE__,
:request_cache,
[cache_arg_name, ignored_args_for_cache_key, enable_memory_cache],
[]
)
end
def request_cache(cache_arg_name, ignored_args_for_cache_key, enable_memory_cache, 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__,
:request_cache,
[cache_arg_name, ignored_args_for_cache_key, enable_memory_cache],
opts
)
end
end