Commit 12e92616 authored by lintangsutawika's avatar lintangsutawika
Browse files

fixed parsing of API returns

parent bfe69313
...@@ -162,18 +162,15 @@ class OpenaiChatCompletionsLM(LM): ...@@ -162,18 +162,15 @@ class OpenaiChatCompletionsLM(LM):
presence_penalty=self.presence_penalty, presence_penalty=self.presence_penalty,
temperature=self.temperature, temperature=self.temperature,
top_p=self.top_p, top_p=self.top_p,
# stop=until,
) )
for resp, (context, args_) in zip(response.choices, chunk): for resp, (context, args_) in zip(response.choices, chunk):
print(resp) s = resp.message.content
import sys; sys.exit()
s = resp["text"]
# until_ = args_.get("until", ["<|endoftext|>"]) # until_ = args_.get("until", ["<|endoftext|>"])
until_ = args_.get("until", "null") until_ = args_.get("until", None)
if until_ is not None:
for term in until_: for term in until_:
if len(term) > 0: if len(term) > 0:
s = s.split(term)[0] s = s.split(term)[0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment