mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-20 17:30:59 +00:00
fix: some field may not exist in chatcmplchunk
This commit is contained in:
@@ -101,14 +101,14 @@ class OpenAIChatCompletions(requester.LLMAPIRequester):
|
|||||||
content=pending_content,
|
content=pending_content,
|
||||||
tool_calls=real_tool_calls if len(real_tool_calls) > 0 else None
|
tool_calls=real_tool_calls if len(real_tool_calls) > 0 else None
|
||||||
),
|
),
|
||||||
finish_reason=chunk.choices[0].finish_reason,
|
finish_reason=chunk.choices[0].finish_reason if hasattr(chunk.choices[0], 'finish_reason') and chunk.choices[0].finish_reason is not None else 'stop',
|
||||||
logprobs=chunk.choices[0].logprobs,
|
logprobs=chunk.choices[0].logprobs,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
model=args["model"],
|
model=chunk.model,
|
||||||
service_tier=chunk.service_tier,
|
service_tier=chunk.service_tier if hasattr(chunk, 'service_tier') else None,
|
||||||
system_fingerprint=chunk.system_fingerprint,
|
system_fingerprint=chunk.system_fingerprint if hasattr(chunk, 'system_fingerprint') else None,
|
||||||
usage=chunk.usage
|
usage=chunk.usage if hasattr(chunk, 'usage') else None
|
||||||
) if chunk else None
|
) if chunk else None
|
||||||
|
|
||||||
async def _make_msg(
|
async def _make_msg(
|
||||||
|
|||||||
Reference in New Issue
Block a user