瀏覽代碼

fix: xinference chat completion error (#952)

tags/0.3.15
takatost 2 年之前
父節點
當前提交
4f3053a8cc
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. 2
    2
      api/core/third_party/langchain/llms/xinference_llm.py

+ 2
- 2
api/core/third_party/langchain/llms/xinference_llm.py 查看文件

@@ -46,7 +46,7 @@ class XinferenceLLM(Xinference):
return combined_text_output
else:
completion = model.chat(prompt=prompt, generate_config=generate_config)
return completion["choices"][0]["text"]
return completion["choices"][0]["message"]["content"]
elif isinstance(model, RESTfulGenerateModelHandle):
generate_config: "LlamaCppGenerateConfig" = kwargs.get("generate_config", {})

@@ -82,7 +82,7 @@ class XinferenceLLM(Xinference):
completion = combined_text_output
else:
completion = model.chat(prompt=prompt, generate_config=generate_config)
completion = completion["choices"][0]["text"]
completion = completion["choices"][0]["message"]["content"]

if stop is not None:
completion = enforce_stop_tokens(completion, stop)

Loading…
取消
儲存