feat(docs): added graphite/cli documentation (#2457)

Co-authored-by: Nuno Pato <nunopato@gmail.com>
This commit is contained in:
David Barroso
2024-01-10 17:19:58 +01:00
committed by GitHub
parent 23e18fb734
commit 65b6a48d51
9 changed files with 80 additions and 16 deletions

View File

@@ -0,0 +1,5 @@
---
'@nhost/docs': minor
---
feat: added graphite/cli documentation

View File

@@ -8,8 +8,19 @@ You can enable Graphite, Nhost's AI service, with the following steps:
<Steps>
<Step title="Check your database version">
Check your project's settings and make sure the database version is at least `14.6-20231018-1`. If it isn't upgrade your database version (latest available version is recommended).
<Tabs>
<Tab title="Dashboard">
![database settings](/images/guides/ai/enabling/database.png)
</Tab>
<Tab title="toml">
```toml
[postgres]
version = '14.6-20231018-1'
```
</Tab>
</Tabs>
![database settings](/images/guides/ai/enabling/database.png)
</Step>
<Step title="Get an OpenAPI key">
Get an OpenAI API key from their [customer portal](https://platform.openai.com/account/api-keys).
@@ -27,7 +38,7 @@ You can enable Graphite, Nhost's AI service, with the following steps:
```toml
[ai]
# Version of the service to use. Check the settings page for available versions
version = '0.1.0'
version = '0.3.1'
# Used to validate requests between postgres and the AI service.
# The AI service will also include the header X-Graphite-Webhook-Secret
@@ -41,13 +52,13 @@ You can enable Graphite, Nhost's AI service, with the following steps:
[ai.openai]
# Key to use for authenticating API requests to OpenAI.
apiKey = '{{ secrets.OPEANAI_API_KEY }}'
apiKey = '{{ secrets.OPENAI_API_KEY }}'
# OpenAI organization to use.
organization = 'my-org'
[ai.resources.compute]
# Dedicated resources allocated for the service
cpu = 125
cpu = 128
memory = 256
```
</Tab>

View File

@@ -0,0 +1,45 @@
---
title: "Local Development"
icon: code
---
If you are using the Nhost CLI for local development, as of [v0.12.0](https://github.com/nhost/cli/releases/tag/v1.12.0) you can also start Graphite locally. To do so, follow the next steps:
<Steps>
<Step title="Configuring the Service">
Follow the steps highlighed in the ["Enabling Service"](enabling-service) guide and don't forget to add the relevant secrets to your `.secrets` file.
</Step>
<Step title="Start nhost">
Run `nhost up`:
![nhost up](/images/guides/ai/local_development/nhost_up.png)
After starting the service the first thing you will notice is that there is a new `ai` service running.
</Step>
<Step title="Commit metadata changes">
As you start the AI service metadata changes may be proposed:
![git status](/images/guides/ai/local_development/git_status.png)
We strongly recommmend you to commit them to your git repository so they can be deployed alongside your application.
</Step>
</Steps>
### Synhcronizing Auto-Embeddings
If you add [auto-embeddings](/guides/ai/auto-embeddings) configuration locally and want to synchronize them with the cloud we recommend inserting them using a migration rather than with the auto-embeddings UI:
![migration](/images/guides/ai/local_development/migration.png)
And then running `nhost up` to download the updated metadata. Afterwards you should see both database migrations and functions' metadata changes in your local project:
![git status](/images/guides/ai/local_development/git_status_functions.png)
Pushing them to your deployment branch will also deploy them to your cloud project.
### Synhcronizing Assistants
Similar to auto-embeddings, if you want to synchronize [assistants](/guides/ai/assistants) we recommend you to insert them using a migration and then running `nhost up` to update any metadata if necessary. After pushing the proposed changes to the deployment branch all the changes should be deployed to the cloud project.

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 KiB

View File

@@ -102,6 +102,7 @@
"group": "AI",
"pages": [
"guides/ai/enabling-service",
"guides/ai/local_development",
"guides/ai/auto-embeddings",
"guides/ai/assistants",
"guides/ai/dev-assistant"
@@ -110,8 +111,8 @@
{
"group": "Authentication",
"pages": [
{
"group": "Social Sign In",
{
"group": "Social Sign In",
"icon": "at",
"pages": [
"guides/auth/social/sign-in-apple",
@@ -161,7 +162,7 @@
"icon": "users",
"pages": [
{
"group": "Email and Password",
"group": "Email and Password",
"icon": "envelope",
"pages": [
"reference/auth/sign-up-email-and-password",
@@ -169,7 +170,7 @@
]
},
{
"group": "Passwordless",
"group": "Passwordless",
"icon": "message-sms",
"pages": [
"reference/auth/sign-in-email-passwordless",
@@ -178,7 +179,7 @@
]
},
{
"group": "OAuth",
"group": "OAuth",
"icon": "at",
"pages": [
"reference/auth/sign-in-oauth-provider",
@@ -186,7 +187,7 @@
]
},
{
"group": "WebAuthn",
"group": "WebAuthn",
"icon": "atom",
"pages": [
"reference/auth/sign-up-using-email-via-fido2-webauthn-authentication",
@@ -196,7 +197,7 @@
]
},
{
"group": "Anonymous",
"group": "Anonymous",
"icon": "luchador-mask",
"pages": [
"reference/auth/sign-in-anonymous",
@@ -204,7 +205,7 @@
]
},
{
"group": "MFA",
"group": "MFA",
"icon": "message-sms",
"pages": [
"reference/auth/generate-a-secret-to-request-the-activation-of-time-based-one-time-password-totp-multi-factor-authentication",
@@ -213,7 +214,7 @@
]
},
{
"group": "User",
"group": "User",
"icon": "user",
"pages": [
"reference/auth/change-the-current-users-email",

View File

@@ -50,10 +50,12 @@ In addition, thanks to [pgvector](https://github.com/pgvector/pgvector) you can
<CardGroup cols={4}>
<Card title="Enabling Service" icon="square-1" href="../guides/ai/enabling-service">
</Card>
<Card title="Auto-Embeddings" icon="square-2" href="../guides/ai/auto-embeddings">
<Card title="Local Development" icon="square-2" href="../guides/ai/local_development">
</Card>
<Card title="Assistants" icon="square-3" href="../guides/ai/assistants">
<Card title="Auto-Embeddings" icon="square-3" href="../guides/ai/auto-embeddings">
</Card>
<Card title="Developer Assistant" icon="square-4" href="../guides/ai/dev-assistant">
<Card title="Assistants" icon="square-4" href="../guides/ai/assistants">
</Card>
<Card title="Developer Assistant" icon="square-5" href="../guides/ai/dev-assistant">
</Card>
</CardGroup>