MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / ChatCompletionResponseFormat

Class ChatCompletionResponseFormat

examples/server/server.py:2848–2861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2846
2847
2848class ChatCompletionResponseFormat(BaseModel):
2849 model_config = ConfigDict(extra="ignore", populate_by_name=True)
2850
2851 type: Literal["text", "json_object", "json_schema"]
2852 schema_: Optional[Dict[str, Any]] = Field(default=None, alias="schema")
2853 json_schema: Optional[ChatCompletionResponseFormatJsonSchema] = None
2854
2855 def to_template_response_format(self) -> ChatTemplateResponseFormat:
2856 response_format: ChatTemplateResponseFormat = {"type": self.type}
2857 if self.schema_ is not None:
2858 response_format["schema"] = self.schema_
2859 if self.json_schema is not None:
2860 response_format["json_schema"] = self.json_schema.to_template_json_schema()
2861 return response_format
2862
2863
2864class CreateChatCompletionRequest(BaseModel):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…