Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D3v (#1398) #1399

Merged
merged 10 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/actions/run-script-zerox-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Run SDK Auth Tests'
description: 'Runs SDK authentication tests for R2R'
runs:
using: "composite"
steps:
- name: Ingest zerox document
working-directory: ./py
shell: bash
run: poetry run python core/examples/scripts/run_ingest_with_zerox.py

- name: Test ingested zerox document
working-directory: ./py
shell: bash
run: poetry run python tests/integration/runner_scripts.py test_ingested_zerox_document
2 changes: 1 addition & 1 deletion .github/actions/setup-python-full/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'

- name: Install R2R CLI & Python SDK
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-python-light/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'

- name: Install Poetry and dependencies on Ubuntu and macOS
if: inputs.os == 'ubuntu-latest' || inputs.os == 'macos-latest'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-r2r-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'

- name: Install toml package
run: pip install toml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-unst-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'

- name: Install toml package
run: pip install toml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'

- name: Install poetry
working-directory: ./py
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/r2r-full-integration-deep-dive-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: R2R Deep-Dive Integration Tests

on:
push:
branches:
- dev
- dev-minor
pull_request:
branches:
- dev
- dev-minor
workflow_dispatch:

jobs:
test:
runs-on: "ubuntu-latest"
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
TELEMETRY_ENABLED: 'false'
R2R_PROJECT_NAME: r2r_default

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python and install dependencies
uses: ./.github/actions/setup-python-full
with:
os: "ubuntu-latest"

- name: Setup and start Docker
uses: ./.github/actions/setup-docker

- name: Login Docker
uses: ./.github/actions/login-docker
with:
docker_username: ${{ secrets.RAGTORICHES_DOCKER_UNAME }}
docker_password: ${{ secrets.RAGTORICHES_DOCKER_TOKEN }}

- name: Start R2R Full server
uses: ./.github/actions/start-r2r-full

- name: Run Test Zerox
uses: ./.github/actions/run-script-zerox-tests
127 changes: 127 additions & 0 deletions docs/documentation/cli/graph.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
title: 'Knowledge Graph'
description: 'Managing the knowledge graph with the R2R CLI.'
---

<Note>
Occasionally this CLI documentation falls out of date, cross-check with the automatically generated <a href="/api-reference/introduction"> API Reference documentation </a> for the latest parameters.
</Note>

## Knowledge Graph Management

### Create Graph

Create a knowledge graph for a collection using the `create-graph` command:

````bash
r2r create-graph --collection-id my-collection --run --kg-creation-settings '{"key": "value"}' --force-kg-creation
````

<AccordionGroup>
<Accordion title="Arguments">
<ParamField path="--collection-id" type="str">
Collection ID to create graph for. Default is "".
</ParamField>

<ParamField path="--run" type="flag">
Run the graph creation process.
</ParamField>

<ParamField path="--kg-creation-settings" type="str">
Settings for the graph creation process as a JSON string.
</ParamField>

<ParamField path="--force-kg-creation" type="flag">
Force the graph creation process.
</ParamField>
</Accordion>
</AccordionGroup>

### Enrich Graph

Enrich an existing knowledge graph using the `enrich-graph` command:

````bash
r2r enrich-graph --collection-id my-collection --run --force-kg-enrichment --kg-enrichment-settings '{"key": "value"}'
````

<AccordionGroup>
<Accordion title="Arguments">
<ParamField path="--collection-id" type="str">
Collection ID to enrich graph for. Default is "".
</ParamField>

<ParamField path="--run" type="flag">
Run the graph enrichment process.
</ParamField>

<ParamField path="--force-kg-enrichment" type="flag">
Force the graph enrichment process.
</ParamField>

<ParamField path="--kg-enrichment-settings" type="str">
Settings for the graph enrichment process as a JSON string.
</ParamField>
</Accordion>
</AccordionGroup>

### Get Entities

Retrieve entities from the knowledge graph using the `get-entities` command:

````bash
r2r get-entities --collection-id my-collection --offset 0 --limit 10 --entity-ids entity1 entity2
````

<AccordionGroup>
<Accordion title="Arguments">
<ParamField path="--collection-id" type="str" required>
Collection ID to retrieve entities from.
</ParamField>

<ParamField path="--offset" type="int">
Offset for pagination. Default is 0.
</ParamField>

<ParamField path="--limit" type="int">
Limit for pagination. Default is 100.
</ParamField>

<ParamField path="--entity-ids" type="list[str]">
Entity IDs to filter by.
</ParamField>
</Accordion>
</AccordionGroup>

### Get Triples

Retrieve triples from the knowledge graph using the `get-triples` command:

````bash
r2r get-triples --collection-id my-collection --offset 0 --limit 10 --triple-ids triple1 triple2 --entity-names entity1 entity2
````

<AccordionGroup>
<Accordion title="Arguments">
<ParamField path="--collection-id" type="str" required>
Collection ID to retrieve triples from.
</ParamField>

<ParamField path="--offset" type="int">
Offset for pagination. Default is 0.
</ParamField>

<ParamField path="--limit" type="int">
Limit for pagination. Default is 100.
</ParamField>

<ParamField path="--triple-ids" type="list[str]">
Triple IDs to filter by.
</ParamField>

<ParamField path="--entity-names" type="list[str]">
Entity names to filter by.
</ParamField>
</Accordion>
</AccordionGroup>
````
105 changes: 105 additions & 0 deletions docs/documentation/cli/ingestion.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
title: 'Ingestion'
description: 'Ingesting files with the R2R CLI.'
---

<Note>
Occasionally this CLI documentation falls out of date, cross-check with the automatcially generated <a href="/api-reference/introduction"> API Reference documentation </a> for the latest parameters.
</Note>

## Document Ingestion and Management

### Ingest Files

Ingest files or directories into your R2R system using the `ingest-files` command:

```bash
r2r ingest-files path/to/file1.txt path/to/file2.txt \
--document-ids 9fbe403b-c11c-5aae-8ade-ef22980c3ad1 \
--metadatas '{"key1": "value1"}'
```

<AccordionGroup>
<Accordion title="Arguments">
<ParamField path="file_paths" type="list[str]" required>
The paths to the files to ingest.
</ParamField>

<ParamField path="--document-ids" type="list[str]">
Optional document IDs to assign to the ingested files. If not provided, new document IDs will be generated.
</ParamField>

<ParamField path="--metadatas" type="str">
Optional metadata to attach to the ingested files, provided as a JSON string. If ingesting multiple files, the metadata will be applied to all files.
</ParamField>
</Accordion>
</AccordionGroup>

### Retry Failed Ingestions

Retry ingestion for documents that previously failed using the `retry-ingest-files` command:

```bash
r2r retry-ingest-files 9fbe403b-c11c-5aae-8ade-ef22980c3ad1
```

<AccordionGroup>
<Accordion title="Arguments">
<ParamField path="document_ids" type="list[str]" required>
The IDs of the documents to retry ingestion for.
</ParamField>
</Accordion>
</AccordionGroup>

### Update Files

Update existing documents using the `update-files` command:

```bash
r2r update-files path/to/file1_v2.txt \
--document-ids 9fbe403b-c11c-5aae-8ade-ef22980c3ad1 \
--metadatas '{"key1": "value2"}'
```

<AccordionGroup>
<Accordion title="Arguments">
<ParamField path="file_paths" type="list[str]" required>
The paths to the updated files.
</ParamField>

<ParamField path="--document-ids" type="str" required>
The IDs of the documents to update, provided as a comma-separated string.
</ParamField>

<ParamField path="--metadatas" type="str">
Optional updated metadata to attach to the documents, provided as a JSON string. If updating multiple files, the metadata will be applied to all files.
</ParamField>
</Accordion>
</AccordionGroup>

### Ingest Sample Files

Ingest one or more sample files from the R2R GitHub repository using the `ingest-sample-file` or `ingest-sample-files` commands:

```bash
# Ingest a single sample file
r2r ingest-sample-file

# Ingest a smaller version of the sample file
r2r ingest-sample-file --v2

# Ingest multiple sample files
r2r ingest-sample-files
```

These commands have no additional arguments. The `--v2` flag for `ingest-sample-file` ingests a smaller version of the sample Aristotle text file.

### Ingest Local Sample Files

Ingest the local sample files in the `core/examples/data_unstructured` directory using the `ingest-sample-files-from-unstructured` command:

```bash
r2r ingest-sample-files-from-unstructured
```

This command has no additional arguments. It will ingest all files found in the `data_unstructured` directory.
Loading
Loading