peer review
This commit is contained in:
parent
ba6d25679a
commit
f2a7910cc8
2 changed files with 100 additions and 98 deletions
|
|
@ -235,13 +235,14 @@ If the TUI detects OAuth credentials, it enforces the **Advanced Setup** path.
|
||||||
|
|
||||||
<PartialOnboarding />
|
<PartialOnboarding />
|
||||||
|
|
||||||
## Close the OpenRAG TUI
|
## Exit the OpenRAG TUI
|
||||||
|
|
||||||
To close the OpenRAG TUI, press <kbd>q</kbd>.
|
To exit the OpenRAG TUI, press <kbd>q</kbd>.
|
||||||
The OpenRAG containers will continue to be served until the containers are stopped.
|
The OpenRAG containers continue to run until they are stopped.
|
||||||
For more information, see [Manage OpenRAG containers with the TUI ](#tui-container-management).
|
For more information, see [Manage OpenRAG containers with the TUI ](#tui-container-management).
|
||||||
|
|
||||||
To start the TUI again, run `uv run openrag`.
|
To relaunch the TUI, run `uv run openrag`.
|
||||||
|
If you installed OpenRAG with `uvx`, run `uvx openrag`.
|
||||||
|
|
||||||
## Manage OpenRAG containers with the TUI {#tui-container-management}
|
## Manage OpenRAG containers with the TUI {#tui-container-management}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@ For this quickstart, install OpenRAG with the automatic installer script and bas
|
||||||
|
|
||||||
1. Create a directory to store the OpenRAG configuration files, and then change to that directory:
|
1. Create a directory to store the OpenRAG configuration files, and then change to that directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir openrag-workspace
|
mkdir openrag-workspace
|
||||||
cd openrag-workspace
|
cd openrag-workspace
|
||||||
```
|
```
|
||||||
|
|
||||||
2. [Download the OpenRAG install script](https://docs.openr.ag/files/run_openrag_with_prereqs.sh), move it to your OpenRAG directory, and then run it:
|
2. [Download the OpenRAG install script](https://docs.openr.ag/files/run_openrag_with_prereqs.sh), move it to your OpenRAG directory, and then run it:
|
||||||
|
|
||||||
|
|
@ -37,26 +37,27 @@ For this quickstart, install OpenRAG with the automatic installer script and bas
|
||||||
|
|
||||||
3. Select **Basic Setup**.
|
3. Select **Basic Setup**.
|
||||||
|
|
||||||
4. Click **Generate Passwords** to automatically generate OpenRAG passwords.
|
4. Create passwords for your OpenRAG installation's OpenSearch and Langflow services. You can click **Generate Passwords** to automatically generate passwords.
|
||||||
|
|
||||||
5. Click **Start All Services**, and then wait while the startup process pulls and runs the necessary container images.
|
The OpenSearch password is required. The Langflow admin password is optional.
|
||||||
This can take a few minutes.
|
If you don't generate a Langflow admin password, Langflow runs in [autologin mode](https://docs.langflow.org/api-keys-and-authentication#langflow-auto-login) with no password required.
|
||||||
Proceed when you see the following messages in the TUI:
|
|
||||||
|
|
||||||
```bash
|
Your passwords are saved in the `.env` file that is used to start OpenRAG.
|
||||||
Services started successfully
|
You can find this file in your OpenRAG installation directory.
|
||||||
Command completed successfully
|
|
||||||
```
|
|
||||||
|
|
||||||
6. To open the OpenRAG application, navigate to the TUI main menu, and then click **Open App**.
|
5. Click **Save Configuration**, and then click **Start All Services**.
|
||||||
|
|
||||||
|
Wait a few minutes while the startup process pulls and runs the necessary container images.
|
||||||
|
Proceed when you see the following messages in the terminal user interface (TUI):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Services started successfully
|
||||||
|
Command completed successfully
|
||||||
|
```
|
||||||
|
|
||||||
|
6. To open the OpenRAG application, go to the TUI main menu, and then click **Open App**.
|
||||||
Alternatively, in your browser, navigate to `localhost:3000`.
|
Alternatively, in your browser, navigate to `localhost:3000`.
|
||||||
|
|
||||||
:::tip
|
|
||||||
To quit OpenRAG, go to the TUI main menu, and then press <kbd>q</kbd>.
|
|
||||||
|
|
||||||
To restart OpenRAG, run `uvx openrag`.
|
|
||||||
:::
|
|
||||||
|
|
||||||
7. Select the **OpenAI** model provider, enter your OpenAI API key, and then click **Complete**.
|
7. Select the **OpenAI** model provider, enter your OpenAI API key, and then click **Complete**.
|
||||||
|
|
||||||
For this quickstart, you can use the default options for the model settings.
|
For this quickstart, you can use the default options for the model settings.
|
||||||
|
|
@ -140,98 +141,98 @@ You can send and receive requests with the Langflow API using Python, TypeScript
|
||||||
2. Create a [Langflow API key](https://docs.langflow.org/api-keys-and-authentication), which is a user-specific token required to send requests to the Langflow server.
|
2. Create a [Langflow API key](https://docs.langflow.org/api-keys-and-authentication), which is a user-specific token required to send requests to the Langflow server.
|
||||||
This key doesn't grant access to OpenRAG.
|
This key doesn't grant access to OpenRAG.
|
||||||
|
|
||||||
1. In the Langflow visual editor, click your user icon in the header, and then select **Settings**.
|
1. In the Langflow visual editor, click your user icon in the header, and then select **Settings**.
|
||||||
2. Click **Langflow API Keys**, and then click <Icon name="Plus" aria-hidden="true"/> **Add New**.
|
2. Click **Langflow API Keys**, and then click <Icon name="Plus" aria-hidden="true"/> **Add New**.
|
||||||
3. Name your key, and then click **Create API Key**.
|
3. Name your key, and then click **Create API Key**.
|
||||||
4. Copy the API key and store it securely.
|
4. Copy the API key and store it securely.
|
||||||
5. Exit the Langflow **Settings** page to return to the visual editor.
|
5. Exit the Langflow **Settings** page to return to the visual editor.
|
||||||
|
|
||||||
3. Click **Share**, and then select **API access** to get pregenerated code snippets that call the Langflow API and run the flow.
|
3. Click **Share**, and then select **API access** to get pregenerated code snippets that call the Langflow API and run the flow.
|
||||||
|
|
||||||
These code snippets construct API requests with your Langflow server URL (`LANGFLOW_SERVER_ADDRESS`), the flow to run (`FLOW_ID`), required headers (`LANGFLOW_API_KEY`, `Content-Type`), and a payload containing the required inputs to run the flow, including a default chat input message.
|
These code snippets construct API requests with your Langflow server URL (`LANGFLOW_SERVER_ADDRESS`), the flow to run (`FLOW_ID`), required headers (`LANGFLOW_API_KEY`, `Content-Type`), and a payload containing the required inputs to run the flow, including a default chat input message.
|
||||||
|
|
||||||
In production, you might modify the inputs to suit your application logic. For example, you might replace the default chat input message with dynamic user input.
|
In production, you might modify the inputs to suit your application logic. For example, you might replace the default chat input message with dynamic user input.
|
||||||
|
|
||||||
<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",
|
||||||
"input_type": "chat",
|
"input_type": "chat",
|
||||||
"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';
|
||||||
const payload = {
|
const payload = {
|
||||||
"output_type": "chat",
|
"output_type": "chat",
|
||||||
"input_type": "chat",
|
"input_type": "chat",
|
||||||
"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: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
"x-api-key": apiKey
|
"x-api-key": apiKey
|
||||||
},
|
},
|
||||||
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' \
|
||||||
--header 'Content-Type: application/json' \
|
--header 'Content-Type: application/json' \
|
||||||
--header "x-api-key: LANGFLOW_API_KEY" \
|
--header "x-api-key: LANGFLOW_API_KEY" \
|
||||||
--data '{
|
--data '{
|
||||||
"output_type": "chat",
|
"output_type": "chat",
|
||||||
"input_type": "chat",
|
"input_type": "chat",
|
||||||
"input_value": "hello world!"
|
"input_value": "hello world!"
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
4. Copy your preferred snippet (Python, TypeScript, or curl), and then run it:
|
4. Copy your preferred snippet (Python, TypeScript, or curl), and then run it:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue