Skip to content

Commit 350d3c6

Browse files
committed
feat(core): added better error handling
1 parent 7d40639 commit 350d3c6

File tree

2 files changed

+6
-83
lines changed

2 files changed

+6
-83
lines changed

cases.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

readme.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -94,29 +94,14 @@ request = OrquestaEndpointRequest(
9494
metadata={ "customer_id": "Qwtqwty90281" },
9595
)
9696

97-
endpoint_ref = None
97+
stream_generator = client.endpoints.stream(request)
9898

99-
def handle_next(chunk):
100-
endpoint_ref = chunk
101-
print(f"Received {chunk.content}")
102-
103-
104-
def handle_error(e):
105-
print(f"Error Occurred: {e}")
106-
107-
108-
def handle_completed():
109-
print("Stream completed!")
110-
111-
112-
stream = client.endpoints.stream(
113-
request
114-
).subscribe(
115-
on_next=handle_next,
116-
on_error=handle_error,
117-
on_completed=handle_completed,
118-
)
99+
for chunk in stream_generator:
100+
print("Received data:", chunk.content)
119101

102+
if chunk.is_final:
103+
print("Stream is finished")
104+
endpoint_ref = chunk
120105
```
121106

122107
### Logging score and metadata for endpoints

0 commit comments

Comments
 (0)