|
20 | 20 |
|
21 | 21 | from typing import Any, Dict, List, Optional, Union, Literal, Annotated |
22 | 22 | from typing_extensions import Self |
23 | | -from pydantic import BaseModel, ConfigDict, Field, field_validator, Discriminator, model_validator |
| 23 | +from pydantic import ( |
| 24 | + BaseModel, |
| 25 | + ConfigDict, |
| 26 | + Field, |
| 27 | + field_validator, |
| 28 | + Discriminator, |
| 29 | + model_validator, |
| 30 | +) |
24 | 31 |
|
25 | 32 |
|
26 | 33 | class ImageConfig(BaseModel): |
@@ -79,7 +86,10 @@ class AgenticConfig(BaseModel): |
79 | 86 |
|
80 | 87 | enabled: bool = Field(default=False, description="Enable agentic extraction") |
81 | 88 | review_agent: bool = Field(default=False, description="Enable review agent") |
82 | | - review_agent_model: str | None= Field(default=None, description="Model used for reviewing and correcting extraction work") |
| 89 | + review_agent_model: str | None = Field( |
| 90 | + default=None, |
| 91 | + description="Model used for reviewing and correcting extraction work", |
| 92 | + ) |
83 | 93 |
|
84 | 94 |
|
85 | 95 | class ExtractionConfig(BaseModel): |
@@ -121,17 +131,16 @@ def parse_int(cls, v: Any) -> int: |
121 | 131 | if isinstance(v, str): |
122 | 132 | return int(v) if v else 0 |
123 | 133 | return int(v) |
124 | | - |
125 | | - @model_validator(mode="after") |
126 | | - def model_validator(self) -> Self: |
127 | 134 |
|
| 135 | + @model_validator(mode="after") |
| 136 | + def set_default_review_agent_model(self) -> Self: |
| 137 | + """Set review_agent_model to extraction model if not specified.""" |
128 | 138 | if not self.agentic.review_agent_model: |
129 | 139 | self.agentic.review_agent_model = self.model |
130 | 140 |
|
131 | 141 | return self |
132 | 142 |
|
133 | 143 |
|
134 | | - |
135 | 144 | class ClassificationConfig(BaseModel): |
136 | 145 | """Document classification configuration""" |
137 | 146 |
|
@@ -434,7 +443,7 @@ class ErrorAnalyzerConfig(BaseModel): |
434 | 443 | "AccessDenied", |
435 | 444 | "ThrottlingException", |
436 | 445 | ], |
437 | | - description="Error patterns to search for in logs" |
| 446 | + description="Error patterns to search for in logs", |
438 | 447 | ) |
439 | 448 | system_prompt: str = Field( |
440 | 449 | default=""" |
@@ -522,11 +531,10 @@ class ErrorAnalyzerConfig(BaseModel): |
522 | 531 | - No time specified: 24 hours (default) |
523 | 532 | |
524 | 533 | IMPORTANT: Do not include any search quality reflections, search quality scores, or meta-analysis sections in your response. Only provide the three required sections: Root Cause, Recommendations, and Evidence.""", |
525 | | - description="System prompt for error analyzer" |
| 534 | + description="System prompt for error analyzer", |
526 | 535 | ) |
527 | 536 | parameters: ErrorAnalyzerParameters = Field( |
528 | | - default_factory=ErrorAnalyzerParameters, |
529 | | - description="Error analyzer parameters" |
| 537 | + default_factory=ErrorAnalyzerParameters, description="Error analyzer parameters" |
530 | 538 | ) |
531 | 539 |
|
532 | 540 |
|
@@ -646,12 +654,10 @@ class AgentsConfig(BaseModel): |
646 | 654 | """Agents configuration""" |
647 | 655 |
|
648 | 656 | error_analyzer: Optional[ErrorAnalyzerConfig] = Field( |
649 | | - default_factory=ErrorAnalyzerConfig, |
650 | | - description="Error analyzer configuration" |
| 657 | + default_factory=ErrorAnalyzerConfig, description="Error analyzer configuration" |
651 | 658 | ) |
652 | 659 | chat_companion: Optional[ChatCompanionConfig] = Field( |
653 | | - default_factory=ChatCompanionConfig, |
654 | | - description="Chat companion configuration" |
| 660 | + default_factory=ChatCompanionConfig, description="Chat companion configuration" |
655 | 661 | ) |
656 | 662 |
|
657 | 663 |
|
|
0 commit comments