This commit is contained in:
April M 2025-11-21 05:18:08 -08:00
parent 4112567ca6
commit 1a3d5f2afc

View file

@ -24,11 +24,11 @@ For this quickstart, install OpenRAG with the automatic installer script and bas
cd openrag-workspace cd openrag-workspace
``` ```
2. Run the installer: 2. Run the installer:
```bash ```bash
curl -fsSL https://docs.openr.ag/files/run_openrag_with_prereqs.sh | bash curl -fsSL https://docs.openr.ag/files/run_openrag_with_prereqs.sh | bash
``` ```
The TUI creates a `.env` file and docker-compose files in the current working directory, and then starts OpenRAG. The TUI creates a `.env` file and docker-compose files in the current working directory, and then starts OpenRAG.
@ -116,7 +116,7 @@ Click the **Language Model** component, and then change the **Model Name** to a
When editing built-in flows, you can click **Restore flow** to revert the flow to its initial state. When editing built-in flows, you can click **Restore flow** to revert the flow to its initial state.
4. Press <kbd>Command+S</kbd> (<kbd>Ctrl+S</kbd>) to save your changes. 4. Press <kbd>Command</kbd>+<kbd>S</kbd> (<kbd>Ctrl</kbd>+<kbd>S</kbd>) to save your changes.
You can close the Langflow browser window, or leave it open if you want to continue experimenting with the flow editor. You can close the Langflow browser window, or leave it open if you want to continue experimenting with the flow editor.
@ -151,15 +151,15 @@ This key doesn't grant access to OpenRAG.
<Tabs> <Tabs>
<TabItem value="python" label="Python"> <TabItem value="python" label="Python">
```python ```python
import requests import requests
import os import os
import uuid import uuid
api_key = 'LANGFLOW_API_KEY' api_key = 'LANGFLOW_API_KEY'
url = "http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID" # The complete API endpoint URL for this flow url = "http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID" # The complete API endpoint URL for this flow
# Request payload configuration # Request payload configuration
payload = { payload = {
"output_type": "chat", "output_type": "chat",
@ -167,26 +167,26 @@ This key doesn't grant access to OpenRAG.
"input_value": "hello world!" "input_value": "hello world!"
} }
payload["session_id"] = str(uuid.uuid4()) payload["session_id"] = str(uuid.uuid4())
headers = {"x-api-key": api_key} headers = {"x-api-key": api_key}
try: try:
# Send API request # Send API request
response = requests.request("POST", url, json=payload, headers=headers) response = requests.request("POST", url, json=payload, headers=headers)
response.raise_for_status() # Raise exception for bad status codes response.raise_for_status() # Raise exception for bad status codes
# Print response # Print response
print(response.text) print(response.text)
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
print(f"Error making API request: {e}") print(f"Error making API request: {e}")
except ValueError as e: except ValueError as e:
print(f"Error parsing response: {e}") print(f"Error parsing response: {e}")
``` ```
</TabItem> </TabItem>
<TabItem value="typescript" label="TypeScript"> <TabItem value="typescript" label="TypeScript">
```typescript ```typescript
const crypto = require('crypto'); const crypto = require('crypto');
const apiKey = 'LANGFLOW_API_KEY'; const apiKey = 'LANGFLOW_API_KEY';
@ -196,7 +196,7 @@ This key doesn't grant access to OpenRAG.
"input_value": "hello world!" "input_value": "hello world!"
}; };
payload.session_id = crypto.randomUUID(); payload.session_id = crypto.randomUUID();
const options = { const options = {
method: 'POST', method: 'POST',
headers: { headers: {
@ -205,16 +205,16 @@ This key doesn't grant access to OpenRAG.
}, },
body: JSON.stringify(payload) body: JSON.stringify(payload)
}; };
fetch('http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID', options) fetch('http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID', options)
.then(response => response.json()) .then(response => response.json())
.then(response => console.warn(response)) .then(response => console.warn(response))
.catch(err => console.error(err)); .catch(err => console.error(err));
``` ```
</TabItem> </TabItem>
<TabItem value="curl" label="curl"> <TabItem value="curl" label="curl">
```bash ```bash
curl --request POST \ curl --request POST \
--url 'http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID?stream=false' \ --url 'http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID?stream=false' \
@ -226,7 +226,7 @@ This key doesn't grant access to OpenRAG.
"input_value": "hello world!" "input_value": "hello world!"
}' }'
``` ```
</TabItem> </TabItem>
</Tabs> </Tabs>
@ -251,4 +251,4 @@ For all installation options, see [Install OpenRAG with TUI](/install) and [Inst
* **Learn more about OpenRAG**: Explore OpenRAG and the OpenRAG documentation to learn more about its features and functionality. * **Learn more about OpenRAG**: Explore OpenRAG and the OpenRAG documentation to learn more about its features and functionality.
* **Learn more about the Langflow**: For a deep dive on the Langflow API and visual editor, see the [Langflow documentation](https://docs.langflow.org/). * **Learn more about Langflow**: For a deep dive on the Langflow API and visual editor, see the [Langflow documentation](https://docs.langflow.org/).