From 7d6f43584845233455ddc89539c06ed5a80a69cb Mon Sep 17 00:00:00 2001 From: Arnaud Flament Date: Mon, 21 Aug 2023 12:40:25 -0700 Subject: [PATCH] Council - Release 0.10.0 (#68) * Small fixes * Release to 0.10.0 * Update README.md --- README.md | 4 ++-- council/contexts/messages.py | 3 +++ dev-requirements.txt | 4 ++-- docs/source/getting_started/first_example.ipynb | 16 ++++++++++++++-- pyproject.toml | 2 +- requirements.txt | 4 ++-- .../agent_tests/test_agent_test_suite.py | 4 ++-- tests/integration/llm/test_azure_llm.py | 3 ++- tests/integration/skill/test_llm_skill.py | 2 +- 9 files changed, 29 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 54f7042d..8dd488b0 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Import Council. ```python from council.chains import Chain from council.skills import LLMSkill -from council.llm import OpenAILLM, OpenAILLMConfiguration +from council.llm import OpenAILLM ``` Setup API keys in .env file (example in repository) and use it to setup the LLM (here: OpenAILLM). @@ -92,7 +92,7 @@ Setup API keys in .env file (example in repository) and use it to setup the LLM import dotenv dotenv.load_dotenv() -openai_llm = OpenAILLM(config=OpenAILLMConfiguration.from_env()) +openai_llm = OpenAILLM.from_env() ``` Create your first Hello World Skill and Wrap it in a Chain. diff --git a/council/contexts/messages.py b/council/contexts/messages.py index 5e2d6694..d2c8d983 100644 --- a/council/contexts/messages.py +++ b/council/contexts/messages.py @@ -248,3 +248,6 @@ def __le__(self, other: "ScoredChatMessage"): def __str__(self): return f"{self.score}" + + def __repr__(self): + return f"ScoredChatMessage({self.message}, {self.score})" diff --git a/dev-requirements.txt b/dev-requirements.txt index 4d93de89..8a43923f 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -2,8 +2,8 @@ hatch==1.7.0 # Lint black == 23.7.0 -mypy == 1.4.1 -ruff==0.0.277 +mypy==1.5.1 +ruff==0.0.285 # Test pytest==7.4.0 diff --git a/docs/source/getting_started/first_example.ipynb b/docs/source/getting_started/first_example.ipynb index 524d7a9f..a78bb095 100644 --- a/docs/source/getting_started/first_example.ipynb +++ b/docs/source/getting_started/first_example.ipynb @@ -25,7 +25,7 @@ "source": [ "from council.chains import Chain\n", "from council.skills import LLMSkill\n", - "from council.llm import OpenAILLM, OpenAILLMConfiguration\n" + "from council.llm import OpenAILLM\n" ], "metadata": { "collapsed": false @@ -48,7 +48,7 @@ "import dotenv\n", "\n", "dotenv.load_dotenv()\n", - "openai_llm = OpenAILLM(config=OpenAILLMConfiguration.from_env())\n" + "openai_llm = OpenAILLM.from_env()\n" ], "metadata": { "collapsed": false @@ -185,6 +185,18 @@ "metadata": { "collapsed": false } + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "result = agent.execute_from_user_message(\"Represent with emojis, council a multi agent framework\")\n", + "print(result.best_message.message)" + ], + "metadata": { + "collapsed": false + } } ], "metadata": { diff --git a/pyproject.toml b/pyproject.toml index aa7053ab..5aec5a1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "council-ai" -version = "0.0.9" +version = "0.10.0" description = "Council is an open-source framework for the rapid development and robust deployment of customized generative AI applications" readme = "README.md" requires-python = ">=3.9" diff --git a/requirements.txt b/requirements.txt index d73c3827..5b1e7e6c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,6 @@ tiktoken==0.4.0 # Skills ## Google -google-api-python-client==2.93.0 -GoogleNews==1.6.8 +google-api-python-client==2.97.0 +GoogleNews==1.6.9 google-api-python-client-stubs diff --git a/tests/integration/agent_tests/test_agent_test_suite.py b/tests/integration/agent_tests/test_agent_test_suite.py index 405b8991..4589212a 100644 --- a/tests/integration/agent_tests/test_agent_test_suite.py +++ b/tests/integration/agent_tests/test_agent_test_suite.py @@ -62,6 +62,6 @@ def test_run(self): result = suite.run(self.agent, show_progressbar=False) print(json.dumps(result.to_dict(), indent=2)) - self.assertAlmostEqual(0.75, result.results[0].scorer_results[0].score, delta=0.1) - self.assertAlmostEqual(0.75, result.results[1].scorer_results[0].score, delta=0.1) + self.assertAlmostEqual(0.9, result.results[0].scorer_results[0].score, delta=0.1) + self.assertAlmostEqual(0.6, result.results[1].scorer_results[0].score, delta=0.1) self.assertAlmostEqual(0.0, result.results[2].scorer_results[0].score, delta=0.1) diff --git a/tests/integration/llm/test_azure_llm.py b/tests/integration/llm/test_azure_llm.py index 0c4682d8..d77b6d59 100644 --- a/tests/integration/llm/test_azure_llm.py +++ b/tests/integration/llm/test_azure_llm.py @@ -17,7 +17,8 @@ def setUp(self) -> None: def test_basic_prompt(self): messages = [LLMMessage.user_message("Give me an example of a currency")] - result = self.llm.post_chat_request(messages)[0] + llm_result = self.llm.post_chat_request(messages) + result = llm_result.first_choice print(result) messages.append(LLMMessage.system_message(result)) messages.append(LLMMessage.user_message("give me another example")) diff --git a/tests/integration/skill/test_llm_skill.py b/tests/integration/skill/test_llm_skill.py index 2a3ad330..7533f863 100644 --- a/tests/integration/skill/test_llm_skill.py +++ b/tests/integration/skill/test_llm_skill.py @@ -45,7 +45,7 @@ def test_choices(self): agent = Agent.from_skill(llm_skill, "Answer to an user prompt using gpt4") result = agent.execute_from_user_message("Give me examples of a currency", budget=Budget(6000)) self.assertTrue(result.try_best_message.is_some()) - self.assertEquals(3, len(result.best_message.data)) + self.assertEquals(3, len(result.best_message.data.choices)) finally: del os.environ["AZURE_LLM_N"]