Skip to content

Commit

Permalink
AI-assisted docs
Browse files Browse the repository at this point in the history
  • Loading branch information
abrenneke committed Oct 11, 2023
1 parent c274eed commit adb2962
Show file tree
Hide file tree
Showing 27 changed files with 814 additions and 14 deletions.
93 changes: 91 additions & 2 deletions packages/docs/docs/node-reference/abort-graph.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,94 @@
---
title: 'Abort Graph'
id: abort-graph
title: Abort Graph Node
sidebar_label: Abort Graph
---

# Abort Graph Node
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

## Overview

The Abort Graph Node is used to stop the execution of the entire graph immediately. It can either "successfully" abort the graph (early-exit), or "error" abort the graph. This can be useful for stopping the graph under certain conditions, or for handling errors.

![Abort Graph Node Screenshot](./assets/abort-graph-node.png)

<Tabs
defaultValue="inputs"
values={[
{label: 'Inputs', value: 'inputs'},
{label: 'Outputs', value: 'outputs'},
{label: 'Editor Settings', value: 'settings'},
]
}>

<TabItem value="inputs">

## Inputs

| Title | Data Type | Description | Default Value | Notes |
| ------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Data or Error | `any` | The data or error message to be used when aborting the graph. If it's a string, it will be used as the error message for error aborting. | N/A | None |
| Successfully | `boolean` | Determines whether the graph should be aborted successfully or with an error. | true | Only available if the "Successfully Abort" setting is toggled on in the node's settings. Otherwise, the node's setting value will be used. |

</TabItem>

<TabItem value="outputs">

## Outputs

This node does not have any outputs.

</TabItem>

<TabItem value="settings">

## Editor Settings

| Setting | Description | Default Value | Use Input Toggle |
| ------------------ | --------------------------------------------------------------------------------------------------------------------- | ------------- | ---------------- |
| Successfully Abort | Determines whether the graph should be aborted successfully or with an error. | true | Yes |
| Error Message | The error message to be used when aborting the graph with an error. Only used if "Successfully Abort" is not checked. | (Empty) | No |

</TabItem>

</Tabs>

### Example 1: Successfully aborting a graph

1. Add an Abort Graph node to your graph.
2. Make sure the "Successfully Abort" setting is checked.
3. Connect any node to the `Data or Error` input of the Abort Graph node. This could be a condition, a value, or anything else.
4. Run your graph. The graph will abort immediately after the Abort Graph node is processed, and no subsequent nodes will be executed.

### Example 2: Aborting a graph with an error

1. Add an Abort Graph node to your graph.
2. Uncheck the "Successfully Abort" setting.
3. Optionally, enter an error message in the "Error Message" setting. This message will be used as the error message when the graph is aborted.
4. Connect any node to the `Data or Error` input of the Abort Graph node. If this node outputs a string, it will be used as the error message when the graph is aborted.
5. Run your graph. The graph will abort immediately after the Abort Graph node is processed, and no subsequent nodes will be executed. An error message will be displayed, either the one from the `Data or Error` input or the one from the "Error Message" setting.

## Error Handling

The Abort Graph Node does not produce any errors itself. However, it causes the entire graph to stop executing when it is processed, either successfully or with an error.

## FAQ

**Q: What happens if I connect a non-string node to the `Data or Error` input?**

A: If the node outputs a string, it will be used as the error message when the graph is aborted. If it does not output a string, it will be coerced into a string.

**Q: What happens if I connect a node to the `Successfully` input but the "Successfully Abort" setting is not checked?**

A: The `Successfully` input will be ignored, and the graph will be aborted with an error.

**Q: What happens if I don't connect anything to the `Data or Error` input or leave the "Error Message" setting empty?**

A: The graph will be aborted with a default error message of "Graph aborted with error".

## See Also

- [If Node](./if.mdx)
- [If/Else Node](./if-else.mdx)
- [Race Inputs Node](./race-inputs.mdx)
100 changes: 98 additions & 2 deletions packages/docs/docs/node-reference/append-to-dataset.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,101 @@
---
title: 'Append to Dataset'
id: append-to-dataset
title: Append to Dataset Node
sidebar_label: Append to Dataset
---

# Append to Dataset Node
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

![Append to Dataset Node Screenshot](./assets/append-to-dataset-node.png)

## Overview

The Append to Dataset Node is used to append a row of data to a specified dataset. This node is particularly useful when you want to add new data to an existing dataset for further processing or analysis.

The node requires a dataset provider to be available in the context when the graph is being run. The dataset provider is responsible for managing the storage and retrieval of datasets. In the Rivet application, the dataset provider is handled for you automatically.

For more information on datasets, see the [Data Studio](../user-guide/features/data-studio.md) section of the user guide.

<Tabs
defaultValue="inputs"
values={[
{label: 'Inputs', value: 'inputs'},
{label: 'Outputs', value: 'outputs'},
{label: 'Editor Settings', value: 'settings'},
]
}>

<TabItem value="inputs">

## Inputs

| Title | Data Type | Description | Default Value | Notes |
| ---------- | ---------- | ------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------- | -------------------------------------------------------------------------- |
| Data | `string[]` | The data to be appended to the dataset. | (required) | The input will be coerced into a string array if it is not a string array. |
| ID | `string` | The ID for the new row of data. If not provided, a new ID will be generated. | (Automatically generated) | The input will be coerced into a string if it is not a string. |
| Embedding | `vector` | An optional vector that can be associated with the new row of data. | (empty) | The input will be coerced into a vector if it is not a vector. |
| Dataset ID | `string` | The ID of the dataset to append to. This input is only available if `Use Dataset ID Input` is enabled. | (required if if the input toggle for Dataset ID is enabled) | The input will be coerced into a string if it is not a string. |

</TabItem>

<TabItem value="outputs">

## Outputs

| Title | Data Type | Description | Notes |
| ------- | --------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| Dataset | `object` | The new row of data that was appended to the dataset. | The output will be an object containing the ID, data, and embedding of the new row. |
| ID | `string` | The ID of the dataset that the data was appended to. | The output will be the same as the Dataset ID input or the Dataset ID specified in the settings. |

</TabItem>

<TabItem value="settings">

## Editor Settings

| Setting | Description | Default Value | Use Input Toggle | Input Data Type |
| -------------------- | ------------------------------------------------------------------------- | ------------- | ---------------- | --------------- |
| Dataset | The ID of the dataset to append to. | (required) | Yes | `string` |
| Use Dataset ID Input | If enabled, the Dataset ID can be provided via the Dataset ID input port. | False | No | N/A |

</TabItem>

</Tabs>

## Example 1: Append data to a dataset

1. Create an [Array Node](./array.mdx) and set the values to `["John Doe", "30", "Engineer"]`.
2. In the [Data Studio](../user-guide/features/data-studio.md), create a new dataset with the ID `employees`.
3. Create an Append to Dataset Node and set the Dataset ID to `employees`.
4. Connect the Array Node to the `Data` input of the Append to Dataset Node.
5. Run the graph. The `Dataset` output of the Append to Dataset Node should contain the new row of data that was appended to the `employees` dataset.

![Append to Dataset Node Example 1.1](./assets/append-to-dataset-node-example-01.png)
![Append to Dataset Node Example 1.2](./assets/append-to-dataset-node-example-01-2.png)

## Error Handling

The Append to Dataset Node will error if the dataset provider is not available in the context when the graph is being run. It will also error if the `Data` input is not provided.

## FAQ

**Q: What is a dataset provider?**

A: A dataset provider is an object that is responsible for managing the storage and retrieval of datasets. It is passed to the context when the graph is being run. The dataset provider must implement the `DatasetProvider` interface, which includes methods for getting, putting, and deleting datasets. See the [API Reference](../api-reference.md) for more information.

**Q: Can I append data to multiple datasets at once?**

A: No, the Append to Dataset Node can only append data to one dataset at a time. If you want to append data to multiple datasets, you can use multiple Append to Dataset Nodes.

**Q: What happens if the dataset does not exist?**

A: If the dataset does not exist, the Append to Dataset Node will error.

## See Also

- [Load Dataset Node](./load-dataset.mdx)
- [Create Dataset Node](./create-dataset.mdx)
- [Get All Datasets Node](./get-all-datasets.mdx)
- [KNN Dataset Node](./knn-dataset.mdx)
- [Get Dataset Row Node](./get-dataset-row.mdx)
6 changes: 6 additions & 0 deletions packages/docs/docs/node-reference/array.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,9 @@ A: Yes, you can connect an Array Node to another Array Node. If the `Flatten` se
A: If an input is missing or null, the Array Node will simply ignore it during the array creation process. This can be useful when dealing with optional inputs that may not always be present.

## See Also

- [Code Node](./code.mdx)
- [Text Node](./text.mdx)
- [Number Node](./number.mdx)
- [Extract Object Path Node](./extract-object-path.mdx)
- [Pop Node](./pop.mdx)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 90 additions & 0 deletions packages/docs/docs/node-reference/audio.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
id: audio
title: Audio Node
sidebar_label: Audio
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

![Audio Node Screenshot](./assets/audio-node.png)

## Overview

The Audio Node is used to define an audio sample for use with other nodes. It can also convert a binary type into an audio type.

The Audio Node can either take an input that represents the audio data or use an audio file specified in the node's settings. The audio data should be in a format that can be converted to a Uint8Array.

<Tabs
defaultValue="inputs"
values={[
{label: 'Inputs', value: 'inputs'},
{label: 'Outputs', value: 'outputs'},
{label: 'Editor Settings', value: 'settings'},
]
}>

<TabItem value="inputs">

## Inputs

| Title | Data Type | Description | Default Value | Notes |
| ----- | --------- | --------------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------- |
| Data | `string` | The string representing the audio data. | N/A | This input is only available if the "Use Data Input" setting is enabled. The input will be coerced into a string. |

</TabItem>

<TabItem value="outputs">

## Outputs

| Title | Data Type | Description | Notes |
| ---------- | --------- | ------------------------------------------------------------------------------------------------------- | ----- |
| Audio Data | `audio` | The audio data converted into a format that can be used by other nodes that accept audio data as input. | |

</TabItem>

<TabItem value="settings">

## Editor Settings

| Setting | Description | Default Value | Use Input Toggle | Input Data Type |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ---------------- | --------------- |
| Audio File | The audio file to be used as the audio data. This file should be in a format that can be converted to a Uint8Array. | N/A | Yes | `file` |
| Use Data Input | If enabled, the node will use the data from the "Data" input port as the audio data. If disabled, the node will use the data from the audio file specified in the "Audio File" setting. | False | No | N/A |

</TabItem>

</Tabs>

## Example 1: Using an Audio Node with a File

1. Add an Audio Node to your graph.
2. In the node's settings, click "Pick File" and select an audio file from your local file system.
3. Play the audio back using the player on the Audio node. You may also connect the Audio node to other nodes that accept Audio data, such as the [AssemblyAI Plugin](../user-guide/plugins/built-in/assemblyai.md)

## Error Handling

The Audio Node will throw an error if:

- The "Use Data Input" setting is enabled but no data is provided to the "Data" input port.
- The "Use Data Input" setting is disabled but no audio file is specified in the "Audio File" setting.
- The provided audio data (either from the "Data" input or the specified audio file) cannot be converted to a Uint8Array.

## FAQ

**Q: What audio file formats are supported by the Audio Node?**

A: The Audio Node does not process the audio data itself, so it does not have any specific audio file format requirements. However, the audio data should be in a format that can be converted to a Uint8Array. The specific audio file formats that can be used will depend on what other nodes you are connecting the Audio Node to.

**Q: Can I use the Audio Node to play audio?**

A: The Audio Node shows a playback bar on the Rivet UI, but otherwise, it cannot be used to play back audio during the graph's execution.

## See Also

- [Image Node](./image.mdx)
- [Text Node](./text.mdx)
- [Number Node](./number.mdx)
- [Boolean Node](./boolean.mdx)
- [External Call Node](./external-call.mdx)
Loading

0 comments on commit adb2962

Please sign in to comment.