Skip to content

Commit 8091c1b

Browse files
authored
Merge branch 'main' into main
2 parents c74c140 + f61ca57 commit 8091c1b

34 files changed

+1014
-153
lines changed

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/source/conf.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
project = 'agentm-py'
10+
copyright = '2024, Steven Ickman, Jochen Schultz'
11+
author = 'Steven Ickman, Jochen Schultz'
12+
release = '0.1'
13+
14+
# -- General configuration ---------------------------------------------------
15+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
16+
17+
extensions = []
18+
19+
templates_path = ['_templates']
20+
exclude_patterns = []
21+
22+
23+
24+
# -- Options for HTML output -------------------------------------------------
25+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
26+
27+
html_theme = 'alabaster'
28+
html_static_path = ['_static']

docs/source/index.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. agentm-py documentation master file, created by
2+
sphinx-quickstart on Sat Sep 21 01:49:41 2024.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
agentm-py documentation
7+
=======================
8+
9+
Add your content using ``reStructuredText`` syntax. See the
10+
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
11+
documentation for details.
12+
13+
14+
.. toctree::
15+
:maxdepth: 2
16+
:caption: Contents:
17+

examples/binary_classify_list_example.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
import asyncio
2-
from core.binary_classify_list_agent import BinaryClassifyListAgent
2+
from core.binary_classify_list_agent import BinaryClassifyListAgent, BinaryClassifyListInput
33

44
async def run_binary_classify_list_example():
5-
items_to_classify = ['Apple', 'Chocolate', 'Carrot']
6-
criteria = 'Classify each item as either healthy (true) or unhealthy (false)'
7-
agent = BinaryClassifyListAgent(list_to_classify=items_to_classify, criteria=criteria)
5+
input_data = BinaryClassifyListInput(
6+
list_to_classify=['Apple', 'Chocolate', 'Carrot'],
7+
criteria='Classify each item as either healthy (true) or unhealthy (false)',
8+
max_tokens=1000,
9+
temperature=0.0
10+
)
11+
12+
agent = BinaryClassifyListAgent(input_data)
813
classified_items = await agent.classify_list()
914

10-
print("Original list:", items_to_classify)
15+
print("Original list:", input_data.list_to_classify)
1116
print("Binary classified results:", classified_items)
1217

1318
if __name__ == "__main__":

examples/chain_of_thought_example.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import asyncio
2-
from core.chain_of_thought_agent import ChainOfThoughtAgent
2+
from core.chain_of_thought_agent import ChainOfThoughtAgent, ChainOfThoughtInput
33

44
async def run_chain_of_thought_example():
5-
question = 'What is the square root of 144?'
6-
agent = ChainOfThoughtAgent(question=question)
5+
input_data = ChainOfThoughtInput(
6+
question='What is the square root of 144?',
7+
max_tokens=1000,
8+
temperature=0.0
9+
)
10+
11+
agent = ChainOfThoughtAgent(input_data)
712
result = await agent.chain_of_thought()
813

9-
print("Question:", question)
14+
print("Question:", input_data.question)
1015
print("Chain of Thought Reasoning:", result)
1116

1217
if __name__ == "__main__":

examples/classify_list_example.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import asyncio
2-
from core.classify_list_agent import ClassifyListAgent
2+
from core.classify_list_agent import ClassifyListAgent, ClassifyListInput
33

44
async def run_classify_list_example():
5-
items_to_classify = ['Apple', 'Chocolate', 'Carrot']
6-
classification_criteria = 'Classify each item as healthy or unhealthy snack'
7-
agent = ClassifyListAgent(list_to_classify=items_to_classify, classification_criteria=classification_criteria)
8-
classified_items = await agent.classify_list()
5+
input_data = ClassifyListInput(
6+
list_to_classify=["Apple", "Banana", "Carrot"],
7+
classification_criteria="Classify each item as a fruit or vegetable.",
8+
max_tokens=1000
9+
)
10+
11+
agent = ClassifyListAgent(input_data)
12+
classifications = await agent.classify_list()
913

10-
print("Original list:", items_to_classify)
11-
print("Classified results:", classified_items)
14+
print("Original list:", input_data.list_to_classify)
15+
print("Classified results:", classifications)
1216

1317
if __name__ == "__main__":
14-
asyncio.run(run_classify_list_example())
18+
asyncio.run(run_classify_list_example())

examples/filter_list_example.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
import asyncio
2-
from core.filter_list_agent import FilterListAgent
2+
from core.filter_list_agent import FilterListAgent, FilterListInput
33

44
async def run_filter_list_example():
5-
goal = "Remove items that are unhealthy snacks."
6-
items_to_filter = [
7-
"Apple",
8-
"Chocolate bar",
9-
"Carrot",
10-
"Chips",
11-
"Orange"
12-
]
13-
14-
agent = FilterListAgent(goal=goal, items_to_filter=items_to_filter)
5+
input_data = FilterListInput(
6+
goal="Remove items that are unhealthy snacks.",
7+
items_to_filter=[
8+
"Apple",
9+
"Chocolate bar",
10+
"Carrot",
11+
"Chips",
12+
"Orange"
13+
],
14+
max_tokens=500,
15+
temperature=0.0
16+
)
17+
18+
agent = FilterListAgent(input_data)
1519
filtered_results = await agent.filter()
1620

17-
print("Original list:", items_to_filter)
21+
print("Original list:", input_data.items_to_filter)
1822
print("Filtered results:")
1923
for result in filtered_results:
2024
print(result)
2125

2226
if __name__ == "__main__":
23-
asyncio.run(run_filter_list_example())
27+
asyncio.run(run_filter_list_example())

examples/generate_object_example.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import asyncio
2-
from core.generate_object_agent import GenerateObjectAgent
2+
from core.generate_object_agent import GenerateObjectAgent, ObjectGenerationInput
33

44
async def run_generate_object_example():
5-
description = "A machine that can sort fruits."
6-
goal = "Generate a high-level design of the machine."
7-
agent = GenerateObjectAgent(object_description=description, goal=goal)
5+
input_data = ObjectGenerationInput(
6+
object_description="A machine that can sort fruits.",
7+
goal="Generate a high-level design of the machine.",
8+
max_tokens=1000
9+
)
10+
11+
agent = GenerateObjectAgent(input_data)
812
generated_object = await agent.generate_object()
913

10-
print("Object description:", description)
14+
print("Object description:", input_data.object_description)
1115
print("Generated object:", generated_object)
1216

1317
if __name__ == "__main__":
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import asyncio
2-
from core.grounded_answer_agent import GroundedAnswerAgent
2+
from core.grounded_answer_agent import GroundedAnswerAgent, GroundedAnswerInput
33

44
async def run_grounded_answer_example():
5-
question = "What is the capital of France?"
6-
context = "France is a country in Western Europe. Paris is its capital and largest city."
7-
instructions = "Ensure the answer is grounded only in the provided context."
8-
agent = GroundedAnswerAgent(question=question, context=context, instructions=instructions)
9-
result = await agent.answer()
5+
input_data = GroundedAnswerInput(
6+
question="What is the capital of France?",
7+
context="France is a country in Western Europe known for its wine and cuisine. The capital is a major global center for art, fashion, and culture.",
8+
instructions="",
9+
max_tokens=1000
10+
)
11+
12+
agent = GroundedAnswerAgent(input_data)
13+
answer = await agent.answer()
1014

11-
print("Question:", question)
12-
print("Result:", result)
15+
print("Question:", input_data.question)
16+
print("Answer:", answer)
1317

1418
if __name__ == "__main__":
15-
asyncio.run(run_grounded_answer_example())
19+
asyncio.run(run_grounded_answer_example())

0 commit comments

Comments
 (0)