aki-008 commited on
Commit
0bfabd3
·
1 Parent(s): 923418b

chore: AI messgae pydantic model added

Browse files
Backend/app/api/v1/endpoints/notes.py CHANGED
@@ -8,4 +8,16 @@ from fastapi import APIRouter, Depends, HTTPException
8
  from chromadb.api.models.Collection import Collection # Import Collection type
9
  from app.api.deps import get_chroma_collection
10
  from app.llm import call_llm
11
- import uuid
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  from chromadb.api.models.Collection import Collection # Import Collection type
9
  from app.api.deps import get_chroma_collection
10
  from app.llm import call_llm
11
+ import uuid
12
+
13
+
14
+
15
+ router = APIRouter(prefix="/notes")
16
+
17
+ @router.post("/ai_chat", status_code=status.HTTP_201_CREATED)
18
+ async def ai_chat(
19
+ Input_model: IngestRequest,
20
+ collection: Collection = Depends(get_chroma_collection),
21
+ current_user: User = Depends(get_current_user)
22
+ ):
23
+ pass
Backend/app/schema/models.py CHANGED
@@ -2,6 +2,9 @@ from pydantic import BaseModel, EmailStr, Field, field_validator, ConfigDict
2
  from typing import Optional, Literal, List
3
  from datetime import datetime
4
 
 
 
 
5
  class UserCreate(BaseModel):
6
  username: str = Field(..., min_length=3, max_length=50)
7
  email: EmailStr = Field(...)
@@ -24,6 +27,8 @@ class Token(BaseModel):
24
  class LoginResponse(Token):
25
  username: str
26
 
 
 
27
  class Quiz_input(BaseModel):
28
  parsed_doc: str
29
  user_prompt: str
@@ -42,4 +47,21 @@ class QuizOutput(BaseModel):
42
  class IngestRequest(BaseModel):
43
  parsed_doc: str = Field(..., description="The main document content to embed")
44
  user_prompt: str = Field(..., description="The user prompt associated with this document")
45
- id: Optional[str] = None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  from typing import Optional, Literal, List
3
  from datetime import datetime
4
 
5
+
6
+ #--------Auth models--------#
7
+
8
  class UserCreate(BaseModel):
9
  username: str = Field(..., min_length=3, max_length=50)
10
  email: EmailStr = Field(...)
 
27
  class LoginResponse(Token):
28
  username: str
29
 
30
+
31
+ #--------Quiz models--------#
32
  class Quiz_input(BaseModel):
33
  parsed_doc: str
34
  user_prompt: str
 
47
  class IngestRequest(BaseModel):
48
  parsed_doc: str = Field(..., description="The main document content to embed")
49
  user_prompt: str = Field(..., description="The user prompt associated with this document")
50
+ id: Optional[str] = None
51
+
52
+
53
+ # #--------Notes models--------#
54
+
55
+ class ChatMessage(BaseModel):
56
+ role: Literal['user', 'assistant', 'system'] = Field(description="The sender of the message. Must be 'user', 'assistant', or 'system'.")
57
+ content: str=Field(..., min_length=1, description="The text content of the message.")
58
+
59
+ class AI_chat_input(BaseModel):
60
+ messages = List[ChatMessage] = Field(
61
+ ...,
62
+ min_length=1,
63
+ description="The complete conversation history (list of messages) to send to the LLM."
64
+ )
65
+ session_id: str | None = Field(
66
+ None, description="The unique ID of the current chat session (optional)."
67
+ )