Directly output the text content of value :param model_id: :param value: :return:
(model_id: str, value: str)
| 487 | |
| 488 | |
| 489 | async 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 | |
| 515 | def contains_custom_function(value: str) -> bool: |
no test coverage detected