File tree Expand file tree Collapse file tree 2 files changed +6
-83
lines changed Expand file tree Collapse file tree 2 files changed +6
-83
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -94,29 +94,14 @@ request = OrquestaEndpointRequest(
94
94
metadata = { " customer_id" : " Qwtqwty90281" },
95
95
)
96
96
97
- endpoint_ref = None
97
+ stream_generator = client.endpoints.stream(request)
98
98
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)
119
101
102
+ if chunk.is_final:
103
+ print (" Stream is finished" )
104
+ endpoint_ref = chunk
120
105
```
121
106
122
107
### Logging score and metadata for endpoints
You can’t perform that action at this time.
0 commit comments