Skip to content

Commit

Permalink
feat: supports for new version of openllm (#1554)
Browse files Browse the repository at this point in the history
  • Loading branch information
takatost authored Nov 17, 2023
1 parent 19fc9e3 commit d654770
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions api/core/third_party/langchain/llms/openllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def _call(
) -> str:
params = {
"prompt": prompt,
"llm_config": self.llm_kwargs
"llm_config": self.llm_kwargs,
"stop": stop,
}

headers = {"Content-Type": "application/json"}
Expand All @@ -65,11 +66,11 @@ def _call(
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

Expand Down

0 comments on commit d654770

Please sign in to comment.