You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sources/platform/integrations/ai/openai_assistants.md
+2-13Lines changed: 2 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,15 +39,10 @@ Import all required packages:
39
39
40
40
import json
41
41
import time
42
-
from typing importTYPE_CHECKING
43
42
44
43
from apify_client import ApifyClient
45
44
from openai import OpenAI, Stream
46
45
from openai.types.beta.threads.run_submit_tool_outputs_params import ToolOutput
47
-
48
-
ifTYPE_CHECKING:
49
-
from openai.types.beta import AssistantStreamEvent
50
-
from openai.types.beta.threads import Run
51
46
```
52
47
53
48
Find your [Apify API token](https://console.apify.com/account/integrations) and [OpenAI API key](https://platform.openai.com/account/api-keys) and initialize OpenAI and Apify clients:
@@ -134,7 +129,7 @@ This function will trigger the RAG-Web-Browser to fetch the search data and subm
134
129
Let's implement the `submit_tool_outputs` function:
135
130
136
131
```python
137
-
defsubmit_tool_outputs(run_: Run) -> Run | Stream[AssistantStreamEvent]:
132
+
defsubmit_tool_outputs(run_):
138
133
""" Submit tool outputs to continue the run """
139
134
tool_output = []
140
135
for tool in run_.required_action.submit_tool_outputs.tool_calls:
@@ -178,15 +173,11 @@ The latest news on LLM is as follows:
178
173
179
174
```python
180
175
import json
181
-
from typing importTYPE_CHECKING
182
176
183
177
from apify_client import ApifyClient
184
178
from openai import OpenAI, Stream
185
179
from openai.types.beta.threads.run_submit_tool_outputs_params import ToolOutput
186
180
187
-
ifTYPE_CHECKING:
188
-
from openai.types.beta import AssistantStreamEvent
0 commit comments