Skip to content

Commit aaa91ed

Browse files
committed
update: README to include semver logo
fix: broken tests
1 parent d7d5a78 commit aaa91ed

File tree

3 files changed

+86
-39
lines changed

3 files changed

+86
-39
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33

44
<h3 align="center">Vanilla AI Agents</h3>
55

6-
<a href="https://github.com/azure-samples/vanilla-aiagents/main/LICENSE.md"><img src="https://img.shields.io/github/license/Azure-Samples/vanilla-aiagents" alt="License" /></a>
7-
<a href="https://github.com/Azure-Samples/vanilla-aiagents/actions/workflows/pytest.yml"><img src="https://github.com/Azure-Samples/vanilla-aiagents/actions/workflows/pytest.yml/badge.svg" alt="Test status" /></a>
8-
<a href="https://github.com/Azure-Samples/vanilla-aiagents/releases"><img src="https://img.shields.io/github/v/release/Azure-Samples/vanilla-aiagents" alt="Releases" /></a>
9-
<a href="https://Azure-Samples.github.io/vanilla-aiagents/"><img src="https://img.shields.io/badge/GitHub%20Pages-Online-success" alt="GitHub Pages" /></a>
6+
<a href="https://github.com/azure-samples/vanilla-aiagents/main/LICENSE.md"><img src="https://img.shields.io/github/license/Azure-Samples/vanilla-aiagents" alt="License" /></a>
7+
<a href="https://github.com/Azure-Samples/vanilla-aiagents/actions/workflows/pytest.yml"><img src="https://github.com/Azure-Samples/vanilla-aiagents/actions/workflows/pytest.yml/badge.svg" alt="Test status" /></a>
8+
<a href="https://github.com/Azure-Samples/vanilla-aiagents/releases"><img src="https://img.shields.io/github/v/release/Azure-Samples/vanilla-aiagents" alt="Releases" /></a>
9+
<a href="https://Azure-Samples.github.io/vanilla-aiagents/"><img src="https://img.shields.io/badge/GitHub%20Pages-Online-success" alt="GitHub Pages" /></a>
10+
<a href="https://semver.org/"><img src="https://img.shields.io/badge/semver-2.0.0-blue" alt="Semver 2.0.0" /></a>
1011

1112
<p>Lightweight library demonstrating how to create agenting application without using any specific framework.</p>
1213
</div>

vanilla_aiagents/tests/test_planned_team.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def test_feedback(self):
240240
def can_end(conversation: Conversation) -> bool:
241241
return (
242242
conversation.variables.get("result") == "done"
243-
or len(conversation.messages) > 10
243+
or len(conversation.messages) > 15
244244
)
245245

246246
flow = PlannedTeam(
@@ -257,10 +257,10 @@ def can_end(conversation: Conversation) -> bool:
257257
result = workflow.run("I want a new oven")
258258

259259
self.assertEqual(result, "done", "Expected the workflow result to be 'done'")
260-
self.assertIn(
261-
"acceptable",
262-
workflow.conversation.messages[-1]["content"],
263-
"Expected result to be 'acceptable'",
260+
self.assertEqual(
261+
"done",
262+
workflow.conversation.variables["result"],
263+
"Expected 'result' variable to be 'done'",
264264
)
265265

266266
def test_plan(self):
Lines changed: 76 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,101 @@
11
import unittest
22
import os, logging, sys
33

4-
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
4+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
55

6-
from vanilla_aiagents.conversation import Conversation, NoopUpdateStrategy, ReplaceLastMessageUpdateStrategy, AppendMessagesUpdateStrategy
6+
from vanilla_aiagents.conversation import (
7+
Conversation,
8+
NoopUpdateStrategy,
9+
ReplaceLastMessageUpdateStrategy,
10+
AppendMessagesUpdateStrategy,
11+
)
712
from vanilla_aiagents.llm import AzureOpenAILLM
813
from vanilla_aiagents.agent import Agent
914

1015
from dotenv import load_dotenv
16+
1117
load_dotenv(override=True)
1218

19+
1320
class TestReadingStrategy(unittest.TestCase):
1421

1522
def setUp(self):
16-
self.llm = AzureOpenAILLM({
17-
"azure_deployment": os.getenv("AZURE_OPENAI_MODEL"),
18-
"azure_endpoint": os.getenv("AZURE_OPENAI_ENDPOINT"),
19-
"api_key": os.getenv("AZURE_OPENAI_KEY"),
20-
"api_version": os.getenv("AZURE_OPENAI_API_VERSION"),
21-
})
22-
23+
self.llm = AzureOpenAILLM(
24+
{
25+
"azure_deployment": os.getenv("AZURE_OPENAI_MODEL"),
26+
"azure_endpoint": os.getenv("AZURE_OPENAI_ENDPOINT"),
27+
"api_key": os.getenv("AZURE_OPENAI_KEY"),
28+
"api_version": os.getenv("AZURE_OPENAI_API_VERSION"),
29+
}
30+
)
31+
2332
logging.basicConfig(level=logging.INFO)
2433
logging.getLogger("vanilla_aiagents.conversation").setLevel(logging.DEBUG)
2534

2635
def test_append(self):
27-
agent = Agent(id="test-agent", description="Test Agent", system_message="Simply say 'hello'", llm=self.llm, update_strategy=AppendMessagesUpdateStrategy())
28-
36+
agent = Agent(
37+
id="test-agent",
38+
description="Test Agent",
39+
system_message="Simply say 'hello'",
40+
llm=self.llm,
41+
update_strategy=AppendMessagesUpdateStrategy(),
42+
)
43+
2944
conversation = Conversation(messages=[], variables={})
3045
agent.ask(conversation)
31-
32-
self.assertEqual(len(conversation.messages), 1, "Expected 1 message in the conversation")
33-
46+
47+
self.assertEqual(
48+
len(conversation.messages), 1, "Expected 1 message in the conversation"
49+
)
50+
3451
def test_replace(self):
35-
agent = Agent(id="test-agent", description="Test Agent", system_message="Simply say 'hello'", llm=self.llm, update_strategy=ReplaceLastMessageUpdateStrategy())
36-
52+
agent = Agent(
53+
id="test-agent",
54+
description="Test Agent",
55+
system_message="Simply say 'hello'",
56+
llm=self.llm,
57+
update_strategy=ReplaceLastMessageUpdateStrategy(),
58+
)
59+
3760
conversation = Conversation(messages=[], variables={})
38-
conversation.messages.append({"role": "assistant", "content": "This will be replaced"})
61+
conversation.messages.append(
62+
{"role": "assistant", "content": "This will be replaced"}
63+
)
3964
agent.ask(conversation)
40-
41-
self.assertEqual(len(conversation.messages), 1, "Expected 1 message in the conversation")
42-
self.assertNotIn("replaced", conversation.messages[0]["content"], "Expected message to be replaced")
43-
65+
66+
self.assertEqual(
67+
len(conversation.messages), 1, "Expected 1 message in the conversation"
68+
)
69+
self.assertNotIn(
70+
"replaced",
71+
conversation.messages[0]["content"],
72+
"Expected message to be replaced",
73+
)
74+
4475
def test_noop(self):
45-
agent = Agent(id="test-agent", description="Test Agent", system_message="Simply say 'hello'", llm=self.llm, update_strategy=NoopUpdateStrategy())
46-
76+
agent = Agent(
77+
id="test-agent",
78+
description="Test Agent",
79+
system_message="Simply say 'hello'",
80+
llm=self.llm,
81+
update_strategy=NoopUpdateStrategy(),
82+
)
83+
4784
conversation = Conversation(messages=[], variables={})
48-
conversation.messages.append({"role": "assistant", "content": "This will not be replaced"})
85+
conversation.messages.append(
86+
{"role": "assistant", "content": "This will not be replaced"}
87+
)
4988
agent.ask(conversation)
50-
51-
self.assertEqual(len(conversation.messages), 1, "Expected 1 message in the conversation")
52-
self.assertNotIn("hello", conversation.messages[0]["content"], "Expected message NOT to be replaced")
53-
54-
if __name__ == '__main__':
55-
unittest.main()
89+
90+
self.assertEqual(
91+
len(conversation.messages), 1, "Expected 1 message in the conversation"
92+
)
93+
self.assertNotIn(
94+
"hello",
95+
conversation.messages[0]["content"],
96+
"Expected message NOT to be replaced",
97+
)
98+
99+
100+
if __name__ == "__main__":
101+
unittest.main()

0 commit comments

Comments
 (0)