Skip to content

Commit

Permalink
prefixes test
Browse files Browse the repository at this point in the history
  • Loading branch information
jessedrelick committed Sep 9, 2024
1 parent 799306f commit 490ae44
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 70 deletions.
70 changes: 0 additions & 70 deletions lib/agens.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
66 changes: 66 additions & 0 deletions lib/agens/prefixes.ex
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions test/agens/prefixes_test.exs
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 490ae44

Please sign in to comment.