-
Notifications
You must be signed in to change notification settings - Fork 4
feat: enable publishing pipelines and indexes to deepset AI platfrom #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
111 commits
Select commit
Hold shift + click to select a range
ef3ac58
enable publish
008f8d9
fixes
87d5189
fixes
baad64a
fixes
d08263d
format fixes
74fecc8
format fixes
95de355
format fixes
de32116
format fixes
3ecb002
format fixes
9e3062f
format fixes
bd46340
fix sorting
2d182aa
optimize input/ouput validations if else statements
d37a325
early return in Pipeline import
96f02e8
change to debug log status
0c9e746
Add an SDK class with init method
0293cbc
rephrase pydoc style
504db6d
rephrase pydoc style
ab70b37
Update deepset_cloud_sdk/workflows/pipeline_client/pipeline_service.py
faymarie 20c1123
support sync and async publishing
b39abca
use yaml parsing
30ff1ef
fix docstrings
d7ee0d6
fix docstrings
a52ec42
fix test interference
0d0e8f9
Merge branch 'main' into feat/support-pipeline-publishing
faymarie fe57e85
fix format
9b9802f
Merge branch 'feat/support-pipeline-publishing' of github.com:deepset…
6b831e6
use separate configs for Index and Pipeline
1414ef5
add docstrings directly to code
8665122
add docstrings directly to code
6d20c97
formatting
f793377
docs fixes
621b9cc
revert local version
947baa8
close event loop if it was newly created
79944fd
test exception
24adfbb
use Mock object
a1ff3e6
remove changed stout
f3671ba
Update deepset_cloud_sdk/workflows/pipeline_client/pipeline_service.py
faymarie 395220f
reset rate limiter in tests
0357e26
Merge branch 'feat/support-pipeline-publishing' of github.com:deepset…
17ece95
fix import
4f0d420
re-add log configs
1e5e08e
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie fd35e31
Update deepset_cloud_sdk/workflows/pipeline_client/pipeline_service.py
faymarie fbfddd8
Update deepset_cloud_sdk/workflows/pipeline_client/pipeline_service.py
faymarie 25df212
move _convert_to_yaml_dict to models
98bb19a
rename to _from_haystack_pipelin
eb66eff
haystack version
ae68611
rename to import instead of publish
15ee65d
revert python version
355dad2
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 548ddb8
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie c91400e
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 861d929
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 74d2bd3
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 5b8403e
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 33495b5
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 2c277b1
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 2391417
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie f54edb9
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 9eaff55
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 8f27c50
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie bce1ffe
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie a8a3022
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 7a90fdc
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 57cba62
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 6255e24
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 2c99adb
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 8b9b8ca
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 567ccdc
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie ea42525
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 7e55416
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 66944cf
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 9950e96
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie d446f67
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 19b01fb
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 0a4cfa3
fix dics
7294f9e
Update deepset_cloud_sdk/workflows/pipeline_client/pipeline_service.py
faymarie 29470c6
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 3be9b59
Update deepset_cloud_sdk/workflows/pipeline_client/pipeline_service.py
faymarie cff5266
fix docs
b33bbcf
Merge branch 'main' into feat/support-pipeline-publishing
faymarie 1a7e0f6
fix docs
224b154
Merge branch 'feat/support-pipeline-publishing' of github.com:deepset…
dd71919
fix docs
8c03b03
fix docs
f7bfaf2
fix docs
b51a45e
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 53e7c66
Update deepset_cloud_sdk/workflows/pipeline_client/models.py
faymarie 002d381
fix docs
a19c0f4
fix docs
99750b3
fix docs
68d0c2f
add fullstops
aafa786
from future import annothations
6a3023e
Update deepset_cloud_sdk/workflows/pipeline_client/pipeline_service.py
faymarie 6f697b1
Update deepset_cloud_sdk/workflows/sdk.py
faymarie 7f3d17e
from future import annothations
9834bb9
update docstring to use paramater
7e36c0f
remove initilized
5e6a5bf
disable too few public methods
764563d
Update deepset_cloud_sdk/workflows/pipeline_client/pipeline_service.py
faymarie ff11f92
Update deepset_cloud_sdk/workflows/pipeline_client/pipeline_service.py
faymarie ae3a2bc
Update deepset_cloud_sdk/workflows/pipeline_client/pipeline_service.py
faymarie d4c3f13
Update deepset_cloud_sdk/workflows/pipeline_client/pipeline_service.py
faymarie 09c6e39
fix docstring
402f189
fix docstring
10cd246
fix docstring
f119921
fix docstring
0f71809
fix docstring
801b703
fix docstring
e06ad7b
fix docstring
634b6ed
fix docstring
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,21 @@ | ||
| """Workflows for the deepset cloud SDK.""" | ||
| """Workflows for deepset AI platform SDK.""" | ||
|
|
||
| from deepset_cloud_sdk.workflows.pipeline_client.models import ( | ||
| IndexConfig, | ||
| IndexInputs, | ||
| IndexOutputs, | ||
| PipelineConfig, | ||
| PipelineInputs, | ||
| PipelineOutputs, | ||
| ) | ||
| from deepset_cloud_sdk.workflows.sdk import DeepsetSDK | ||
|
|
||
| __all__ = [ | ||
| "PipelineInputs", | ||
| "IndexInputs", | ||
| "IndexOutputs", | ||
| "PipelineOutputs", | ||
| "IndexConfig", | ||
| "PipelineConfig", | ||
| "DeepsetSDK", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| """Package to enable importing pipelines and indexes to deepset AI platform.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| """Models for the pipeline service.""" | ||
| from typing import List | ||
|
|
||
| from pydantic import BaseModel, Field, model_validator | ||
|
|
||
|
|
||
| class InputOutputBaseModel(BaseModel): | ||
| """Base model for input and output configurations. | ||
|
|
||
| This class provides common functionality for input and output models, such as YAML conversion. | ||
| """ | ||
|
|
||
| def to_yaml_dict(self) -> dict: | ||
| """Convert the model to a YAML-compatible dictionary. | ||
|
|
||
| Clears empty values from the dictionary. | ||
|
|
||
| :return: Dictionary ready for YAML serialization. | ||
| """ | ||
| fields = self.model_dump(exclude_none=True) | ||
| # Remove empty values | ||
| return {k: v for k, v in fields.items() if v} | ||
|
|
||
|
|
||
| class PipelineInputs(InputOutputBaseModel): | ||
| """Pipeline input configuration. | ||
|
|
||
| Defines the components that should receive the Query input and any filters that apply to it. | ||
|
|
||
| :param query: List of components that will receive the `query` input. | ||
| Specify each component in the format: '<component-name>.<run-method-parameter-name>', for example: 'retriever.query' | ||
| :param filters: Optional list of components that will receive the filters input. | ||
| Specify each component using the format: '<component-name>.<run-method-parameter-name>', for example: 'retriever.filters'. | ||
| """ | ||
|
|
||
| model_config = {"extra": "allow"} # Allow additional fields in inputs | ||
|
|
||
| query: List[str] = Field( | ||
| ..., | ||
| description=( | ||
| "List of components and parameters that will receive the `query` input when they are executed. " | ||
| "Use the format: '<component-name>.<run-method-parameter-name>', for example: 'retriever.query'." | ||
| ), | ||
| min_items=1, | ||
|
faymarie marked this conversation as resolved.
|
||
| ) | ||
| filters: List[str] = Field( | ||
| default_factory=list, | ||
| description=( | ||
| "List of components and parameters that will receive the `filters` input when they are executed. " | ||
| "Use the format: '<component-name>.<run-method-parameter-name>', for example: 'retriever.filters'." | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| class PipelineOutputs(InputOutputBaseModel): | ||
| """Pipeline output configuration. | ||
|
|
||
| Specify the components that will output `documents`, `answers`, or both. | ||
| You must include at least one. The outputs of these components become the final output of the pipeline. | ||
|
|
||
| :param documents: Name of the component and parameter that will provide `documents` as output. | ||
| Use the format '<component-name>.<output-parameter>', for example: 'retriever.documents'. | ||
| :param answers: Name of the component and parameter that will provide `answers` as output. | ||
| Use the format '<component-name>.<output-parameter>', for example: 'reader.answers'. | ||
| """ | ||
|
|
||
| model_config = {"extra": "allow"} # Allow additional fields in outputs | ||
|
|
||
| documents: str | None = Field( | ||
| default=None, | ||
| description="Name of the component that will provide `documents` as output. " | ||
|
faymarie marked this conversation as resolved.
|
||
| "Format: '<component-name>.<output-parameter>', for example: 'meta_ranker.documents'", | ||
| ) | ||
| answers: str | None = Field( | ||
| default=None, | ||
| description="Name of the component that will provide `answers` as output. " | ||
| "Format: '<component-name>.<output-parameter>', for example: 'answers_builder.answers'", | ||
| ) | ||
|
|
||
| @model_validator(mode="after") | ||
| def validate_documents_xor_answers(self) -> "PipelineOutputs": | ||
|
faymarie marked this conversation as resolved.
|
||
| """Validate that either `documents`, `answers`, or both are defined.""" | ||
| if not self.documents and not self.answers: | ||
| raise ValueError("Define at least one pipeline output, either 'documents, 'answers' or both.") | ||
| return self | ||
|
|
||
|
|
||
| class IndexOutputs(InputOutputBaseModel): | ||
| """Output configuration for the index. | ||
|
|
||
| Index outputs are optional. | ||
| """ | ||
|
|
||
| model_config = {"extra": "allow"} # Allow additional fields in outputs | ||
|
|
||
|
|
||
| class PipelineConfig(BaseModel): | ||
| """Configuration required to import the pipeline into deepset AI Platform. | ||
|
|
||
| :param name: Name of the pipeline to be imported | ||
| :param inputs: Pipeline input configuration. Use `PipelineInputs` model to define the inputs. | ||
| :param outputs: Pipeline output configuration. Use `PipelineOutputs` model to define the outputs. | ||
| """ | ||
|
|
||
| model_config = {"extra": "forbid"} | ||
|
|
||
| name: str = Field(..., description="The name of the pipeline to be imported", min_length=1) | ||
| inputs: PipelineInputs = Field( | ||
| default_factory=PipelineInputs, | ||
| description=("Pipeline input configuration. Use `PipelineInputs` model to define the inputs."), | ||
| ) | ||
| outputs: PipelineOutputs = Field( | ||
| default_factory=PipelineOutputs, | ||
| description=("Pipeline output configuration. Use `PipelineOutputs` model to define the outputs."), | ||
| ) | ||
|
|
||
|
|
||
| class IndexInputs(InputOutputBaseModel): | ||
| """Configuration required to import an index into deepset AI Platform. | ||
|
|
||
| Defines the index components that should receive the `Files` input. | ||
|
|
||
| :param files: List of components and parameters that should receive files as input. | ||
| Specify the components using the format: '<component-name>.<run-method-parameter-name>', for example: 'file_type_router.sources'. | ||
| """ | ||
|
|
||
| model_config = {"extra": "allow"} # Allow additional fields in inputs | ||
|
|
||
| files: List[str] = Field( | ||
| default_factory=list, | ||
| description=( | ||
| "List of components and parameters that will receive files as input when they're executed. " | ||
| "Format: '<component-name>.<run-parameter-name>', for example: 'file_type_router.sources'." | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| class IndexConfig(BaseModel): | ||
| """Index configuration for importing an index to deepset AI platform. | ||
|
|
||
| :param name: Name of the index to be imported. | ||
| :param inputs: Index input configuration. Use `IndexInputs` model to define the inputs. | ||
| :param outputs: Index output configuration. Optional. Use `IndexOutputs` model to define the outputs. | ||
| """ | ||
|
|
||
| model_config = {"extra": "forbid"} | ||
|
|
||
| name: str = Field(..., description="Name of the index to be imported.", min_length=1) | ||
| inputs: IndexInputs = Field( | ||
| default_factory=IndexInputs, | ||
| description=("Input configuration for the index. Use `IndexInputs` model to define the inputs."), | ||
| ) | ||
| outputs: IndexOutputs | None = Field( | ||
|
faymarie marked this conversation as resolved.
|
||
| default_factory=IndexOutputs, | ||
| description=("Optional output configuration for the index. Use `IndexOutputs` model to define the outputs."), | ||
| ) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.