Skip to content

Commit 487b904

Browse files
committed
Fixes error thrown when no inference pipeline exists
1 parent cd866ea commit 487b904

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

openlayer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ def load_inference_pipeline(
969969
inference_pipeline_data = self.api.get_request(endpoint)
970970
if len(inference_pipeline_data["items"]) == 0:
971971
raise exceptions.OpenlayerResourceNotFound(
972-
f"Inference piepline with name {name} not found."
972+
f"Inference pipeline with name {name} not found."
973973
)
974974

975975
inference_pipeline = InferencePipeline(

openlayer/llm_monitors.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,12 @@ def _load_inference_pipeline(self) -> None:
149149
api_key=self.openlayer_api_key,
150150
)
151151
project = client.load_project(name=self.openlayer_project_name)
152-
inference_pipeline = project.load_inference_pipeline(
153-
name=self.openlayer_inference_pipeline_name
154-
)
152+
if self.openlayer_inference_pipeline_name:
153+
inference_pipeline = project.load_inference_pipeline(
154+
name=self.openlayer_inference_pipeline_name
155+
)
156+
else:
157+
inference_pipeline = project.create_inference_pipeline()
155158

156159
self.inference_pipeline = inference_pipeline
157160

0 commit comments

Comments
 (0)