# Generated by SnakeBridge v0.12.0 - DO NOT EDIT MANUALLY # Regenerate with: mix compile # Library: dspy 3.1.2 # Python module: dspy.datasets # Python class: DataLoader defmodule Dspy.Datasets.DataLoader do def __snakebridge_python_name__, do: "dspy.datasets" def __snakebridge_python_class__, do: "DataLoader" def __snakebridge_library__, do: "dspy" @opaque t :: SnakeBridge.Ref.t() @spec new(keyword()) :: {:ok, SnakeBridge.Ref.t()} | {:error, Snakepit.Error.t()} def new(opts \\ []) do SnakeBridge.Runtime.call_class(__MODULE__, :__init__, [], opts) end @spec _shuffle_and_sample( SnakeBridge.Ref.t(), String.t(), term(), term(), list(term()), keyword() ) :: {:ok, list(Dspy.Primitives.Example.t())} | {:error, Snakepit.Error.t()} def _shuffle_and_sample(ref, split, data, size, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method( ref, :_shuffle_and_sample, [split, data, size] ++ List.wrap(args), opts ) end @spec from_csv(SnakeBridge.Ref.t(), String.t(), list(term()), keyword()) :: {:ok, list(Dspy.Primitives.Example.t())} | {:error, Snakepit.Error.t()} def from_csv(ref, file_path, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :from_csv, [file_path] ++ List.wrap(args), opts) end @spec from_huggingface(SnakeBridge.Ref.t(), String.t(), list(term()), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def from_huggingface(ref, dataset_name, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method( ref, :from_huggingface, [dataset_name] ++ List.wrap(args), opts ) end @spec from_json(SnakeBridge.Ref.t(), String.t(), list(term()), keyword()) :: {:ok, list(Dspy.Primitives.Example.t())} | {:error, Snakepit.Error.t()} def from_json(ref, file_path, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :from_json, [file_path] ++ List.wrap(args), opts) end @spec from_pandas(SnakeBridge.Ref.t(), term(), list(term()), keyword()) :: {:ok, list(Dspy.Primitives.Example.t())} | {:error, Snakepit.Error.t()} def from_pandas(ref, df, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :from_pandas, [df] ++ List.wrap(args), opts) end @spec from_parquet(SnakeBridge.Ref.t(), String.t(), list(term()), keyword()) :: {:ok, list(Dspy.Primitives.Example.t())} | {:error, Snakepit.Error.t()} def from_parquet(ref, file_path, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :from_parquet, [file_path] ++ List.wrap(args), opts) end @spec from_rm(SnakeBridge.Ref.t(), integer(), list(String.t()), list(String.t()), keyword()) :: {:ok, list(Dspy.Primitives.Example.t())} | {:error, Snakepit.Error.t()} def from_rm(ref, num_samples, fields, input_keys, opts \\ []) do SnakeBridge.Runtime.call_method(ref, :from_rm, [num_samples, fields, input_keys], opts) end @spec prepare_by_seed(SnakeBridge.Ref.t(), list(term()), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def prepare_by_seed(ref, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :prepare_by_seed, [] ++ List.wrap(args), opts) end @spec reset_seeds(SnakeBridge.Ref.t(), list(term()), keyword()) :: {:ok, nil} | {:error, Snakepit.Error.t()} def reset_seeds(ref, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :reset_seeds, [] ++ List.wrap(args), opts) end @spec sample( SnakeBridge.Ref.t(), list(Dspy.Primitives.Example.t()), integer(), list(term()), keyword() ) :: {:ok, list(Dspy.Primitives.Example.t())} | {:error, Snakepit.Error.t()} def sample(ref, dataset, n, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :sample, [dataset, n] ++ List.wrap(args), opts) end @spec train_test_split( SnakeBridge.Ref.t(), list(Dspy.Primitives.Example.t()), list(term()), keyword() ) :: {:ok, term()} | {:error, Snakepit.Error.t()} def train_test_split(ref, dataset, args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_method(ref, :train_test_split, [dataset] ++ List.wrap(args), opts) end @spec dev(SnakeBridge.Ref.t()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def dev(ref) do SnakeBridge.Runtime.get_attr(ref, :dev) end @spec test(SnakeBridge.Ref.t()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def test(ref) do SnakeBridge.Runtime.get_attr(ref, :test) end @spec train(SnakeBridge.Ref.t()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def train(ref) do SnakeBridge.Runtime.get_attr(ref, :train) end end