Skip to content

Commit

Permalink
fix zhipuCV bug (infiniflow#2215)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

infiniflow#2198  fix zhipuCV bug

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: Zhedong Cen <[email protected]>
  • Loading branch information
hangters and aopstudio authored Sep 3, 2024
1 parent 9728cbe commit 7e0fc53
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rag/llm/cv_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,12 @@ def __init__(self, key, model_name="glm-4v", lang="Chinese", **kwargs):
def describe(self, image, max_tokens=1024):
b64 = self.image2base64(image)

prompt = self.prompt(b64)
prompt[0]["content"][1]["type"] = "text"

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
Expand Down

0 comments on commit 7e0fc53

Please sign in to comment.