diff --git a/instill/clients/pipeline.py b/instill/clients/pipeline.py index 4a55c33..2d80c73 100644 --- a/instill/clients/pipeline.py +++ b/instill/clients/pipeline.py @@ -145,7 +145,7 @@ def get_operator_definition( return RequestFactory( method=self.hosts[self.instance].async_client.GetOperatorDefinition, request=operator_interface.GetOperatorDefinitionRequest( - name=f"operator-definitions//{name}", + name=f"operator-definitions/{name}", view=operator_interface.GetOperatorDefinitionRequest.VIEW_FULL, ), metadata=self.hosts[self.instance].metadata, @@ -154,7 +154,7 @@ def get_operator_definition( return RequestFactory( method=self.hosts[self.instance].client.GetOperatorDefinition, request=operator_interface.GetOperatorDefinitionRequest( - name=f"operator-definitions//{name}", + name=f"operator-definitions/{name}", view=operator_interface.GetOperatorDefinitionRequest.VIEW_FULL, ), metadata=self.hosts[self.instance].metadata, @@ -173,7 +173,7 @@ def create_pipeline( ) if async_enabled: return RequestFactory( - method=self.hosts[self.instance].async_client.CreateuserPipeline, + method=self.hosts[self.instance].async_client.CreateUserPipeline, request=pipeline_interface.CreateUserPipelineRequest( pipeline=pipeline, parent=self.namespace ), @@ -204,7 +204,7 @@ def get_pipeline( ).send_async() return RequestFactory( - method=self.hosts[self.instance].client.CreateUserPipeline, + method=self.hosts[self.instance].client.GetUserPipeline, request=pipeline_interface.GetUserPipelineRequest( name=f"{self.namespace}/pipelines/{name}" ), @@ -364,7 +364,7 @@ def delete_pipeline( self, name: str, async_enabled: bool = False, - ) -> pipeline_interface.DeleteUserPipelineReleaseResponse: + ) -> pipeline_interface.DeleteUserPipelineResponse: if async_enabled: return RequestFactory( method=self.hosts[self.instance].async_client.DeleteUserPipeline, diff --git a/instill/resources/connector.py b/instill/resources/connector.py index c377a37..34dce3d 100644 --- a/instill/resources/connector.py +++ b/instill/resources/connector.py @@ -16,10 +16,8 @@ def __init__( ) -> None: super().__init__() self.client = client - connector = client.pipeline_service.get_connector( - name=name, silent=True - ).connector - if connector is None: + get_resp = client.pipeline_service.get_connector(name=name, silent=True) + if get_resp is None: connector = client.pipeline_service.create_connector( name=name, definition=definition, @@ -27,6 +25,8 @@ def __init__( ).connector if connector is None: raise BaseException("connector creation failed") + else: + connector = get_resp.connector self.resource = connector diff --git a/instill/resources/connector_ai.py b/instill/resources/connector_ai.py index 7adc8ce..3427b6c 100644 --- a/instill/resources/connector_ai.py +++ b/instill/resources/connector_ai.py @@ -10,11 +10,11 @@ def __init__( name: str, server_url: str, ) -> None: - definition = "connector-definitions/ai-instill-model" + definition = "connector-definitions/instill-model" configuration = { "api_token": client.pipeline_service.hosts[ client.pipeline_service.instance - ]["token"], + ].token, "server_url": server_url, } super().__init__(client, name, definition, configuration) @@ -27,7 +27,7 @@ def __init__( name: str, api_key: str, ) -> None: - definition = "connector-definitions/ai-stability-ai" + definition = "connector-definitions/stability-ai" configuration = {"api_key": api_key} super().__init__(client, name, definition, configuration) @@ -39,7 +39,7 @@ def __init__( name: str, api_key: str, ) -> None: - definition = "connector-definitions/ai-openai" + definition = "connector-definitions/openai" configuration = { "api_key": api_key, } diff --git a/instill/resources/connector_blockchain.py b/instill/resources/connector_blockchain.py index b8a0fc4..f86eefa 100644 --- a/instill/resources/connector_blockchain.py +++ b/instill/resources/connector_blockchain.py @@ -14,7 +14,7 @@ def __init__( metadata_structured_data: bool, metadata_metadata: bool, ) -> None: - definition = "connector-definitions/blockchain-numbers" + definition = "connector-definitions/numbers" configuration = { "capture_token": capture_token, "asset_type": asset_type, diff --git a/instill/resources/connector_data.py b/instill/resources/connector_data.py index 936d29b..c7888a1 100644 --- a/instill/resources/connector_data.py +++ b/instill/resources/connector_data.py @@ -11,6 +11,6 @@ def __init__( api_key: str, server_url: str, ) -> None: - definition = "connector-definitions/data-pinecone" + definition = "connector-definitions/pinecone" configuration = {"url": server_url, "api_key": api_key} super().__init__(client, name, definition, configuration) diff --git a/instill/resources/model.py b/instill/resources/model.py index 8b1f6b5..6fb7590 100644 --- a/instill/resources/model.py +++ b/instill/resources/model.py @@ -17,8 +17,8 @@ def __init__( ) -> None: super().__init__() self.client = client - model = client.model_service.get_model(model_name=name, silent=True) - if model is None: + get_resp = client.model_service.get_model(model_name=name, silent=True) + if get_resp is None: operation = client.model_service.create_model( name=name, definition=definition, @@ -42,6 +42,8 @@ def __init__( model = client.model_service.get_model(model_name=name).model else: raise BaseException("model creation failed") + else: + model = get_resp.model self.resource = model diff --git a/instill/resources/operator.py b/instill/resources/operator.py index 8c779ec..8e6db27 100644 --- a/instill/resources/operator.py +++ b/instill/resources/operator.py @@ -5,7 +5,7 @@ def create_start_operator(config: dict) -> pipeline_pb.Component: start_operator_component = pipeline_pb.Component() start_operator_component.id = "start" - start_operator_component.definition_name = "operator-definitions/op-start" + start_operator_component.definition_name = "operator-definitions/start" start_operator_component.configuration.update(config) return start_operator_component @@ -14,7 +14,7 @@ def create_start_operator(config: dict) -> pipeline_pb.Component: def create_end_operator(config: dict) -> pipeline_pb.Component: end_operator_component = pipeline_pb.Component() end_operator_component.id = "end" - end_operator_component.definition_name = "operator-definitions/op-end" + end_operator_component.definition_name = "operator-definitions/end" end_operator_component.configuration.update(config) return end_operator_component diff --git a/instill/resources/pipeline.py b/instill/resources/pipeline.py index 35b9a1a..cbd9210 100644 --- a/instill/resources/pipeline.py +++ b/instill/resources/pipeline.py @@ -17,13 +17,15 @@ def __init__( ) -> None: super().__init__() self.client = client - pipeline = client.pipeline_service.get_pipeline(name=name, silent=True).pipeline - if pipeline is None: + get_resp = client.pipeline_service.get_pipeline(name=name, silent=True) + if get_resp is None: pipeline = client.pipeline_service.create_pipeline( name=name, recipe=recipe ).pipeline if pipeline is None: raise BaseException("pipeline creation failed") + else: + pipeline = get_resp.pipeline self.resource = pipeline