Quellcode durchsuchen

[Bug]: When use OpenAI chat model , raise ERROR: 'CompletionUsage' object has no attribute 'get' #2948 (#2949)

[Bug]: When use OpenAI chat model , raise ERROR: 'CompletionUsage'
object has no attribute 'get' #2948

### What problem does this PR solve?

the detail of this PR is shown at
https://github.com/infiniflow/ragflow/issues/2948

### Type of change

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

Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
tags/v0.13.0
Yinquan WANG vor 1 Jahr
Ursprung
Commit
5aa9d7787e
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden
1 geänderte Dateien mit 1 neuen und 0 gelöschten Zeilen
  1. 1
    0
      rag/llm/chat_model.py

+ 1
- 0
rag/llm/chat_model.py Datei anzeigen

@@ -67,6 +67,7 @@ class Base(ABC):
if not resp.choices[0].delta.content:
resp.choices[0].delta.content = ""
ans += resp.choices[0].delta.content

total_tokens += 1
if not hasattr(resp, "usage") or not resp.usage:
total_tokens = (

Laden…
Abbrechen
Speichern