mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-27 14:25:20 +02:00
add gpt4-v
This commit is contained in:
parent
0aba36fdad
commit
9cbc34662a
8 changed files with 84 additions and 13 deletions
|
|
@ -8,6 +8,8 @@
|
|||
from typing import List, Tuple
|
||||
|
||||
import pytest
|
||||
import base64
|
||||
from pathlib import Path
|
||||
from pydantic import ValidationError
|
||||
|
||||
from metagpt.actions import Action
|
||||
|
|
@ -17,6 +19,7 @@ from metagpt.llm import LLM
|
|||
from metagpt.roles import Role
|
||||
from metagpt.schema import Message
|
||||
from metagpt.team import Team
|
||||
from metagpt.utils.common import encode_image
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
@ -241,6 +244,21 @@ def test_create_model_class_with_mapping():
|
|||
assert value == ["game.py", "app.py", "static/css/styles.css", "static/js/script.js", "templates/index.html"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_action_node_with_image():
|
||||
invoice = ActionNode(
|
||||
key="invoice",
|
||||
expected_type=bool,
|
||||
instruction="if it's a invoice file, return True else False",
|
||||
example="False"
|
||||
)
|
||||
|
||||
invoice_path = Path(__file__).parent.joinpath("..", "..", "data", "invoices", "invoice-2.png")
|
||||
img_base64 = encode_image(invoice_path)
|
||||
node = await invoice.fill(context="", llm=LLM(), images=[img_base64])
|
||||
assert node.instruct_content.invoice
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_create_model_class()
|
||||
test_create_model_class_with_mapping()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue