Skip to content

make type in PartialQuestions more strict #756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/codegate/api/v1_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
from enum import Enum
from typing import Any, List, Optional, Union

import pydantic
Expand Down Expand Up @@ -87,6 +88,11 @@ class QuestionAnswer(pydantic.BaseModel):
answer: Optional[ChatMessage]


class QuestionType(str, Enum):
chat = "chat"
fim = "fim"


class PartialQuestions(pydantic.BaseModel):
"""
Represents all user messages obtained from a DB row.
Expand All @@ -96,7 +102,7 @@ class PartialQuestions(pydantic.BaseModel):
timestamp: datetime.datetime
message_id: str
provider: Optional[str]
type: str
type: QuestionType


class PartialQuestionAnswer(pydantic.BaseModel):
Expand All @@ -115,7 +121,7 @@ class Conversation(pydantic.BaseModel):

question_answers: List[QuestionAnswer]
provider: Optional[str]
type: str
type: QuestionType
chat_id: str
conversation_timestamp: datetime.datetime

Expand Down
Loading