File size: 2,178 Bytes
eed158d
d31d865
 
 
 
eed158d
 
 
 
d31d865
 
eed158d
 
d31d865
 
eed158d
 
 
d31d865
 
eed158d
 
d31d865
 
eed158d
 
 
d31d865
 
eed158d
 
 
 
d31d865
 
eed158d
 
 
 
d31d865
 
eed158d
 
 
d31d865
eed158d
 
d31d865
eed158d
 
 
 
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from typing import List, Optional, Union
from pydantic import BaseModel, Field
from instructor import Field as InstructorField

class Location(BaseModel):
  name: str
  lat: float
  lon: float
  relevance: str = Field(description="Why this location matters in the historical context")

class ZoomRange(BaseModel):
  range: List[int] = Field(description="Start and end years for the time period")
  explanation: str = Field(description="Historical significance of this time period")

class StyleConfig(BaseModel):
  level: str = Field(description="Level of style detail (movement/sub_movement/specific)")
  options: List[str] = Field(description="Available artistic styles for selection")
  explanation: str = Field(description="Historical context for the artistic styles")

class GeographicalZoom(BaseModel):
  locations: List[Location]
  explanation: str = Field(description="Significance of these locations")

class AxisImpact(BaseModel):
  temporal: Optional[str] = Field(description="How time period affects this axis")
  geographical: Optional[str] = Field(description="How location affects this axis")
  style: Optional[str] = Field(description="How artistic style affects this axis")

class TemporalConfig(BaseModel):
  component: str = Field(default="st.slider")
  current_zoom: ZoomRange
  available_zooms: dict[str, ZoomRange] = Field(description="Available zoom levels (in/out)")
  impacted_by: AxisImpact

class GeographicalConfig(BaseModel):
  component: str = Field(default="st.map")
  current_zoom: GeographicalZoom
  available_zooms: dict[str, GeographicalZoom] = Field(description="Available zoom levels (in/out)")
  impacted_by: AxisImpact

class StyleConfig(BaseModel):
  component: str = Field(default="st.multiselect")
  current_zoom: StyleConfig
  
class Analysis(BaseModel):
  query_focus: str = Field(description="Main subject of the query")
  historical_context: str = Field(description="Brief historical context")

class ArtHistoryResponse(BaseModel):
  analysis: Analysis
  axis_configurations: dict[str, Union[TemporalConfig, GeographicalConfig, StyleConfig]] = \
      Field(description="Configuration for each axis (temporal, geographical, style)")