Skip to content

Commit 8be8a5a

Browse files
authored
chore: template tool models should reside in tool module (#188)
1 parent a025990 commit 8be8a5a

3 files changed

Lines changed: 22 additions & 23 deletions

File tree

src/deepset_mcp/api/pipeline_template/models.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,3 @@ def populate_yaml_config(cls, values: Any) -> Any:
7474
values["yaml_config"] = yaml_config
7575

7676
return values
77-
78-
79-
class PipelineTemplateSearchResult(BaseModel):
80-
"""Model representing a search result for pipeline templates."""
81-
82-
template: PipelineTemplate
83-
"Pipeline template that matched the search criteria"
84-
similarity_score: float
85-
"Relevance score indicating how well the template matches the search"
86-
87-
88-
class PipelineTemplateSearchResults(BaseModel):
89-
"""Response model for pipeline template search results."""
90-
91-
results: list[PipelineTemplateSearchResult]
92-
"List of pipeline templates matching the search criteria"
93-
query: str
94-
"Original search query string"
95-
total_found: int
96-
"Total number of templates found matching the search criteria"

src/deepset_mcp/tools/pipeline_template.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
import numpy as np
6+
from pydantic import BaseModel
67

78
from deepset_mcp.api.exceptions import ResourceNotFoundError, UnexpectedAPIError
89
from deepset_mcp.api.pipeline_template.models import (
910
PipelineTemplate,
10-
PipelineTemplateSearchResult,
11-
PipelineTemplateSearchResults,
1211
PipelineType,
1312
)
1413
from deepset_mcp.api.protocols import AsyncClientProtocol
@@ -61,6 +60,26 @@ async def get_template(*, client: AsyncClientProtocol, workspace: str, template_
6160
return f"Failed to fetch pipeline template '{template_name}': {e}"
6261

6362

63+
class PipelineTemplateSearchResult(BaseModel):
64+
"""Model representing a search result for pipeline templates."""
65+
66+
template: PipelineTemplate
67+
"Pipeline template that matched the search criteria"
68+
similarity_score: float
69+
"Relevance score indicating how well the template matches the search"
70+
71+
72+
class PipelineTemplateSearchResults(BaseModel):
73+
"""Response model for pipeline template search results."""
74+
75+
results: list[PipelineTemplateSearchResult]
76+
"List of pipeline templates matching the search criteria"
77+
query: str
78+
"Original search query string"
79+
total_found: int
80+
"Total number of templates found matching the search criteria"
81+
82+
6483
async def search_templates(
6584
*,
6685
client: AsyncClientProtocol,

test/unit/tools/test_pipeline_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
from deepset_mcp.api.exceptions import ResourceNotFoundError, UnexpectedAPIError
1212
from deepset_mcp.api.pipeline_template.models import (
1313
PipelineTemplate,
14-
PipelineTemplateSearchResults,
1514
PipelineTemplateTag,
1615
PipelineType,
1716
)
1817
from deepset_mcp.api.shared_models import PaginatedResponse
1918
from deepset_mcp.tools.model_protocol import ModelProtocol
2019
from deepset_mcp.tools.pipeline_template import (
20+
PipelineTemplateSearchResults,
2121
get_template,
2222
list_templates,
2323
search_templates,

0 commit comments

Comments
 (0)