Files
wehub-resource-sync 6b7e6b44f1
Python Build and Type Check / python-ci (ubuntu-latest, 3.11) (push) Has been cancelled
Python Build and Type Check / python-ci (ubuntu-latest, 3.13) (push) Has been cancelled
Python Build and Type Check / python-ci (windows-latest, 3.11) (push) Has been cancelled
Python Build and Type Check / python-ci (windows-latest, 3.13) (push) Has been cancelled
Python Integration Tests / python-ci (ubuntu-latest, 3.13) (push) Has been cancelled
Python Integration Tests / python-ci (windows-latest, 3.13) (push) Has been cancelled
Python Notebook Tests / python-ci (ubuntu-latest, 3.13) (push) Has been cancelled
Python Notebook Tests / python-ci (windows-latest, 3.13) (push) Has been cancelled
Python Smoke Tests / python-ci (ubuntu-latest, 3.13) (push) Has been cancelled
Python Smoke Tests / python-ci (windows-latest, 3.13) (push) Has been cancelled
Python Unit Tests / python-ci (ubuntu-latest, 3.13) (push) Has been cancelled
Python Unit Tests / python-ci (windows-latest, 3.13) (push) Has been cancelled
gh-pages / build (push) Has been cancelled
Python Publish (pypi) / Upload release to PyPI (push) Has been cancelled
Spellcheck / spellcheck (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:37:31 +08:00

46 lines
1.1 KiB
Python

# Copyright (c) 2024 Microsoft Corporation.
# Licensed under the MIT License
"""Create completion response."""
from graphrag_llm.types import (
LLMChoice,
LLMCompletionMessage,
LLMCompletionResponse,
LLMCompletionUsage,
)
def create_completion_response(response: str) -> LLMCompletionResponse:
"""Create a completion response object.
Args:
response: The completion response string.
Returns
-------
LLMCompletionResponse: The completion response object.
"""
return LLMCompletionResponse(
id="completion-id",
object="chat.completion",
created=0,
model="mock-model",
choices=[
LLMChoice(
index=0,
message=LLMCompletionMessage(
role="assistant",
content=response,
),
finish_reason="stop",
)
],
usage=LLMCompletionUsage(
prompt_tokens=0,
completion_tokens=0,
total_tokens=0,
),
formatted_response=None,
)