66 PipelineTemplateList ,
77 PipelineTemplateSearchResult ,
88 PipelineTemplateSearchResults ,
9+ PipelineType ,
910)
1011from deepset_mcp .api .protocols import AsyncClientProtocol
1112from deepset_mcp .tools .model_protocol import ModelProtocol
1213
1314
14- async def list_pipeline_templates (
15+ async def list_templates (
1516 * ,
1617 client : AsyncClientProtocol ,
1718 workspace : str ,
1819 limit : int = 100 ,
1920 field : str = "created_at" ,
2021 order : str = "DESC" ,
21- filter : str | None = None ,
22+ pipeline_type : PipelineType | str | None = None ,
2223) -> PipelineTemplateList | str :
23- """Retrieves a list of all available pipeline templates.
24+ """Retrieves a list of all available pipeline and indexing templates.
2425
2526 :param client: The async client for API requests.
2627 :param workspace: The workspace to list templates from.
2728 :param limit: Maximum number of templates to return (default: 100).
2829 :param field: Field to sort by (default: "created_at").
2930 :param order: Sort order, either "ASC" or "DESC" (default: "DESC").
30- :param filter: OData filter expression to filter templates by criteria .
31+ :param pipeline_type: The type of pipeline to return .
3132
3233 :returns: List of pipeline templates or error message.
3334 """
3435 try :
3536 return await client .pipeline_templates (workspace = workspace ).list_templates (
36- limit = limit , field = field , order = order , filter = filter
37+ limit = limit ,
38+ field = field ,
39+ order = order ,
40+ filter = f"pipeline_type eq '{ pipeline_type } '" if pipeline_type else None ,
3741 )
3842 except ResourceNotFoundError :
3943 return f"There is no workspace named '{ workspace } '. Did you mean to configure it?"
4044 except UnexpectedAPIError as e :
4145 return f"Failed to list pipeline templates: { e } "
4246
4347
44- async def get_pipeline_template (
45- * , client : AsyncClientProtocol , workspace : str , template_name : str
46- ) -> PipelineTemplate | str :
47- """Fetches detailed information for a specific pipeline template, identified by its `template_name`.
48+ async def get_template (* , client : AsyncClientProtocol , workspace : str , template_name : str ) -> PipelineTemplate | str :
49+ """Fetches detailed information for a specific pipeline or indexing template, identified by its `template_name`.
4850
4951 :param client: The async client for API requests.
5052 :param workspace: The workspace to fetch template from.
5153 :param template_name: The name of the template to fetch.
5254
53- :returns: Pipeline template details or error message.
55+ :returns: Pipeline or indexing template details or error message.
5456 """
5557 try :
5658 return await client .pipeline_templates (workspace = workspace ).get_template (template_name = template_name )
@@ -60,22 +62,29 @@ async def get_pipeline_template(
6062 return f"Failed to fetch pipeline template '{ template_name } ': { e } "
6163
6264
63- async def search_pipeline_templates (
64- * , client : AsyncClientProtocol , query : str , model : ModelProtocol , workspace : str , top_k : int = 10
65+ async def search_templates (
66+ * ,
67+ client : AsyncClientProtocol ,
68+ query : str ,
69+ model : ModelProtocol ,
70+ workspace : str ,
71+ top_k : int = 10 ,
72+ pipeline_type : PipelineType | str = PipelineType .QUERY ,
6573) -> PipelineTemplateSearchResults | str :
66- """Searches for pipeline templates based on name or description using semantic similarity.
74+ """Searches for pipeline or indexing templates based on name or description using semantic similarity.
6775
6876 :param client: The API client to use.
6977 :param query: The search query.
7078 :param model: The model to use for computing embeddings.
7179 :param workspace: The workspace to search templates from.
7280 :param top_k: Maximum number of results to return (default: 10).
81+ :param pipeline_type: The type of pipeline to return ('indexing' or 'query'; default: 'query').
7382
7483 :returns: Search results with similarity scores or error message.
7584 """
7685 try :
7786 response = await client .pipeline_templates (workspace = workspace ).list_templates (
78- filter = "pipeline_type eq 'QUERY '"
87+ filter = f "pipeline_type eq '{ pipeline_type } '"
7988 )
8089 except UnexpectedAPIError as e :
8190 return f"Failed to retrieve pipeline templates: { e } "
0 commit comments