Skip to content

Commit 0edb437

Browse files
committed
bump production demo
1 parent 55d8704 commit 0edb437

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

production_demo/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ requires-python = ">=3.10,<3.14"
77
readme = "README.md"
88
dependencies = [
99
"pydantic>=2.10.6",
10-
"restack-ai==0.0.91",
10+
"restack-ai==0.0.92",
1111
"watchfiles>=1.0.4",
1212
"python-dotenv==1.0.1",
1313
"openai>=1.61.0",

production_demo/src/functions/evaluate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from restack_ai.function import function, FunctionFailure, log
1+
from restack_ai.function import function, NonRetryableError, log
22
from openai import OpenAI
33
from pydantic import BaseModel
44

@@ -11,7 +11,7 @@ async def llm_evaluate(input: EvaluateInput) -> str:
1111
client = OpenAI(base_url="http://192.168.205.1:1234/v1/",api_key="llmstudio")
1212
except Exception as e:
1313
log.error(f"Failed to create LLM client {e}")
14-
raise FunctionFailure(f"Failed to create OpenAI client {e}", non_retryable=True) from e
14+
raise NonRetryableError(message=f"Failed to create OpenAI client {e}") from e
1515

1616
prompt = (
1717
f"Evaluate the following joke for humor, creativity, and originality. "

production_demo/src/functions/function.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from restack_ai.function import function, log, FunctionFailure
1+
from restack_ai.function import function, log, NonRetryableError
22

33
tries = 0
44

@@ -14,7 +14,7 @@ async def example_function(input: ExampleFunctionInput) -> str:
1414

1515
if tries == 0:
1616
tries += 1
17-
raise FunctionFailure(message="Simulated failure", non_retryable=False)
17+
raise NonRetryableError(message="Simulated failure")
1818

1919
log.info("example function started", input=input)
2020
return f"Hello, {input.name}!"

production_demo/src/functions/generate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from restack_ai.function import function, FunctionFailure, log
1+
from restack_ai.function import function, NonRetryableError, log
22
from openai import OpenAI
33

44
from pydantic import BaseModel
@@ -13,7 +13,7 @@ async def llm_generate(input: GenerateInput) -> str:
1313
client = OpenAI(base_url="http://192.168.205.1:1234/v1/",api_key="llmstudio")
1414
except Exception as e:
1515
log.error(f"Failed to create LLM client {e}")
16-
raise FunctionFailure(f"Failed to create OpenAI client {e}", non_retryable=True) from e
16+
raise NonRetryableError(message=f"Failed to create OpenAI client {e}") from e
1717

1818
try:
1919
response = client.chat.completions.create(

production_demo/src/workflows/child.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ChildWorkflow:
1515
@workflow.run
1616
async def run(self, input: ChildWorkflowInput):
1717
log.info("ChildWorkflow started")
18-
await workflow.step(example_function, input=ExampleFunctionInput(name='John Doe'), start_to_close_timeout=timedelta(minutes=2))
18+
await workflow.step(function=example_function, function_input=ExampleFunctionInput(name='John Doe'), start_to_close_timeout=timedelta(minutes=2))
1919

2020
await workflow.sleep(1)
2121

0 commit comments

Comments
 (0)