-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.py
More file actions
26 lines (19 loc) · 962 Bytes
/
Copy pathschemas.py
File metadata and controls
26 lines (19 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Pydantic request models for the OpenAI-compatible endpoints."""
from typing import Any, List, Optional, Union
from pydantic import BaseModel
from .config import MODEL_NAME
class ChatMessage(BaseModel):
role: str
# content is a plain string, or OpenAI "content parts" (list of dicts), or
# null for some tool/assistant messages.
content: Optional[Union[str, List[Any]]] = None
class ChatCompletionRequest(BaseModel):
messages: List[ChatMessage]
model: Optional[str] = MODEL_NAME
stream: bool = False
# Copilot's own conversation id (returned in earlier responses). Pass it back
# to continue that thread; omit it to start a fresh conversation. Outside
# OpenAI's schema, but standard clients can set it via extra_body.
conversation_id: Optional[str] = None
# Any other OpenAI fields (temperature, max_tokens, ...) are accepted and
# ignored — Copilot's consumer protocol doesn't expose those knobs.