mirror of
https://github.com/Hopiu/llm.git
synced 2026-04-30 09:54:46 +00:00
Rename ._response_json to .response_json
This commit is contained in:
parent
2554a06e36
commit
255f768707
2 changed files with 5 additions and 5 deletions
|
|
@ -183,14 +183,14 @@ class Chat(Model):
|
|||
content = chunk["choices"][0].get("delta", {}).get("content")
|
||||
if content is not None:
|
||||
yield content
|
||||
response._response_json = combine_chunks(chunks)
|
||||
response.response_json = combine_chunks(chunks)
|
||||
else:
|
||||
completion = openai.ChatCompletion.create(
|
||||
model=prompt.model.model_id,
|
||||
messages=messages,
|
||||
stream=False,
|
||||
)
|
||||
response._response_json = completion.to_dict_recursive()
|
||||
response.response_json = completion.to_dict_recursive()
|
||||
yield completion.choices[0].message.content
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class Response(ABC):
|
|||
self.stream = stream
|
||||
self._chunks: List[str] = []
|
||||
self._done = False
|
||||
self._response_json = None
|
||||
self.response_json = None
|
||||
self.conversation = conversation
|
||||
|
||||
def __iter__(self) -> Iterator[str]:
|
||||
|
|
@ -112,7 +112,7 @@ class Response(ABC):
|
|||
|
||||
def json(self) -> Optional[Dict[str, Any]]:
|
||||
self._force()
|
||||
return self._response_json
|
||||
return self.response_json
|
||||
|
||||
def duration_ms(self) -> int:
|
||||
self._force()
|
||||
|
|
@ -171,7 +171,7 @@ class Response(ABC):
|
|||
)
|
||||
response.id = row["id"]
|
||||
response._prompt_json = json.loads(row["prompt_json"])
|
||||
response._response_json = json.loads(row["response_json"])
|
||||
response.response_json = json.loads(row["response_json"])
|
||||
response._done = True
|
||||
response._chunks = [row["response"]]
|
||||
return response
|
||||
|
|
|
|||
Loading…
Reference in a new issue