Browse Source

fix multi-modual bug (#1127)

### What problem does this PR solve?


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.8.0
KevinHuSh 1 year ago
parent
commit
e05395d2a7
No account linked to committer's email address
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      rag/llm/cv_model.py

+ 5
- 1
rag/llm/cv_model.py View File

@@ -75,10 +75,14 @@ class GptV4(Base):

def describe(self, image, max_tokens=300):
b64 = self.image2base64(image)
prompt = self.prompt(b64)
for i in range(len(prompt)):
for c in prompt[i]["content"]:
if "type" in c: del c["type"]

res = self.client.chat.completions.create(
model=self.model_name,
messages=self.prompt(b64),
messages=prompt,
max_tokens=max_tokens,
)
return res.choices[0].message.content.strip(), res.usage.total_tokens

Loading…
Cancel
Save