eranmi commited on
Commit
fe458ab
·
1 Parent(s): d283caf

updates schema for llm output

Browse files
Files changed (1) hide show
  1. src/services/output_schema.py +28 -15
src/services/output_schema.py CHANGED
@@ -1,32 +1,45 @@
1
  """This module defines the output schema for the LLM output."""
2
 
3
- from typing import Literal, Optional
4
-
5
- from pydantic import BaseModel
6
 
7
 
8
  class Image(BaseModel):
9
  """Represents an image used in a presentation slide."""
10
 
11
- path: str
12
- caption: str
13
- orientation: Literal["horizontal", "vertical", "square"]
 
 
14
 
15
 
16
  class Slide(BaseModel):
17
  """Represents a slide in the presentation."""
18
 
19
- type: Literal["title", "introduction", "core_idea", "summary"]
20
- title: Optional[str] = None # Used for core_idea slides
21
- content_format: Optional[Literal["itemize", "text"]]
22
- content: list[str]
23
- layout: Optional[Literal["text_only", "two_column", "single_image"]] = None
24
- image: Optional[Image] = None
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
 
27
  class Presentation(BaseModel):
28
  """Represents the entire presentation structure."""
29
 
30
- title: str
31
- author: str
32
- slides: list[Slide]
 
1
  """This module defines the output schema for the LLM output."""
2
 
3
+ from typing import Literal, Optional, List
4
+ from pydantic import BaseModel, Field
 
5
 
6
 
7
  class Image(BaseModel):
8
  """Represents an image used in a presentation slide."""
9
 
10
+ path: str = Field(..., description="Exact image path from a predefined list.")
11
+ caption: str = Field(..., description="Image caption text.")
12
+ orientation: Literal["horizontal", "vertical", "square"] = Field(
13
+ ..., description="Image orientation."
14
+ )
15
 
16
 
17
  class Slide(BaseModel):
18
  """Represents a slide in the presentation."""
19
 
20
+ type: Literal["title", "introduction", "core_idea", "summary"] = Field(
21
+ ..., description="Type of the slide."
22
+ )
23
+ title: Optional[str] = Field(
24
+ None, description="Slide title, required only for 'core_idea' slides."
25
+ )
26
+ content_format: Optional[Literal["itemize", "text"]] = Field(
27
+ None, description="Format of the slide content."
28
+ )
29
+ content: List[str] = Field(
30
+ ..., description="List of bullet points or text paragraphs."
31
+ )
32
+ layout: Optional[Literal["text_only", "two_column", "single_image"]] = Field(
33
+ None, description="Slide layout for 'core_idea' slides."
34
+ )
35
+ image: Optional[Image] = Field(
36
+ None, description="Image object if layout is 'two_column' or 'single_image'."
37
+ )
38
 
39
 
40
  class Presentation(BaseModel):
41
  """Represents the entire presentation structure."""
42
 
43
+ title: str = Field(..., description="Title of the presentation.")
44
+ author: str = Field(..., description="Author of the presentation.")
45
+ slides: List[Slide] = Field(..., description="List of slides in the presentation.")