Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yet Another Rigorous, Robust Refactor (YARRR) #256

Merged
merged 400 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
400 commits
Select commit Hold shift + click to select a range
73a7549
.
alckasoc Aug 18, 2024
d8aa789
fix
alckasoc Aug 18, 2024
449dbdb
edit
alckasoc Aug 18, 2024
eaffed0
edit
alckasoc Aug 18, 2024
a000102
edit
alckasoc Aug 18, 2024
643558b
test sim node
alckasoc Aug 18, 2024
b555f2b
done with test math
alckasoc Aug 18, 2024
4082263
simplify fn
alckasoc Aug 18, 2024
bd51512
test gen children nodes
alckasoc Aug 18, 2024
f1f9b46
fix
alckasoc Aug 18, 2024
84381b2
test eval
alckasoc Aug 18, 2024
d7d536e
test sim
alckasoc Aug 18, 2024
bd1aac1
finish test code
alckasoc Aug 18, 2024
9f311af
done with agent and factory
alckasoc Aug 18, 2024
53e88fc
al
alckasoc Aug 18, 2024
4a4ba5d
al; docs
alckasoc Aug 18, 2024
d2e6b80
del tmp
alckasoc Aug 18, 2024
cacc8de
edit react
alckasoc Aug 18, 2024
6d6750b
fix unit tests for react
alckasoc Aug 18, 2024
4e0d125
fix imports and unit tests and metrics.py in utils
alckasoc Aug 18, 2024
3735e80
al
alckasoc Aug 18, 2024
b5bc39b
move ref fn
alckasoc Aug 18, 2024
9d6883f
.
alckasoc Aug 18, 2024
29c5568
.
alckasoc Aug 18, 2024
808b53c
fill in general
alckasoc Aug 19, 2024
7d43ff6
bruh
alckasoc Aug 19, 2024
61405c1
edit
alckasoc Aug 19, 2024
ddc9aa0
fi docs
alckasoc Aug 19, 2024
4c86a36
al
alckasoc Aug 19, 2024
80ab0bb
green light ref cot qa
alckasoc Aug 19, 2024
2320781
math n code ref cot done
alckasoc Aug 19, 2024
12f22d3
donee with test general
alckasoc Aug 19, 2024
ad2a9ff
2 down for test qa
alckasoc Aug 19, 2024
d73e44e
done test qa
alckasoc Aug 19, 2024
e7dd56a
finished test qa
alckasoc Aug 19, 2024
41620e3
.
alckasoc Aug 19, 2024
e47b74a
.
alckasoc Aug 19, 2024
952fd7c
unit tests reflexion cot
emmalin-7 Aug 19, 2024
2d798e5
test gen for test codedd ref cot
alckasoc Aug 19, 2024
1f96a23
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 19, 2024
03a7d31
test code reflexion cot
emmalin-7 Aug 19, 2024
ce8d902
test code test func reflexion
emmalin-7 Aug 19, 2024
7253b24
.
alckasoc Aug 19, 2024
7b2b55d
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 19, 2024
57ffb57
starting reflexion react
alckasoc Aug 20, 2024
4e335b9
bruh
alckasoc Aug 20, 2024
0ec9557
ok
alckasoc Aug 20, 2024
93187cf
acc metrics
alckasoc Aug 20, 2024
10ec604
ok
alckasoc Aug 20, 2024
debd61f
al
alckasoc Aug 20, 2024
0cad3ea
.
alckasoc Aug 21, 2024
26b3506
.
alckasoc Aug 21, 2024
e6d3b2a
unit tests
emmalin-7 Aug 21, 2024
1eaa52f
tmp nb
alckasoc Aug 21, 2024
6d37b10
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 21, 2024
1e6fdc0
.
alckasoc Aug 21, 2024
2373b05
scaffold
alckasoc Aug 21, 2024
f1553a7
test general
emmalin-7 Aug 21, 2024
98c9b7e
ref react math almost ready to goneeds to test
alckasoc Aug 21, 2024
7726662
test qa
emmalin-7 Aug 21, 2024
9f4f771
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
emmalin-7 Aug 21, 2024
1c6c008
.
alckasoc Aug 21, 2024
8c8f2f9
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 21, 2024
490d88b
test math
emmalin-7 Aug 21, 2024
5c7d418
.
alckasoc Aug 21, 2024
d45d67d
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 21, 2024
f60c4a6
.
alckasoc Aug 21, 2024
1510dd9
fix
alckasoc Aug 21, 2024
dc6a6cb
.
alckasoc Aug 21, 2024
a170f9d
fix
alckasoc Aug 21, 2024
ca0357b
al
alckasoc Aug 21, 2024
20fdcd8
done with test math
alckasoc Aug 21, 2024
5541638
WHY ISNT THIS PASSING
alckasoc Aug 21, 2024
8711868
WHY ISNT IT PASSING
alckasoc Aug 21, 2024
6c18e0a
.
alckasoc Aug 22, 2024
17f5726
very weird issue with pytest and safe execute
alckasoc Aug 22, 2024
1466d20
ok
alckasoc Aug 22, 2024
2176cd2
FINISHED TEST CODE
alckasoc Aug 22, 2024
6d98f5e
del
alckasoc Aug 22, 2024
1f9f3b2
del
alckasoc Aug 22, 2024
3a28245
lint
alckasoc Aug 22, 2024
d231f6c
update nb
alckasoc Aug 22, 2024
f70178b
rename prompt metrics to info
alckasoc Aug 22, 2024
8bdda5b
rename
alckasoc Aug 22, 2024
8ce4b43
good luck
alckasoc Aug 22, 2024
2fec6dd
test_llm
emmalin-7 Aug 22, 2024
2839603
react qa
alckasoc Aug 22, 2024
5b8c8b0
unit tests react
emmalin-7 Aug 22, 2024
4fbe97b
done test gena ct
alckasoc Aug 23, 2024
f6fc1e9
react unit tests
emmalin-7 Aug 23, 2024
239f668
HOLY (!@)$*
alckasoc Aug 23, 2024
f5604d9
functional lats
emmalin-7 Aug 23, 2024
84a511f
OH MY GOD OH MY GOD OH MY GOD OH MY GOD OH MY GOD OH MY GOD OH MY GOD…
alckasoc Aug 23, 2024
5069081
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 23, 2024
55212e4
test_qa
emmalin-7 Aug 23, 2024
a6d460e
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
emmalin-7 Aug 23, 2024
af451d2
test qa simulate node
emmalin-7 Aug 23, 2024
a2485d0
finish 2 more unit tests
alckasoc Aug 23, 2024
0986c98
maybe its done?
alckasoc Aug 23, 2024
2573867
bruhwhy tf is this not passing?
alckasoc Aug 23, 2024
2325956
GOT IT TO PASS LES GO
alckasoc Aug 23, 2024
bdba8c1
al
alckasoc Aug 23, 2024
3b5d909
fixed some stuff idk
alckasoc Aug 23, 2024
0b2e7fe
done with test math
alckasoc Aug 23, 2024
206bab1
al
alckasoc Aug 23, 2024
0bea8f6
updated code
alckasoc Aug 23, 2024
71ae8b0
DONE WITH TEST CODE
alckasoc Aug 23, 2024
3719d6a
lats test agent
alckasoc Aug 23, 2024
153d614
nice
alckasoc Aug 23, 2024
63e342f
del
alckasoc Aug 23, 2024
2c846ad
ok
alckasoc Aug 23, 2024
3a6d309
done with qa math code ref
alckasoc Aug 23, 2024
6af0042
update abase
alckasoc Aug 23, 2024
9ed5314
functional reflexion unit tests
emmalin-7 Aug 23, 2024
c4f411b
test reflect reflexions unit tsts
emmalin-7 Aug 23, 2024
2b9aec7
test qa done for ref
alckasoc Aug 23, 2024
a864240
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 23, 2024
529bcaf
agent fiel cleaned up
alckasoc Aug 23, 2024
ccfffa0
test math reflexion
emmalin-7 Aug 23, 2024
9054d12
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
emmalin-7 Aug 23, 2024
0b872d7
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 23, 2024
4caf82f
done test agent ref
alckasoc Aug 23, 2024
f1ee47c
test code reflexion
emmalin-7 Aug 23, 2024
66bce84
not done
alckasoc Aug 23, 2024
edcf096
expel
emmalin-7 Aug 23, 2024
35bedcb
.
alckasoc Aug 23, 2024
f2a4023
test_categorize_experiences
tedasdf Aug 23, 2024
229e157
.
alckasoc Aug 23, 2024
9faa37c
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 23, 2024
0a18c2f
update add memories
tedasdf Aug 23, 2024
aaee40f
update update
tedasdf Aug 23, 2024
bfad2d9
update memory.py
tedasdf Aug 24, 2024
c21aa5b
test expel
tedasdf Aug 24, 2024
47a069c
update functional test
tedasdf Aug 24, 2024
1fe258c
.
alckasoc Aug 24, 2024
4216e46
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 24, 2024
27d4ae2
.refactor expel gen strat
alckasoc Aug 24, 2024
2e91a57
nearly there
alckasoc Aug 24, 2024
a776221
djhk
tedasdf Aug 24, 2024
bcddca7
some changes
alckasoc Aug 24, 2024
220f769
.
alckasoc Aug 24, 2024
3668bc7
fix acc metric
alckasoc Aug 24, 2024
c1060dc
fix acc metric again
alckasoc Aug 24, 2024
a0cbde6
asdf
tedasdf Aug 24, 2024
2739df8
bruh
alckasoc Aug 24, 2024
1912e65
.
alckasoc Aug 24, 2024
eeef13a
.
alckasoc Aug 24, 2024
1b6588b
3456
tedasdf Aug 24, 2024
d8e3598
Merge branch 'refactor' of https://github.com/agential-ai/agential in…
tedasdf Aug 24, 2024
f216d6f
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 24, 2024
719569b
some pytest
tedasdf Aug 24, 2024
b936b65
Merge branch 'refactor' of https://github.com/agential-ai/agential in…
tedasdf Aug 24, 2024
e7ac360
pytest expel please aessadfasdfdkjfbflnfiualiqvbelrb
tedasdf Aug 24, 2024
2718d5c
make auto_lint
tedasdf Aug 24, 2024
9c618d3
.
alckasoc Aug 24, 2024
65e46b5
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 24, 2024
ebfe0c1
pass test general
alckasoc Aug 24, 2024
f5ae1a8
fix
alckasoc Aug 24, 2024
ef00fd4
edit
alckasoc Aug 24, 2024
528ba5b
slight refactor of lats math; modify gen act query
alckasoc Aug 24, 2024
ba7a4a0
done with lats
alckasoc Aug 24, 2024
3439dfe
fin react
alckasoc Aug 24, 2024
3f18cf3
ref cot done
alckasoc Aug 24, 2024
5c909ac
done ref react math
alckasoc Aug 24, 2024
a30e6db
push
tedasdf Aug 24, 2024
ad2426e
al
alckasoc Aug 24, 2024
81c2129
.
alckasoc Aug 24, 2024
f9b747c
tmp nb
alckasoc Aug 25, 2024
d8e2069
some push
tedasdf Aug 25, 2024
2e8c97f
push a notebook
tedasdf Aug 25, 2024
3c88644
expel/temp.ipnb
tedasdf Aug 25, 2024
9fc1d94
1 more nb test to go
alckasoc Aug 25, 2024
e2ee31b
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 25, 2024
327d4f6
expel temp
tedasdf Aug 25, 2024
45d6b41
Merge branch 'refactor' of https://github.com/agential-ai/agential in…
tedasdf Aug 25, 2024
32de11a
temp.ipynb/expel
tedasdf Aug 25, 2024
753370d
refctor expel fact
alckasoc Aug 25, 2024
614b125
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 25, 2024
9cb037b
bruh
alckasoc Aug 25, 2024
d2cf9c5
al
alckasoc Aug 25, 2024
f355b10
.
alckasoc Aug 25, 2024
ba8be34
.
alckasoc Aug 25, 2024
eac7583
aewr
tedasdf Aug 25, 2024
e2e9fa2
nb
alckasoc Aug 25, 2024
719ff43
ok some progress
alckasoc Aug 25, 2024
8753e59
init test
alckasoc Aug 25, 2024
519230e
edit qa
alckasoc Aug 25, 2024
f61fb3a
anotha one
alckasoc Aug 25, 2024
6c741ea
bro
alckasoc Aug 25, 2024
883cf0b
anotha one
alckasoc Aug 25, 2024
4b3c1ab
al
alckasoc Aug 25, 2024
8018885
BAM
alckasoc Aug 25, 2024
cf91592
mini bam
alckasoc Aug 25, 2024
9d380dc
test qa for critic done big BAM
alckasoc Aug 25, 2024
fe3bf95
OOOOOOO
alckasoc Aug 25, 2024
401fc0d
math strat for critic done; needs testing
alckasoc Aug 25, 2024
34f0341
anotha unit test
alckasoc Aug 26, 2024
d5c8739
.
alckasoc Aug 26, 2024
9b6942c
done test math
alckasoc Aug 26, 2024
ace8b24
finish critic test code
alckasoc Aug 26, 2024
806e47e
ok
alckasoc Aug 26, 2024
20f2eaa
remove factory
alckasoc Aug 26, 2024
1728b49
del test fac
alckasoc Aug 26, 2024
313bedb
DOnE WITH CRITIC
alckasoc Aug 26, 2024
b648509
udpaet critic nb
alckasoc Aug 26, 2024
c69c993
ok
alckasoc Aug 26, 2024
fb1fb8c
olk
alckasoc Aug 26, 2024
0675759
SR qa done
alckasoc Aug 26, 2024
6a14d65
.
alckasoc Aug 26, 2024
9018a6e
.
alckasoc Aug 26, 2024
2661e98
.
alckasoc Aug 26, 2024
887c735
done SR math
alckasoc Aug 26, 2024
6b10f1e
done with SR code
alckasoc Aug 26, 2024
7d444a2
test gen sr
emmalin-7 Aug 26, 2024
ef94d64
.
alckasoc Aug 26, 2024
d7bdf76
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 26, 2024
58b57c8
edit
alckasoc Aug 26, 2024
2bb8a38
.
alckasoc Aug 26, 2024
fae3ccd
teats qa sr
emmalin-7 Aug 26, 2024
722c49e
sr test math
emmalin-7 Aug 26, 2024
45187e2
fix
alckasoc Aug 26, 2024
acd75d3
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 26, 2024
1cbcbff
fix SR math
alckasoc Aug 26, 2024
473e879
change promtp SR
alckasoc Aug 26, 2024
51bb70b
test code sr
emmalin-7 Aug 26, 2024
58f7749
added SR test fn
alckasoc Aug 26, 2024
aa8ccb7
test acc metric
alckasoc Aug 26, 2024
b466cea
.
alckasoc Aug 28, 2024
d138d01
hanged sr
emmalin-7 Aug 28, 2024
3b6d0a4
test code and agent factory SR
alckasoc Aug 28, 2024
cc0a73c
Merge branch 'refactor' of https://github.com/alckasoc/agential into …
alckasoc Aug 28, 2024
446776d
done with agent
alckasoc Aug 28, 2024
04c4527
test agent not done
alckasoc Aug 28, 2024
5c49858
test agent gen
emmalin-7 Aug 28, 2024
4936c0e
.
alckasoc Aug 28, 2024
afaa87a
DONE WITH ALL UNIT TESTS WOOOOOO
alckasoc Aug 28, 2024
f127cd2
al
alckasoc Aug 28, 2024
27d2677
al
alckasoc Aug 28, 2024
08663d8
bruh
alckasoc Aug 28, 2024
a36049d
remove newline in readme very important
alckasoc Aug 28, 2024
bb466fe
changes
alckasoc Aug 28, 2024
1d0cfd5
.
alckasoc Aug 28, 2024
4ef15e3
banner light/dark
alckasoc Aug 28, 2024
cc4306b
oh my god this looks so goood!!!!!!!!
alckasoc Aug 28, 2024
dc33cec
betty white gets tackled
alckasoc Aug 28, 2024
bddb971
font size change hungry for pie
alckasoc Aug 28, 2024
ff0e1a7
please work
alckasoc Aug 28, 2024
85f82b9
update project org tree
alckasoc Aug 28, 2024
b6fe517
update readme
alckasoc Aug 28, 2024
02c8dc2
COMMIT #400 WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO…
alckasoc Aug 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 50 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@

# Agential
<h3 align="center">
<img
src="https://raw.githubusercontent.com/agential-ai/.github/main/profile/banner_dark.svg#gh-dark-mode-only"
/>
<img
src="https://raw.githubusercontent.com/agential-ai/.github/main/profile/banner_light.svg#gh-light-mode-only"
/>
</h3>

[![codecov](https://codecov.io/gh/agential-ai/agential/branch/main/graph/badge.svg)](https://codecov.io/gh/agential-ai/agential)


## Features

<h1 align="center">Language agent research made easy.<h5 align="center"><a href="https://www.youtube.com/watch?v=5syJjBQ_k6o">You're definitely not you when you're hungry for research.</a></h5></h1>

Our primary goal is to provide easy-to-use and clean implementations of popular LLM-based agent methods: an encyclopedia! This library is one of our contributions for our research project empirically surveying and investigating the performance of these methods across a diverse set of reasoning/decision-making tasks. Learn more about this [here](https://equatorial-jobaria-9ad.notion.site/Project-Lifecycle-Management-70d65e9a76eb4c86b6aed007f717aa41?pvs=4)!

- Easy-to-Use Interface: Provides intuitive and user-friendly functions for rapid prototyping and development.
<h3 align="center">

- Clean Functions: Offers clean and well-structured functions, promoting readability and maintainability of code.

- Modularized Implementations: Includes modularized implementations of popular LLM-based agents and agent-related methods, allowing users to leverage cutting-edge innovations from the literature.
[![codecov](https://codecov.io/gh/agential-ai/agential/branch/main/graph/badge.svg)](https://codecov.io/gh/agential-ai/agential)
</h3>

**Agential provides clear implementations of popular LLM-based agents across a variety of reasoning/decision-making and language agent benchmarks, making it easy for researchers to evaluate and compare different agents.**

## Getting Started

Expand All @@ -27,10 +30,13 @@ pip install agential
Next, let's query the `ReActAgent`!

```python
from agential.llm.llm import LLM
from agential.cog.react.agent import ReActAgent

question = 'Who was once considered the best kick boxer in the world, however he has been involved in a number of controversies relating to his "unsportsmanlike conducts" in the sport and crimes of violence outside of the ring?'

llm = ChatOpenAI(openai_api_key="YOUR_API_KEY")
agent = ReActAgent(llm=llm)
llm = LLM("gpt-3.5-turbo")
agent = ReActAgent(llm=llm, benchmark="hotpotqa")
out = agent.generate(question=question)
```

Expand All @@ -39,45 +45,48 @@ out = agent.generate(question=question)

------------

β”œβ”€β”€ agential <- Source code for this project.
β”œβ”€β”€ agential <- Source code for this project.
β”‚Β Β  β”œβ”€β”€ cog
β”‚ β”‚ β”œβ”€β”€ agent <- Model/agent-related modules.
β”‚ β”‚ β”‚
β”‚ β”‚ β”œβ”€β”€ eval <- Agent core modules.
β”‚ β”‚ β”‚
β”‚ β”‚ β”œβ”€β”€ functional
β”‚ β”‚ β”‚
β”‚ β”‚ β”œβ”€β”€ modules
β”‚ β”‚ β”‚ β”œβ”€β”€ memory <- Memory-related modules.
β”‚ β”‚ β”‚ β”œβ”€β”€ plan <- Planning-related modules.
β”‚ β”‚ β”‚ β”œβ”€β”€ reflect <- Reflecting-related modules.
β”‚ β”‚ β”‚ └── score <- Scoring-related modules.
β”‚ β”‚ β”‚
β”‚ β”‚ β”œβ”€β”€ persona
β”‚ β”‚ β”‚
β”‚ β”‚ └── prompts
β”‚ β”‚ β”œβ”€β”€ agent <- Model/agent-related modules.
β”‚ β”‚ β”‚ β”œβ”€β”€ strategies <- Strategies encapsulate agent logic for each benchmark/benchmark type.
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ base.py
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ qa.py
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ math.py
β”‚ β”‚ β”‚ β”‚ └── code.py
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ β”œβ”€β”€ agent.py <- Agent class responsible for selecting the correct strategy, prompts/few-shots, and generating responses.
β”‚ β”‚ β”‚ β”œβ”€β”€ functional.py <- Functional methods for agent. The lowest level of abstraction.
β”‚ β”‚ β”‚ β”œβ”€β”€ output.py <- Output class responsible for formatting the response from the agents.
β”‚ β”‚ β”‚ β”œβ”€β”€ prompts.py <- Prompt templates.
β”‚ β”‚ β”‚ └── <modules>.py <- Any additional modules you may have for the strategies. Agnostic to benchmarks/benchmark-types.
β”‚ β”‚
β”‚ └── utils <- Utility methods.
β”‚Β Β  β”œβ”€β”€ eval <- Evaluation-related modules.
β”‚ β”‚
β”‚Β Β  β”œβ”€β”€ llm <- LLM class.
β”‚ β”‚
β”‚ └── utils <- Utility methods.
β”‚
β”œβ”€β”€ docs <- An mkdocs project.
β”œβ”€β”€ docs <- An mkdocs project.
β”‚
β”œβ”€β”€ models <- Trained and serialized models, model predictions,
β”‚ or model summaries.
β”‚
β”œβ”€β”€ notebooks <- Jupyter notebooks. Naming convention is a number
β”‚ (for ordering), the creator's initials, and a short `-` delimited β”‚ description, e.g. `1.0-jqp-initial-data-exploration`.
β”œβ”€β”€ notebooks <- Jupyter notebooks. Naming convention is a number
β”‚ (for ordering), the creator's initials, and a short `-` delimited β”‚ description, e.g. `1.0-jqp-initial-data-exploration`.
β”‚
β”œβ”€β”€ references <- Data dictionaries, manuals, and all other explanatory materials.
β”‚
β”œβ”€β”€ references <- Data dictionaries, manuals, and all other explanatory materials.
β”œβ”€β”€ reports <- Generated analysis as HTML, PDF, LaTeX, etc.
β”‚Β Β  └── figures <- Generated graphics and figures to be used in reporting.
β”‚
β”œβ”€β”€ reports <- Generated analysis as HTML, PDF, LaTeX, etc.
β”‚Β Β  └── figures <- Generated graphics and figures to be used in reporting.
β”‚
└── tests <- Tests.
└── tests <- Tests.

---------

## πŸ™ Acknowledgement

## Contributing
## πŸ˜€ Contributing

If you want to contribute, please check the [contributing.md](https://github.com/alckasoc/agential/blob/main/CONTRIBUTING.md) for guidelines!
Please check out the [project document timeline](https://equatorial-jobaria-9ad.notion.site/Project-Lifecycle-Management-70d65e9a76eb4c86b6aed007f717aa41?pvs=4) on Notion and reach out to us if you have any questions!

## πŸ˜Άβ€πŸŒ«οΈ Contact Us!

If you have any questions or suggestions, please feel free to reach out to [email protected]!
85 changes: 77 additions & 8 deletions agential/cog/base/agent.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,87 @@
"""Base agent interface class."""

from abc import ABC, abstractmethod
from typing import Any
from typing import Any, Dict

from agential.cog.base.output import BaseOutput
from agential.cog.base.strategies import BaseStrategy
from agential.llm.llm import BaseLLM


class BaseAgent(ABC):
"""Base agent class providing a general interface for agent operations."""
"""Base agent class providing a general interface for agent operations.

Parameters:
llm (BaseLLM): An instance of a language model used for generating initial answers
and critiques.
benchmark (str): The benchmark.
testing (bool, optional): Whether to run in testing mode. Defaults to False.
"""

def __init__(
self,
llm: BaseLLM,
benchmark: str,
testing: bool = False,
) -> None:
"""Initialization."""
super().__init__()
self.llm = llm
self.benchmark = benchmark
self.testing = testing

@abstractmethod
def reset(self, *args: Any, **kwargs: Any) -> Any:
"""Resets the agent's state."""
raise NotImplementedError("Reset method not implemented.")
def get_fewshots(
self, benchmark: str, fewshot_type: str, **kwargs: Any
) -> Dict[str, str]:
"""Retrieve few-shot examples based on the benchmark.

Args:
benchmark (str): The benchmark name.
fewshot_type (str): The benchmark few-shot type.
**kwargs (Any): Additional arguments.

Returns:
Dict[str, str]: A dictionary of few-shot examples.
"""
raise NotImplementedError

@abstractmethod
def generate(self, *args: Any, **kwargs: Any) -> Any:
"""Generate a response."""
raise NotImplementedError("Generate method not implemented.")
def get_prompts(self, benchmark: str, **kwargs: Any) -> Dict[str, str]:
"""Retrieve the prompt instructions based on the benchmark.

Args:
benchmark (str): The benchmark name.
**kwargs (Any): Additional arguments.

Returns:
Dict[str, str]: A dictionary of prompt instructions.
"""
raise NotImplementedError

@abstractmethod
def get_strategy(self, benchmark: str, **kwargs: Any) -> BaseStrategy:
"""Returns an instance of the appropriate strategy based on the provided benchmark.

Args:
benchmark (str): The benchmark name.
**kwargs (Dict[str, Any]): Additional keyword arguments to pass to
the strategy's constructor.

Returns:
BaseStrategy: An instance of the appropriate strategy.
"""
raise NotImplementedError

@abstractmethod
def generate(self, *args: Any, **kwargs: Any) -> BaseOutput:
"""Generate a response.

Args:
*args (Any): Additional arguments.
**kwargs (Any): Additional keyword arguments.

Returns:
BaseOutput: The generated response.
"""
raise NotImplementedError
57 changes: 0 additions & 57 deletions agential/cog/base/factory.py

This file was deleted.

44 changes: 44 additions & 0 deletions agential/cog/base/output.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""Base output class."""

from typing import Any

from pydantic import BaseModel, Field


class BaseOutput(BaseModel):
"""Base class for structured agent outputs.

Attributes:
answer (Any): The answer generated by the agent.
total_prompt_tokens (int): The total number of input tokens used.
total_completion_tokens (int): The total number of output tokens used.
total_tokens (int): The total number of tokens used.
total_cost (float): The total cost of the output.
total_prompt_cost (float): The total cost of the prompt tokens.
total_completion_cost (float): The total cost of the completion tokens.
total_prompt_time (float): The total time taken for the LLM API to generate the outputs in seconds.
total_time (float): The total time for the agent to finish generating in seconds.
additional_info (Any): A general attribute for additional information.
"""

answer: Any = Field(..., description="The answer generated by the agent.")
total_prompt_tokens: int = Field(..., description="Total input tokens used.")
total_completion_tokens: int = Field(..., description="Total output tokens used.")
total_tokens: int = Field(..., description="Total tokens used.")
total_prompt_cost: float = Field(
..., description="Total cost of the prompt tokens."
)
total_completion_cost: float = Field(
..., description="Total cost of the completion tokens."
)
total_cost: float = Field(..., description="Total cost of the output.")
total_prompt_time: float = Field(
...,
description="Total time taken for the LLM API to generate the outputs in seconds.",
)
total_time: float = Field(
..., description="Total time for the agent to finish generating in seconds."
)
additional_info: Any = Field(
..., description="Additional information related to the output."
)
40 changes: 29 additions & 11 deletions agential/cog/base/strategies.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,51 @@
"""Generic base strategy class."""

from abc import ABC, abstractmethod
from typing import Any, Dict
from typing import Any

from agential.llm.llm import BaseLLM


class BaseStrategy(ABC):
"""An abstract base class for defining strategies for generating responses with LLM-based agents."""
"""An abstract base class for defining strategies for generating responses with LLM-based agents.

def __init__(self, llm: BaseLLM) -> None:
Parameters:
llm (BaseLLM): An instance of a language model used for generating responses.
testing (bool): Whether the generation is for testing purposes. Defaults to False.
"""

def __init__(
self,
llm: BaseLLM,
testing: bool = False,
) -> None:
"""Initialization."""
self.llm = llm
self.testing = testing

@abstractmethod
def generate(
self,
*args: Any,
**kwargs: Any,
) -> Any:
"""Generates a response."""
pass
"""Generates a response.

Args:
*args: Variable length argument list.
**kwargs: Arbitrary keyword arguments.

Returns:
Any: The generated response.
"""
raise NotImplementedError

@abstractmethod
def reset(self, *args: Any, **kwargs: Any) -> None:
"""Resets the strategy's internal state, if any."""
pass
"""Resets the strategy's internal state, if any.

@abstractmethod
def create_output_dict(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
"""Creates a dictionary containing the generated response."""
pass
Args:
*args: Variable length argument list.
**kwargs: Arbitrary keyword arguments.
"""
raise NotImplementedError
Loading
Loading