Skip to content

Commit 9c019eb

Browse files
chore: add missing docstrings
1 parent 831b67d commit 9c019eb

40 files changed

+209
-0
lines changed

src/contextual/types/agent_configs.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414

1515
class ACLConfig(BaseModel):
16+
"""Parameters that affect the agent's ACL workflow"""
17+
1618
acl_active: Optional[bool] = None
1719
"""Whether to enable ACL."""
1820

@@ -21,6 +23,8 @@ class ACLConfig(BaseModel):
2123

2224

2325
class ReformulationConfig(BaseModel):
26+
"""Parameters that affect the agent's query reformulation"""
27+
2428
enable_query_decomposition: Optional[bool] = None
2529
"""Whether to enable query decomposition."""
2630

@@ -35,6 +39,8 @@ class ReformulationConfig(BaseModel):
3539

3640

3741
class TranslationConfig(BaseModel):
42+
"""Parameters that affect the agent's translation workflow"""
43+
3844
translate_confidence: Optional[float] = None
3945
"""The confidence threshold for translation."""
4046

@@ -43,6 +49,8 @@ class TranslationConfig(BaseModel):
4349

4450

4551
class AgentConfigs(BaseModel):
52+
"""Response to configs for different components"""
53+
4654
acl_config: Optional[ACLConfig] = None
4755
"""Parameters that affect the agent's ACL workflow"""
4856

src/contextual/types/agent_configs_param.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313

1414
class ACLConfig(TypedDict, total=False):
15+
"""Parameters that affect the agent's ACL workflow"""
16+
1517
acl_active: bool
1618
"""Whether to enable ACL."""
1719

@@ -20,6 +22,8 @@ class ACLConfig(TypedDict, total=False):
2022

2123

2224
class ReformulationConfig(TypedDict, total=False):
25+
"""Parameters that affect the agent's query reformulation"""
26+
2327
enable_query_decomposition: bool
2428
"""Whether to enable query decomposition."""
2529

@@ -34,6 +38,8 @@ class ReformulationConfig(TypedDict, total=False):
3438

3539

3640
class TranslationConfig(TypedDict, total=False):
41+
"""Parameters that affect the agent's translation workflow"""
42+
3743
translate_confidence: float
3844
"""The confidence threshold for translation."""
3945

@@ -42,6 +48,8 @@ class TranslationConfig(TypedDict, total=False):
4248

4349

4450
class AgentConfigsParam(TypedDict, total=False):
51+
"""Response to configs for different components"""
52+
4553
acl_config: ACLConfig
4654
"""Parameters that affect the agent's ACL workflow"""
4755

src/contextual/types/agent_metadata.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111

1212
class AgentUsages(BaseModel):
13+
"""Total API request counts for the agent."""
14+
1315
eval: int
1416
"""eval request count"""
1517

@@ -21,6 +23,8 @@ class AgentUsages(BaseModel):
2123

2224

2325
class AgentMetadata(BaseModel):
26+
"""Response to GET Agent request"""
27+
2428
datastore_ids: List[str]
2529
"""The IDs of the datastore(s) associated with the agent"""
2630

src/contextual/types/agent_metadata_response.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212

1313
class GetTwilightAgentResponseAgentUsages(BaseModel):
14+
"""Total API request counts for the agent."""
15+
1416
eval: int
1517
"""eval request count"""
1618

@@ -22,6 +24,8 @@ class GetTwilightAgentResponseAgentUsages(BaseModel):
2224

2325

2426
class GetTwilightAgentResponse(BaseModel):
27+
"""Response to GET Agent request"""
28+
2529
datastore_ids: List[str]
2630
"""The IDs of the datastore(s) associated with the agent"""
2731

src/contextual/types/agents/query_create_params.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ class QueryCreateParams(TypedDict, total=False):
102102

103103

104104
class Message(TypedDict, total=False):
105+
"""Message object for a message sent or received in a conversation"""
106+
105107
content: Required[str]
106108
"""Content of the message"""
107109

@@ -116,6 +118,10 @@ class Message(TypedDict, total=False):
116118

117119

118120
class OverrideConfiguration(TypedDict, total=False):
121+
"""
122+
This will modify select configuration parameters for the agent during the response generation.
123+
"""
124+
119125
enable_filter: bool
120126
"""Override the filter_retrievals for the query.
121127
@@ -184,6 +190,8 @@ class OverrideConfiguration(TypedDict, total=False):
184190

185191

186192
class StructuredOutput(TypedDict, total=False):
193+
"""Custom output structure format."""
194+
187195
json_schema: Required[Dict[str, object]]
188196
"""The output json structure."""
189197

src/contextual/types/agents/query_feedback_response.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66

77

88
class QueryFeedbackResponse(BaseModel):
9+
"""Response schema for feedback submission endpoint."""
10+
911
feedback_id: str
1012
"""ID of the submitted or updated feedback."""

src/contextual/types/agents/query_response.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020

2121
class RetrievalContentCtxlMetadata(BaseModel):
22+
"""Default metadata from the retrieval"""
23+
2224
chunk_id: Optional[str] = None
2325
"""Unique identifier for the chunk."""
2426

@@ -80,6 +82,8 @@ class RetrievalContentCustomMetadataConfig(BaseModel):
8082

8183

8284
class RetrievalContent(BaseModel):
85+
"""Retrieval content object typing for v0.1 API."""
86+
8387
content_id: str
8488
"""Unique identifier of the retrieved content"""
8589

@@ -146,6 +150,8 @@ class RetrievalContent(BaseModel):
146150

147151

148152
class Attribution(BaseModel):
153+
"""Attribution for some claim made in a generated message`."""
154+
149155
content_ids: List[str]
150156
"""Content IDs of the sources for the attributed text"""
151157

@@ -157,6 +163,8 @@ class Attribution(BaseModel):
157163

158164

159165
class GroundednessScore(BaseModel):
166+
"""Groundedness scores in a generated message`."""
167+
160168
end_idx: int
161169
"""End index of the span in the generated message"""
162170

@@ -168,6 +176,8 @@ class GroundednessScore(BaseModel):
168176

169177

170178
class Message(BaseModel):
179+
"""Response to the query request"""
180+
171181
content: str
172182
"""Content of the message"""
173183

@@ -179,6 +189,8 @@ class Message(BaseModel):
179189

180190

181191
class QueryResponse(BaseModel):
192+
"""Response body for POST /query"""
193+
182194
conversation_id: str
183195
"""A unique identifier for the conversation.
184196

src/contextual/types/create_agent_output.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99

1010
class CreateAgentOutput(BaseModel):
11+
"""Response to POST /agents request"""
12+
1113
id: str
1214
"""ID of the agent"""
1315

src/contextual/types/datastore.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111

1212
class ConfigurationChunking(BaseModel):
13+
"""Configuration for document chunking"""
14+
1315
chunking_mode: Optional[Literal["hierarchy_depth", "hierarchy_heading", "static_length", "page_level"]] = None
1416
"""Chunking mode to use.
1517
@@ -41,6 +43,8 @@ class ConfigurationChunking(BaseModel):
4143

4244

4345
class ConfigurationHTMLConfig(BaseModel):
46+
"""Configuration for HTML Extraction"""
47+
4448
max_chunk_length_tokens: Optional[int] = None
4549
"""Target maximum length of text tokens chunks for chunking.
4650
@@ -49,6 +53,8 @@ class ConfigurationHTMLConfig(BaseModel):
4953

5054

5155
class ConfigurationParsing(BaseModel):
56+
"""Configuration for document parsing"""
57+
5258
enable_split_tables: Optional[bool] = None
5359
"""
5460
Whether to enable table splitting, which splits large tables into smaller tables
@@ -79,6 +85,8 @@ class ConfigurationParsing(BaseModel):
7985

8086

8187
class Configuration(BaseModel):
88+
"""Configuration of the datastore"""
89+
8290
chunking: Optional[ConfigurationChunking] = None
8391
"""Configuration for document chunking"""
8492

@@ -90,6 +98,8 @@ class Configuration(BaseModel):
9098

9199

92100
class Datastore(BaseModel):
101+
"""Datastore output entry with additional fields for public API."""
102+
93103
id: str
94104
"""ID of the datastore"""
95105

src/contextual/types/datastore_create_params.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class DatastoreCreateParams(TypedDict, total=False):
2222

2323

2424
class ConfigurationChunking(TypedDict, total=False):
25+
"""Configuration for document chunking"""
26+
2527
chunking_mode: Literal["hierarchy_depth", "hierarchy_heading", "static_length", "page_level"]
2628
"""Chunking mode to use.
2729
@@ -53,6 +55,8 @@ class ConfigurationChunking(TypedDict, total=False):
5355

5456

5557
class ConfigurationHTMLConfig(TypedDict, total=False):
58+
"""Configuration for HTML Extraction"""
59+
5660
max_chunk_length_tokens: int
5761
"""Target maximum length of text tokens chunks for chunking.
5862
@@ -61,6 +65,8 @@ class ConfigurationHTMLConfig(TypedDict, total=False):
6165

6266

6367
class ConfigurationParsing(TypedDict, total=False):
68+
"""Configuration for document parsing"""
69+
6470
enable_split_tables: bool
6571
"""
6672
Whether to enable table splitting, which splits large tables into smaller tables
@@ -91,6 +97,8 @@ class ConfigurationParsing(TypedDict, total=False):
9197

9298

9399
class Configuration(TypedDict, total=False):
100+
"""Configuration of the datastore. If not provided, default configuration is used."""
101+
94102
chunking: ConfigurationChunking
95103
"""Configuration for document chunking"""
96104

0 commit comments

Comments
 (0)