|
5 | 5 | import asyncio |
6 | 6 |
|
7 | 7 | import yaml |
| 8 | +from pydantic import BaseModel |
8 | 9 |
|
9 | 10 | from deepset_mcp.api.exceptions import BadRequestError, ResourceNotFoundError, UnexpectedAPIError |
10 | 11 | from deepset_mcp.api.pipeline.models import ( |
11 | 12 | DeepsetPipeline, |
12 | 13 | DeepsetSearchResponse, |
13 | 14 | LogLevel, |
14 | 15 | PipelineLog, |
15 | | - PipelineOperationWithErrors, |
16 | 16 | PipelineValidationResult, |
17 | | - PipelineValidationResultWithYaml, |
18 | 17 | ) |
19 | 18 | from deepset_mcp.api.protocols import AsyncClientProtocol |
20 | 19 | from deepset_mcp.api.shared_models import PaginatedResponse |
@@ -55,6 +54,15 @@ async def get_pipeline(*, client: AsyncClientProtocol, workspace: str, pipeline_ |
55 | 54 | return f"Failed to fetch pipeline '{pipeline_name}': {e}" |
56 | 55 |
|
57 | 56 |
|
| 57 | +class PipelineValidationResultWithYaml(BaseModel): |
| 58 | + """Model for pipeline validation result that includes the original YAML.""" |
| 59 | + |
| 60 | + validation_result: PipelineValidationResult |
| 61 | + "Result of validating the pipeline configuration" |
| 62 | + yaml_config: str |
| 63 | + "Original YAML configuration that was validated" |
| 64 | + |
| 65 | + |
58 | 66 | async def validate_pipeline( |
59 | 67 | *, client: AsyncClientProtocol, workspace: str, yaml_configuration: str |
60 | 68 | ) -> PipelineValidationResultWithYaml | str: |
@@ -82,6 +90,17 @@ async def validate_pipeline( |
82 | 90 | return f"Failed to validate pipeline: {e}" |
83 | 91 |
|
84 | 92 |
|
| 93 | +class PipelineOperationWithErrors(BaseModel): |
| 94 | + """Model for pipeline operations that complete with validation errors.""" |
| 95 | + |
| 96 | + message: str |
| 97 | + "Descriptive message about the pipeline operation" |
| 98 | + validation_result: PipelineValidationResult |
| 99 | + "Validation errors encountered during the operation" |
| 100 | + pipeline: DeepsetPipeline |
| 101 | + "Pipeline object after the operation completed" |
| 102 | + |
| 103 | + |
85 | 104 | async def create_pipeline( |
86 | 105 | *, |
87 | 106 | client: AsyncClientProtocol, |
|
0 commit comments