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: docs/server/usage.mdx
+25-11Lines changed: 25 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ async_interpreter.server.run(port=8000) # Default port is 8000, but you can cus
25
25
Connect to the WebSocket server at `ws://localhost:8000/`.
26
26
27
27
### Message Format
28
-
The server uses an extended message format that allows for rich, multi-part messages. Here's the basic structure:
28
+
Open Interpreter uses an extended version of OpenAI's message format called [LMC messages](https://docs.openinterpreter.com/protocols/lmc-messages)that allow for rich, multi-part messages.**Messages must be sent between start and end flags.** Here's the basic structure:
To change server settings, send a POST request to `http://localhost:8000/settings`. The payload should conform to the interpreter object's settings.
157
+
To change server settings, send a POST request to `http://localhost:8000/settings`. The payload should conform to [the interpreter object's settings](https://docs.openinterpreter.com/settings/all-settings).
158
158
159
159
Example:
160
160
```python
@@ -216,15 +216,21 @@ When using this endpoint:
216
216
- The `model` parameter is required but ignored.
217
217
- The `api_key` is required by the OpenAI library but not used by the server.
218
218
219
-
## Best Practices
219
+
## Using Docker
220
220
221
-
1. Always handle the "complete" status message to ensure your client knows when the server has finished processing.
222
-
2. If `auto_run` is set to `False`, remember to send the "go" command to execute code blocks and continue the interaction.
223
-
3. Implement proper error handling in your client to manage potential connection issues, unexpected server responses, or server-sent error messages.
224
-
4. Use the AsyncInterpreter class when working with the server in Python to ensure compatibility with asynchronous operations.
225
-
5. Pay attention to the code execution review messages for important safety and operational information.
226
-
6. Utilize the multi-part user message structure for complex inputs, including file paths and images.
227
-
7. When sending file paths or image paths, ensure they are accessible to the server.
221
+
You can also run the server using Docker. First, build the Docker image from the root of the repository:
222
+
223
+
```bash
224
+
docker build -t open-interpreter .
225
+
```
226
+
227
+
Then, run the container:
228
+
229
+
```bash
230
+
docker run -p 8000:8000 open-interpreter
231
+
```
232
+
233
+
This will expose the server on port 8000 of your host machine.
228
234
229
235
## Advanced Usage: Accessing the FastAPI App Directly
230
236
@@ -248,4 +254,12 @@ if __name__ == "__main__":
248
254
uvicorn.run(app, host="0.0.0.0", port=8000)
249
255
```
250
256
251
-
This guide covers all aspects of using the server, including the WebSocket API, HTTP API, OpenAI-compatible endpoint, code execution review, and various features. It provides clear explanations and examples for users to understand how to interact with the server effectively.
257
+
## Best Practices
258
+
259
+
1. Always handle the "complete" status message to ensure your client knows when the server has finished processing.
260
+
2. If `auto_run` is set to `False`, remember to send the "go" command to execute code blocks and continue the interaction.
261
+
3. Implement proper error handling in your client to manage potential connection issues, unexpected server responses, or server-sent error messages.
262
+
4. Use the AsyncInterpreter class when working with the server in Python to ensure compatibility with asynchronous operations.
263
+
5. Pay attention to the code execution review messages for important safety and operational information.
264
+
6. Utilize the multi-part user message structure for complex inputs, including file paths and images.
265
+
7. When sending file paths or image paths, ensure they are accessible to the server.
0 commit comments