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

This commit is contained in:
takatost 2023-11-17 14:07:36 +08:00 committed by GitHub
parent 19fc9e3466
commit d654770732
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,7 +51,8 @@ class OpenLLM(LLM):
) -> str: ) -> str:
params = { params = {
"prompt": prompt, "prompt": prompt,
"llm_config": self.llm_kwargs "llm_config": self.llm_kwargs,
"stop": stop,
} }
headers = {"Content-Type": "application/json"} headers = {"Content-Type": "application/json"}
@ -65,11 +66,11 @@ class OpenLLM(LLM):
raise ValueError(f"OpenLLM HTTP {response.status_code} error: {response.text}") raise ValueError(f"OpenLLM HTTP {response.status_code} error: {response.text}")
json_response = response.json() json_response = response.json()
completion = json_response["responses"][0] completion = json_response["outputs"][0]['text']
completion = completion.lstrip(prompt) completion = completion.lstrip(prompt)
if stop is not None: # if stop is not None:
completion = enforce_stop_tokens(completion, stop) # completion = enforce_stop_tokens(completion, stop)
return completion return completion