MCPcopy Index your code
hub / github.com/zai-org/ChatGLM3 / parse_output_text

Function parse_output_text

openai_api_demo/api_server.py:489–512  ·  view source on GitHub ↗

Directly output the text content of value :param model_id: :param value: :return:

(model_id: str, value: str)

Source from the content-addressed store, hash-verified

487
488
489async def parse_output_text(model_id: str, value: str):
490 """
491 Directly output the text content of value
492
493 :param model_id:
494 :param value:
495 :return:
496 """
497 choice_data = ChatCompletionResponseStreamChoice(
498 index=0,
499 delta=DeltaMessage(role="assistant", content=value),
500 finish_reason=None
501 )
502 chunk = ChatCompletionResponse(model=model_id, id="", choices=[choice_data], object="chat.completion.chunk")
503 yield "{}".format(chunk.model_dump_json(exclude_unset=True))
504
505 choice_data = ChatCompletionResponseStreamChoice(
506 index=0,
507 delta=DeltaMessage(),
508 finish_reason="stop"
509 )
510 chunk = ChatCompletionResponse(model=model_id, id="", choices=[choice_data], object="chat.completion.chunk")
511 yield "{}".format(chunk.model_dump_json(exclude_unset=True))
512 yield '[DONE]'
513
514
515def contains_custom_function(value: str) -> bool:

Callers 1

create_chat_completionFunction · 0.70

Calls 3

DeltaMessageClass · 0.70

Tested by

no test coverage detected