Sfoglia il codice sorgente

feat: supports for new version of openllm (#1554)

tags/0.3.31
takatost 1 anno fa
parent
commit
d654770732
Nessun account collegato all'indirizzo email del committer
1 ha cambiato i file con 5 aggiunte e 4 eliminazioni
  1. 5
    4
      api/core/third_party/langchain/llms/openllm.py

+ 5
- 4
api/core/third_party/langchain/llms/openllm.py Vedi File

@@ -51,7 +51,8 @@ class OpenLLM(LLM):
) -> str:
params = {
"prompt": prompt,
"llm_config": self.llm_kwargs
"llm_config": self.llm_kwargs,
"stop": stop,
}

headers = {"Content-Type": "application/json"}
@@ -65,11 +66,11 @@ class OpenLLM(LLM):
raise ValueError(f"OpenLLM HTTP {response.status_code} error: {response.text}")

json_response = response.json()
completion = json_response["responses"][0]
completion = json_response["outputs"][0]['text']
completion = completion.lstrip(prompt)

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

return completion


Loading…
Annulla
Salva