Skip to content

Commit b686e8d

Browse files
[DOC] Sync docs (#5705)
## Description of changes _Summarize the changes made by this PR._ - Improvements & Bug fixes - Adds docs for Chroma Sync - New functionality - N/A ## Test plan _How are these changes tested?_ - [ ] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Migration plan _Are there any migrations, or any forwards/backwards compatibility changes needed in order to make sure this change deploys reliably?_ ## Observability plan _What is the plan to instrument and monitor this change?_ ## Documentation Changes _Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs section](https://github.com/chroma-core/chroma/tree/main/docs/docs.trychroma.com)?_ --------- Co-authored-by: Philip I. Thomas <philip@trychroma.com>
1 parent c8846eb commit b686e8d

19 files changed

+609
-4
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
id: github
3+
name: GitHub
4+
---
5+
6+
# Walkthrough
7+
8+
## Direct Sync
9+
10+
Direct Sync is the default syncing method, which uses the Chroma Cloud GitHub app. To use your own custom GitHub app, use [Platform Sync](/cloud/sync/overview#platform-sync).
11+
12+
1. **Prerequisites**
13+
14+
This walkthrough assumes that you have a GitHub account with at least one repository.
15+
16+
2. **New database setup**
17+
18+
If you do not already have a Chroma Cloud account, you will need to create one at [trychroma.com](https://www.trychroma.com). After creating an account, you can create a database by specifying a name:
19+
20+
{% MarkdocImage lightSrc="/sync/sync_create_database.png" darkSrc="/sync/sync_create_database.png" alt="Create database screen" /%}
21+
22+
On the setup screen, select "Sync a GitHub repo":
23+
24+
{% MarkdocImage lightSrc="/sync/sync_new_db_onboarding.png" darkSrc="/sync/sync_create_database.png" alt="Onboarding screen for syncing a GitHub repo" /%}
25+
26+
Install the Chroma GitHub App into your GitHub account or organization:
27+
28+
{% MarkdocImage lightSrc="/sync/sync_new_db_github_install.png" darkSrc="/sync/sync_new_db_github_install.png" alt="GitHub app installation screen" /%}
29+
30+
And follow the prompts to initiate sync. Choose the **repo** to sync code from, the **branch or commit hash** version of the code to index, and new **collection name** for the synced code. (The collection will be created by the syncing process, and must not exist yet.)
31+
32+
{% MarkdocImage lightSrc="/sync/sync_install.png" darkSrc="/sync/sync_install.png" alt="/sync repo to Chroma Collection UI" /%}
33+
34+
35+
3. **Existing database setup**
36+
37+
Open an existing database in Chroma Cloud, and select "Sync" from the menu:
38+
39+
{% MarkdocImage lightSrc="/sync/sync_existing_db.png" darkSrc="/sync/sync_existing_db.png" alt="/sync tab in Chroma Cloud UI" /%}
40+
41+
42+
On the Sync page, select "Create" to begin syncing code. If you have not already connected GitHub, you may be prompted to install the Chroma Cloud GitHub app again.
43+
44+
{% MarkdocImage lightSrc="/sync/sync_existing_db_add.png" darkSrc="/sync/sync_existing_db_add.png" alt="Create path for a new Sync" /%}
45+
46+
Then, follow the prompts to initiate sync. Choose the **repo** to sync code from, the **branch or commit hash** version of the code to index, and a new **collection name** for the synced code. (The collection will be created by the syncing process, and must not exist yet.)
47+
48+
{% MarkdocImage lightSrc="/sync/sync_existing_db_sync.png" darkSrc="/sync/sync_existing_db_sync.png" alt="Create flow for a new Sync" /%}
49+
50+
51+
4. **Viewing an Invocation**
52+
53+
Each Sync create a new Invocation. When completed, select "View Collection" to see the new Chroma collection containing the synced code:
54+
55+
{% MarkdocImage lightSrc="/sync/db_invocation.png" darkSrc="/sync/db_invocation.png" alt="Invocation screen for a Sync" /%}
56+
57+
58+
## Platform Sync
59+
60+
1. **Prerequisites**
61+
62+
This walkthrough assumes that you have an existing GitHub App that has been installed into at least one non-empty GitHub account or organization.
63+
64+
2. **Setup**
65+
66+
If you do not already have a Chroma Cloud account, you will need to create one at [trychroma.com](https://www.trychroma.com). After creating an account, you can create a database by specifying a name:
67+
68+
{% MarkdocImage lightSrc="/sync/sync_create_database.png" darkSrc="/sync/sync_create_database.png" alt="Create database screen" /%}
69+
70+
Once you have a database, you should create an API key to be able to access the Sync Function’s API. You can choose to make this API key scoped to all databases on your account or only the one you just created:
71+
72+
{% MarkdocImage lightSrc="/sync/api_keys.png" darkSrc="/sync/api_keys.png" alt="API key issuance for Chroma Cloud" /%}
73+
74+
The final setup step is to grant Chroma access to the repositories to which your GitHub App has access. You will need to retrieve the app’s ID and private key from GitHub:
75+
76+
{% MarkdocImage lightSrc="/sync/github_app_id.png" darkSrc="/sync/github_app_id.png" alt="GitHub App ID" /%}
77+
78+
{% MarkdocImage lightSrc="/sync/github_secret_key.png" darkSrc="/sync/github_secret_key.png" alt="GitHub Secret Key" /%}
79+
80+
With these credentials, you can use the Chroma dashboard to register your GitHub App with Chroma. **Contact [support@trychroma.com](mailto:support@trychroma.com) for access to this feature.**
81+
82+
{% MarkdocImage lightSrc="/sync/custom-github-app-screen.png" darkSrc="/sync/custom-github-app-screen.png" alt="Creating a custom github app" /%}
83+
84+
3. **Creating a source**
85+
86+
To create a source, you must send an API request to the Sync Function’s API:
87+
88+
```bash
89+
curl -X POST https://sync.trychroma.com/api/v1/sources \
90+
-H "x-chroma-token: <YOUR_CHROMA_API_KEY>" \
91+
-H "Content-Type: application/json" \
92+
-d '{
93+
"database_name": "<YOUR_DATABASE_NAME>",
94+
"embedding_model": "Qwen/Qwen3-Embedding-0.6B",
95+
"github": {
96+
"repository": "chroma-core/chroma",
97+
"app_id": "<YOUR_GITHUB_APP_ID>"
98+
}
99+
}'
100+
```
101+
102+
4. **Invoking the Sync Function**
103+
104+
To invoke the Sync Function, you must select a source on which to create the invocation. See the previous step for details on how to create a source. Once you select the source in the UI, you can invoke the Sync Function by clicking “Create invocation”:
105+
106+
{% MarkdocImage lightSrc="/sync/custom_source_invocation.png" darkSrc="/sync/custom_source_invocation.png" alt="Creating a custom sync invocation" /%}
107+
108+
Alternatively, you can invoke the Sync Function by sending an API request to the Sync Function’s API:
109+
110+
```bash
111+
curl -X POST https://sync.trychroma.com/api/v1/sources/{source_id}/invocations \
112+
-H "x-chroma-token: <YOUR_CHROMA_API_KEY>" \
113+
-H "Content-Type: application/json" \
114+
-d '{
115+
"target_collection_name": "<YOUR_TARGET_COLLECTION_NAME>",
116+
"ref_identifier": {
117+
// only one of these should be supplied
118+
"branch": "<YOUR_BRANCH_NAME>",
119+
"sha": "<YOUR_COMMIT_SHA>"
120+
}
121+
}'
122+
```

0 commit comments

Comments
 (0)