From 490ae446e1b4ad8e3b31332d89d48f1fc763f21a Mon Sep 17 00:00:00 2001 From: Jesse Drelick Date: Mon, 9 Sep 2024 16:17:35 -0400 Subject: [PATCH] prefixes test --- lib/agens.ex | 70 ------------------------------------ lib/agens/prefixes.ex | 66 ++++++++++++++++++++++++++++++++++ test/agens/prefixes_test.exs | 36 +++++++++++++++++++ 3 files changed, 102 insertions(+), 70 deletions(-) create mode 100644 lib/agens/prefixes.ex create mode 100644 test/agens/prefixes_test.exs diff --git a/lib/agens.ex b/lib/agens.ex index f2da0c5..5d06cd9 100644 --- a/lib/agens.ex +++ b/lib/agens.ex @@ -24,76 +24,6 @@ defmodule Agens do - `Agens.Message` - used to facilitate communication between agents, jobs, and servings """ - defmodule Prefixes do - @moduledoc """ - The Prefixes struct represents configurable prompt prefixes used in Agens. - """ - - @type pair :: {heading :: String.t(), detail :: String.t()} - @type t :: %__MODULE__{ - prompt: pair(), - identity: pair(), - context: pair(), - constraints: pair(), - examples: pair(), - reflection: pair(), - instructions: pair(), - objective: pair(), - description: pair(), - input: pair() - } - - @enforce_keys [ - :prompt, - :identity, - :context, - :constraints, - :examples, - :reflection, - :instructions, - :objective, - :description, - :input - ] - defstruct [ - :prompt, - :identity, - :context, - :constraints, - :examples, - :reflection, - :instructions, - :objective, - :description, - :input - ] - - def default() do - %__MODULE__{ - prompt: - {"Agent", "You are a specialized agent with the following capabilities and expertise"}, - identity: - {"Identity", - "You are a specialized agent with the following capabilities and expertise"}, - context: {"Context", "The purpose or goal behind your tasks are to"}, - constraints: - {"Constraints", "You must operate with the following constraints or limitations"}, - examples: - {"Examples", "You should consider the following examples before returning results"}, - reflection: - {"Reflection", "You should reflect on the following factors before returning results"}, - instructions: - {"Tool Instructions", - "You should provide structured output for function calling based on the following instructions"}, - objective: {"Step Objective", "The objective of this step is to"}, - description: - {"Job Description", "This is part of multi-step job to achieve the following"}, - input: - {"Input", "The following is the actual input from the user, system or another agent"} - } - end - end - use DynamicSupervisor @doc false diff --git a/lib/agens/prefixes.ex b/lib/agens/prefixes.ex new file mode 100644 index 0000000..3e6cd4e --- /dev/null +++ b/lib/agens/prefixes.ex @@ -0,0 +1,66 @@ +defmodule Agens.Prefixes do + @moduledoc """ + The Prefixes struct represents configurable prompt prefixes used in Agens. + """ + + @type pair :: {heading :: String.t(), detail :: String.t()} + @type t :: %__MODULE__{ + prompt: pair(), + identity: pair(), + context: pair(), + constraints: pair(), + examples: pair(), + reflection: pair(), + instructions: pair(), + objective: pair(), + description: pair(), + input: pair() + } + + @enforce_keys [ + :prompt, + :identity, + :context, + :constraints, + :examples, + :reflection, + :instructions, + :objective, + :description, + :input + ] + defstruct [ + :prompt, + :identity, + :context, + :constraints, + :examples, + :reflection, + :instructions, + :objective, + :description, + :input + ] + + def default() do + %__MODULE__{ + prompt: + {"Agent", "You are a specialized agent with the following capabilities and expertise"}, + identity: + {"Identity", "You are a specialized agent with the following capabilities and expertise"}, + context: {"Context", "The purpose or goal behind your tasks are to"}, + constraints: + {"Constraints", "You must operate with the following constraints or limitations"}, + examples: + {"Examples", "You should consider the following examples before returning results"}, + reflection: + {"Reflection", "You should reflect on the following factors before returning results"}, + instructions: + {"Tool Instructions", + "You should provide structured output for function calling based on the following instructions"}, + objective: {"Step Objective", "The objective of this step is to"}, + description: {"Job Description", "This is part of multi-step job to achieve the following"}, + input: {"Input", "The following is the actual input from the user, system or another agent"} + } + end +end diff --git a/test/agens/prefixes_test.exs b/test/agens/prefixes_test.exs new file mode 100644 index 0000000..fec1846 --- /dev/null +++ b/test/agens/prefixes_test.exs @@ -0,0 +1,36 @@ +defmodule Agens.PrefixesTest do + use ExUnit.Case, async: false + + alias Agens.Prefixes + + describe "prefixes" do + test "default" do + assert %Prefixes{ + prompt: + {"Agent", + "You are a specialized agent with the following capabilities and expertise"}, + identity: + {"Identity", + "You are a specialized agent with the following capabilities and expertise"}, + context: {"Context", "The purpose or goal behind your tasks are to"}, + constraints: + {"Constraints", "You must operate with the following constraints or limitations"}, + examples: + {"Examples", + "You should consider the following examples before returning results"}, + reflection: + {"Reflection", + "You should reflect on the following factors before returning results"}, + instructions: + {"Tool Instructions", + "You should provide structured output for function calling based on the following instructions"}, + objective: {"Step Objective", "The objective of this step is to"}, + description: + {"Job Description", "This is part of multi-step job to achieve the following"}, + input: + {"Input", + "The following is the actual input from the user, system or another agent"} + } = Prefixes.default() + end + end +end