update fix of pr review

This commit is contained in:
better629 2024-02-01 10:42:18 +08:00
parent 2d372a8863
commit c0a4d7c4c9
4 changed files with 7 additions and 17 deletions

View file

@ -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

View file

@ -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__":