> ## Documentation Index
> Fetch the complete documentation index at: https://relevanceai.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Knowledge

> The 'Update Knowledge' Tool step lets you update existing rows in your knowledge table—making it easy to keep your data current and accurate.

## Add the 'Update Knowledge' Tool step to your Tool

<div style={{ width:"95%",position:"relative",paddingTop:"62.5%" }}>
  <iframe src="https://app.supademo.com/embed/cmcu7bc9z1pd69st851b05iwu" frameBorder="0" title="Add the Update Knowledge Tool step to your Tool" allow="clipboard-write; fullscreen" webkitAllowFullscreen="true" mozAllowFullscreen="true" allowFullscreen style={{ position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"3px solid #5E43CE",borderRadius:"10px",objectFit:"cover" }} />
</div>

You can add the 'Update Knowledge' Tool step to your Tool by:

1. Creating a new Tool, then clicking `+ Add Step`
2. Searching for and adding the 'Update Knowledge' Tool step
3. Clicking 'Expand' to see the full Tool step
4. Selecting the knowledge table you would like to access
5. Filter condition: "and" vs "or" when matching data to update:
   * Use `and` when all specified conditions must match for a row to be updated.
   * Use `or` when any of the conditions can match.
   <Note>
     Filter condition only applies if you include more than one object in the filter
   </Note>
6. Filters: Accepts a JSON selection of objects, where each object corresponds to a row. Add more objects as outlined in the formatting examples below to match multiple rows at once.
7. Update value: Provide an object with the new values to update. Each key should match a column name in your knowledge table, and its corresponding value will replace the current value in the matching row.
8. Use the **Sync on upload** field to determine whether the data should be vectorized when added to the knowledge set. In most cases, you'll want this enabled as it allows your agents to semantically search and retrieve relevant information from your knowledge table.
9. Click `Run step` to test out the Tool

## Common errors

<Accordion title="Formatting issues">
  This indicates that there is a formatting issue in the "New data to insert" input field. Make sure your object is formatted correctly. `Expected property name or '}' in JSON at...`
</Accordion>

<Accordion title="Incorrect data type">
  This means the data being inserted into the knowledge table is not a JSON. `Invalid JSON`
</Accordion>

## Formatting Examples

### Example 1: Replace all poodles with bulldogs

```json theme={null}
// Filters
[
  {
    "breed": "poodle"
  }
]
```

```json theme={null}
// Update value
[
  {
    "breed": "bulldog"
  }
]
```

### Example 2: Replace all small poodles with large bulldogs

```json theme={null}
// Filters
[
  {
    "breed": "poodle",
    "size": "small"
  }
]
```

```json theme={null}
// Update value
[
  {
    "breed": "bulldog",
    "size": "large"
  }
]
```

### Example 3: Replace all poodles *and* bulldogs with cats

```json theme={null}
// Filters
[
  {
    "breed": "poodle"
  },
  {
    "breed": "bulldog"
  }
]
```

```json theme={null}
// Update value
[
  {
    "breed": "cat"
  }
]
```

<Note>
  Ensure to separate each object with a comma if filtering multiple rows.
</Note>

## Using Variables in JSON

You can use variables from Tool inputs and other Tool steps in the **Filters** and **Update value** fields. For detailed information on how to use variables in JSON for Knowledge Tool steps, including variable syntax and typing, see [Using Variables in JSON](/build/tools/tool-steps/knowledge/using-variables-in-json).

For Knowledge Tool steps, all variables should be wrapped in quotes in the JSON format: `"{{variable_name}}"`. The type of the updated value is determined by the column type defined in your knowledge table, and values will be automatically converted to match the column type during the update.

## Frequently asked questions (FAQs)

<AccordionGroup>
  <Accordion title="What happens if I don't enable 'Sync on Upload'?">
    If "Sync on Upload" is disabled, the data will be stored but not vectorized. This means your agents won't be able to semantically search or reference that data until you manually vectorize it.
  </Accordion>

  <Accordion title="How do I update a field to be empty/blank?">
    You can update a field to be empty/blank by setting the value to empty quote marks `""`.
  </Accordion>

  <Accordion title="What data types can I update with?">
    You can use text, numbers, booleans, or any JSON-serializable value. Just make sure each object in the array follows the correct formatting.
  </Accordion>
</AccordionGroup>
