Skip to content

Commit

Permalink
add doc page for pg configs (#170)
Browse files Browse the repository at this point in the history
* add doc page for pg configs
  • Loading branch information
ChuckHend authored Oct 25, 2024
1 parent 638b128 commit 350bb37
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Configuring pg_vectorize

## Changing the database

To change the database that pg_vectorize background worker is connected to, you can use the following SQL command:

```sql
ALTER SYSTEM SET vectorize.database_name TO 'my_new_db';
```

Then, restart Postgres.

## Changing Embedding and LLM base URLs

All Embedding model and LLM providers can have their base URLs changed.

For example, if you have an OpenAI compliant embedding or LLM server (such as [vLLM](https://github.com/vllm-project/vllm)), running at `https://api.myserver.com/v1`, you can change the base URL with the following SQL command:

```sql
ALTER SYSTEM SET vectorize.openai_base_url TO 'https://api.myserver.com/v1';
SELECT pg_reload_conf();
```

## Changing the batch job size

Text data stored in Postgres is transformed into embeddings via HTTP requests made from the pg_vectorize background worker. Requests are made to the specified embedding service in batch (multiple inputs per request). The number of inputs per request is determined by the `vectorize.batch_size` GUC. This has no impact on transformations that occur during `vectorize.search()`, `vectorize.encode()` and `vectorize.rag()` which are always batch size 1 since those APIs accept only a single input (the raw text query).

```sql
ALTER SYSTEM SET vectorize.batch_size to 100;
```

## Available GUCs

The complete list of GUCs available for pg_vectorize are defined in [extension/src/guc.rs](https://github.com/tembo-io/pg_vectorize/blob/638b12887f14d47de0793b16d535b226d8f371b9/extension/src/guc.rs#L33).
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ nav:
- 'examples/openai_embeddings.md'
- 'examples/scheduling.md'
- Model Providers: 'models/index.md'
- Extension Configuration: 'configuration.md'
markdown_extensions:
- toc:
permalink: true
Expand Down

0 comments on commit 350bb37

Please sign in to comment.