forked from Stevenic/agentm-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from debuggerone/do_documentation
Do documentation
- Loading branch information
Showing
34 changed files
with
1,012 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = source | ||
BUILDDIR = build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=source | ||
set BUILDDIR=build | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.https://www.sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# For the full list of built-in configuration values, see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Project information ----------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
||
project = 'agentm-py' | ||
copyright = '2024, Steven Ickman, Jochen Schultz' | ||
author = 'Steven Ickman, Jochen Schultz' | ||
release = '0.1' | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = [] | ||
|
||
templates_path = ['_templates'] | ||
exclude_patterns = [] | ||
|
||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
html_theme = 'alabaster' | ||
html_static_path = ['_static'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.. agentm-py documentation master file, created by | ||
sphinx-quickstart on Sat Sep 21 01:49:41 2024. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
agentm-py documentation | ||
======================= | ||
|
||
Add your content using ``reStructuredText`` syntax. See the | ||
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_ | ||
documentation for details. | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import asyncio | ||
from core.classify_list_agent import ClassifyListAgent | ||
from core.classify_list_agent import ClassifyListAgent, ClassifyListInput | ||
|
||
async def run_classify_list_example(): | ||
items_to_classify = ['Apple', 'Chocolate', 'Carrot'] | ||
classification_criteria = 'Classify each item as healthy or unhealthy snack' | ||
agent = ClassifyListAgent(list_to_classify=items_to_classify, classification_criteria=classification_criteria) | ||
classified_items = await agent.classify_list() | ||
input_data = ClassifyListInput( | ||
list_to_classify=["Apple", "Banana", "Carrot"], | ||
classification_criteria="Classify each item as a fruit or vegetable.", | ||
max_tokens=1000 | ||
) | ||
|
||
agent = ClassifyListAgent(input_data) | ||
classifications = await agent.classify_list() | ||
|
||
print("Original list:", items_to_classify) | ||
print("Classified results:", classified_items) | ||
print("Original list:", input_data.list_to_classify) | ||
print("Classified results:", classifications) | ||
|
||
if __name__ == "__main__": | ||
asyncio.run(run_classify_list_example()) | ||
asyncio.run(run_classify_list_example()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
import asyncio | ||
from core.filter_list_agent import FilterListAgent | ||
from core.filter_list_agent import FilterListAgent, FilterListInput | ||
|
||
async def run_filter_list_example(): | ||
goal = "Remove items that are unhealthy snacks." | ||
items_to_filter = [ | ||
"Apple", | ||
"Chocolate bar", | ||
"Carrot", | ||
"Chips", | ||
"Orange" | ||
] | ||
|
||
agent = FilterListAgent(goal=goal, items_to_filter=items_to_filter) | ||
input_data = FilterListInput( | ||
goal="Remove items that are unhealthy snacks.", | ||
items_to_filter=[ | ||
"Apple", | ||
"Chocolate bar", | ||
"Carrot", | ||
"Chips", | ||
"Orange" | ||
], | ||
max_tokens=500, | ||
temperature=0.0 | ||
) | ||
|
||
agent = FilterListAgent(input_data) | ||
filtered_results = await agent.filter() | ||
|
||
print("Original list:", items_to_filter) | ||
print("Original list:", input_data.items_to_filter) | ||
print("Filtered results:") | ||
for result in filtered_results: | ||
print(result) | ||
|
||
if __name__ == "__main__": | ||
asyncio.run(run_filter_list_example()) | ||
asyncio.run(run_filter_list_example()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
import asyncio | ||
from core.grounded_answer_agent import GroundedAnswerAgent | ||
from core.grounded_answer_agent import GroundedAnswerAgent, GroundedAnswerInput | ||
|
||
async def run_grounded_answer_example(): | ||
question = "What is the capital of France?" | ||
context = "France is a country in Western Europe. Paris is its capital and largest city." | ||
instructions = "Ensure the answer is grounded only in the provided context." | ||
agent = GroundedAnswerAgent(question=question, context=context, instructions=instructions) | ||
result = await agent.answer() | ||
input_data = GroundedAnswerInput( | ||
question="What is the capital of France?", | ||
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.", | ||
instructions="", | ||
max_tokens=1000 | ||
) | ||
|
||
agent = GroundedAnswerAgent(input_data) | ||
answer = await agent.answer() | ||
|
||
print("Question:", question) | ||
print("Result:", result) | ||
print("Question:", input_data.question) | ||
print("Answer:", answer) | ||
|
||
if __name__ == "__main__": | ||
asyncio.run(run_grounded_answer_example()) | ||
asyncio.run(run_grounded_answer_example()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import asyncio | ||
from core.reduce_list_agent import ReduceListAgent | ||
from core.reduce_list_agent import ReduceListAgent, ReduceListInput | ||
|
||
async def run_reduce_list_example(): | ||
items_to_reduce = ['Banana', 'Apple', 'Carrot'] | ||
reduction_goal = 'Reduce these items to a single word representing their nutritional value' | ||
agent = ReduceListAgent(list_to_reduce=items_to_reduce, reduction_goal=reduction_goal) | ||
input_data = ReduceListInput( | ||
list_to_reduce=["Apple", "Banana", "Carrot"], | ||
reduction_goal="Reduce each item to its first letter.", | ||
max_tokens=1000 | ||
) | ||
|
||
agent = ReduceListAgent(input_data) | ||
reduced_items = await agent.reduce_list() | ||
|
||
print("Original list:", items_to_reduce) | ||
print("Original list:", input_data.list_to_reduce) | ||
print("Reduced results:", reduced_items) | ||
|
||
if __name__ == "__main__": | ||
asyncio.run(run_reduce_list_example()) | ||
asyncio.run(run_reduce_list_example()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,7 @@ anyio | |
trio | ||
openai | ||
jsonschema | ||
sphinx | ||
sphinx-rtd-theme | ||
myst-parser | ||
pydantic |
Oops, something went wrong.