diff --git a/examples/dalle_gpt4v_agent.py b/examples/dalle_gpt4v_agent.py index 2b54b18a0..28215dba3 100644 --- a/examples/dalle_gpt4v_agent.py +++ b/examples/dalle_gpt4v_agent.py @@ -2,15 +2,7 @@ # -*- coding: utf-8 -*- # @Desc : use gpt4v to improve prompt and draw image with dall-e-3 -""" -set the configuration in `config2.yaml` like below -``` -llm: - base_url: "xxx" - api_key: "sk-xxx" - model: "gpt-4-vision-preview" -``` -""" +"""set `model: "gpt-4-vision-preview"` in `config2.yaml` first""" import asyncio diff --git a/examples/llm_hello_world.py b/examples/llm_hello_world.py index dfc2603aa..1d132eb8a 100644 --- a/examples/llm_hello_world.py +++ b/examples/llm_hello_world.py @@ -29,14 +29,11 @@ async def main(): if hasattr(llm, "completion"): logger.info(llm.completion(hello_msg)) - # check llm-vision capacity if it supports + # check if the configured llm supports llm-vision capacity. If not, it will throw a error invoice_path = Path(__file__).parent.joinpath("..", "tests", "data", "invoices", "invoice-2.png") img_base64 = encode_image(invoice_path) - try: - res = await llm.aask(msg="if this is a invoice, just return True else return False", images=[img_base64]) - assert "true" in res.lower() - except Exception: - pass + res = await llm.aask(msg="if this is a invoice, just return True else return False", images=[img_base64]) + assert "true" in res.lower() if __name__ == "__main__": diff --git a/tests/metagpt/actions/test_action_node.py b/tests/metagpt/actions/test_action_node.py index 18b4d0d0d..589282879 100644 --- a/tests/metagpt/actions/test_action_node.py +++ b/tests/metagpt/actions/test_action_node.py @@ -254,6 +254,7 @@ async def test_action_node_with_image(): node = await invoice.fill(context="", llm=LLM(), images=[img_base64]) assert node.instruct_content.invoice + class ToolDef(BaseModel): tool_name: str = Field(default="a", description="tool name", examples=[]) description: str = Field(default="b", description="tool description", examples=[]) diff --git a/tests/metagpt/environment/test_base_env.py b/tests/metagpt/environment/test_base_env.py index 59c68fc9e..ce8165f2f 100644 --- a/tests/metagpt/environment/test_base_env.py +++ b/tests/metagpt/environment/test_base_env.py @@ -18,7 +18,7 @@ class ForTestEnv(Environment): value: int = 0 @mark_as_readable - def read_api_no_parms(self): + def read_api_no_param(self): return self.value @mark_as_readable @@ -46,5 +46,5 @@ async def test_ext_env(): with pytest.raises(ValueError): await env.observe("not_exist_api") - assert await env.observe("read_api_no_parms") == 15 + assert await env.observe("read_api_no_param") == 15 assert await env.observe(EnvAPIAbstract(api_name="read_api", kwargs={"a": 5, "b": 5})) == 10