Skip to content

Commit

Permalink
Fixes for inline text and relnotes
Browse files Browse the repository at this point in the history
Signed-off-by: Dj Walker-Morgan <[email protected]>
  • Loading branch information
djw-m committed Jan 9, 2025
1 parent 9d35900 commit 0f31952
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 90 deletions.
16 changes: 8 additions & 8 deletions advocacy_docs/edb-postgres-ai/ai-accelerator/capabilities.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ This storage location can be an S3 bucket or a local file system.

The storage locations can be used to create a volume, suitable for a retriever to use to access the data it contains.

### A model is registered
### A model is created

A [model](models) is registered with the Pipelines system. This model can be a machine learning model, a deep learning model, or any other type of model that can be used for AI tasks.
A [model](models) is created with the Pipelines system. This model can be a machine learning model, a deep learning model, or any other type of model that can be used for AI tasks.

### A retriever is registered
### A retriever is created

A retriever is registered with the Pipelines system. A retriever is a function that retrieves data from a table or volume and returns it in a format that can be used by the model.
A retriever is created with the Pipelines system. A retriever is a function that retrieves data from a table or volume and returns it in a format that can be used by the model.

By default, a retriever only needs:

* a name
* the name of a registered model to use
* the name of a model to use

If the retriever is for a table, it also needs:

Expand All @@ -42,10 +42,10 @@ If, on the other hand, the retriever is for a volume, it needs:
* the name of the volume
* the name of the column in the volume that contains the data

When a retriever is registered, by default it will create a vector table to store the embeddings of the data that is retrieved.
When a retriever is created, by default it will create a vector table to store the embeddings of the data that is retrieved.
This table will have a column to store the embeddings and a column to store the key of the data.

The name of the vector table and the name of the vector column and the key column can be specified when the retriever is registered; this is useful if you are migrating to aidb and want to use an existing vector table.
The name of the vector table and the name of the vector column and the key column can be specified when the retriever is created; this is useful if you are migrating to aidb and want to use an existing vector table.

### Embeddings are created

Expand All @@ -65,4 +65,4 @@ While auto-embedding is enabled, the embeddings are always up-to-date and applic

### Cleanup

If the embeddings are no longer required, the retriever can be unregistered, the vector table can be dropped and the model can be unregistered too.
If the embeddings are no longer required, the retriever can be deleted, the vector table can be dropped and the model can be deleted.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,6 @@ __OUTPUT__

## Further reading

In the [Models](../models) section, you can learn how to register more models with Pipelines, including external models from OpenAI API compatible services.
In the [Models](../models) section, you can learn how to create more models with Pipelines, including external models from OpenAI API compatible services.

In the [Retrievers](../retrievers) section, you can learn more about how to use retrievers with external data sources, local files or S3 storage, and how to use the retriever functions to get the data you need.
4 changes: 2 additions & 2 deletions advocacy_docs/edb-postgres-ai/ai-accelerator/models/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ navigation:
- openai-api-compatibility
---

Pipelines has a model registry that manages configured instances of models. Any Pipelines functions that use models, such as embedding and retrieving, must reference a registered model.
Pipelines has a model registry that manages configured instances of models. Any Pipelines functions that use models, such as embedding and retrieving, must reference a created model.

* Learn how to [register models](./using-models) in Pipelines.
* Learn how to [create models](./using-models) in Pipelines.
* Discover the [primitives](./primitives) that can be used to interact with models.
* See the [supported models](./supported-models) that come with Pipelines.
* Learn how to use [OpenAI API compatible services](./openai-api-compatibility) with Pipelines.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ Some examples of why you might want to use an OpenAI compatible API include:

* If you have access to a service which provides different or specifically tuned models, you can use it instead of other models.

## Registering the model
## Creating the model

The starting point for this process is registering a model. When yuou register a model, you can pass `options` and `credentials` to the registration. The defaults will point to the OpenAI service endpoint, so by overriding that, you can point to any service. Here is an example that will register a model that uses a local Ollama server:
The starting point for this process is creating a model. When you create a model, you can pass `options` and `credentials` to the registration. The defaults will point to the OpenAI service endpoint, so by overriding that, you can point to any service. Here is an example that will create a model that uses a local Ollama server:

```sql
select aidb.register_model(
select aidb.create_model(
'my_local_ollama',
'openai_embeddings',
'{"model":"llama3.3", "url":"http://llama.local:11434/v1/embeddings", "dimensions":8192}'::JSONB,
Expand Down Expand Up @@ -60,7 +60,7 @@ The last parameter is the credentials parameter, which is another JSON string. I

## Using the model

Use the model name you registered earlier to use the model just like any other Pipelines model. Here is an example of how to use the model to get an embedding:
Use the model name you created earlier to use the model just like any other Pipelines model. Here is an example of how to use the model to get an embedding:

```sql
select aidb.encode_text('my_local_ollama','I like it');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ See a list of supported OpenAI models [here](https://platform.openai.com/docs/mo

## Creating the default model

There is no default model for OpenAI Completions. You can register any supported OpenAI model using the `aidb.create_model` function. See [Creating a model](#creating-a-specific-model).
There is no default model for OpenAI Completions. You can create any supported OpenAI model using the `aidb.create_model` function. See [Creating a model](#creating-a-specific-model).

## Creating a specific model

You can register any supported OpenAI model using the `aidb.create_model` function.
You can create any supported OpenAI model using the `aidb.create_model` function.

In this example, we are registering a GPT-4o model with the name `my_openai_model`:
In this example, we are creating a GPT-4o model with the name `my_openai_model`:

```sql
SELECT aidb.create_model(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ To find them, you can run the following query:
SELECT * FROM aidb.list_models();
```

This will return a list of all the models that are currently registered in the system. If you have not registered any models, you'll see the default models that come with Pipelines.
This will return a list of all the models that are currently created in the system. If you have not created any models, you'll see the default models that come with Pipelines.

```text
name | provider | options
Expand All @@ -27,7 +27,7 @@ This will return a list of all the models that are currently registered in the s
dummy | dummy | {"config={}"}
```

The `bert`, `clip`, and `t5` models are all registered and ready to use. The `dummy` model is a placeholder model that can be used for testing purposes.
The `bert`, `clip`, and `t5` models are all pre-created and ready to use. The `dummy` model is a placeholder model that can be used for testing purposes.

## Creating a Model

Expand All @@ -37,7 +37,7 @@ You can also create your own models. To do this, you can use the `aidb.create_mo
SELECT aidb.create_model('my_model', 'bert_local');
```

This will create a model named `my_model` that uses the default `bert_local` model provider. But, this is essentially the same as using the bert model thats already registered.
This will create a model named `my_model` that uses the default `bert_local` model provider. But, this is essentially the same as using the bert model thats already created.

## Discovering the Model Providers

Expand All @@ -60,7 +60,7 @@ This will return a list of all the model providers that are currently available

## Creating a Model with a Configuration

You can also pass options to the model when registering it. For example, you can specify the model configuration:
You can also pass options to the model when creating it. For example, you can specify the model configuration:

```sql
SELECT aidb.create_model('my_model',
Expand All @@ -71,11 +71,11 @@ SELECT aidb.create_model('my_model',

This will create a model named `my_model` that uses the `bert_local` model provider and the `sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2` model from HuggingFace. The `revision` option specifies the version of the model to use. The options are passed as a JSONB object, with a single quoted string that is then cast to JSONB. Within the string are the key-value pairs that define the model configuration in a single JSON object.

## Registering a Model with Configuration and Credentials
## Creating a Model with Configuration and Credentials

This is where the other [supported models](./supported-models) come in. You can create a different model by specifying the model name in the configuration. The `OpenAI Completions` and `OpenAI Embeddings` models are both models which you can create to make use of OpenAI's completions and embeddings APIs.

You need to provide more information to the `aidb.create_model` function when registering a model like this. Completions has a number of options, including selecting which model it will use on OpenAI. Both Completions and Embeddings require API credentials. Here is an example of how to create the OpenAI Completions model:
You need to provide more information to the `aidb.create_model` function when creating a model like this. Completions has a number of options, including selecting which model it will use on OpenAI. Both Completions and Embeddings require API credentials. Here is an example of how to create the OpenAI Completions model:

```sql
SELECT aidb.create_model(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Using the `options` and `credentials` parameters allows the passing of a range o
The `options` parameter is a JSON object that can be used to pass additional options to the storage location.
The `credentials` parameter is a JSON object that can be used to pass credentials to the storage location.

The difference between `option` and `credentials` is that while options remains visible to users querying the extension, credentials are hidden to all users except superusers.
The difference between `option` and `credentials` is that while options remains visible to users querying the extension, credentials are hidden to all users except superusers and the user that creates the storage location.

For example, you can create a storage location with options and credentials like this:

Expand Down Expand Up @@ -65,12 +65,12 @@ You can also update a storage location with the `pgfs.update_storage_location` f
select pgfs.update_storage_location('my_storage', 's3://my_bucket', null, '{"region": "eu-west"}'
```

### Dropping a storage location
### Deleting a storage location

You can drop a storage location with the `pgfs.drop_storage_location` function.
You can delete a storage location with the `pgfs.delete_storage_location` function.

```sql
select pgfs.drop_storage_location('my_storage');
select pgfs.delete_storage_location('my_storage');
```

This will remove the storage location with the name `my_storage` from the database.
Expand Down
11 changes: 5 additions & 6 deletions advocacy_docs/edb-postgres-ai/ai-accelerator/reference/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ navigation:

* [aidb.model_providers](models#aidbmodel_providers)

### Functions
### Model Functions
* [aidb.create_model](models#aidbcreate_model)
* [aidb.list_models](models#aidblist_models)
* [aidb.get_model](models#aidbget_model)
* [aidb.delete_model](models#aidbdelete_model)

## Retrievers

### Tables
### Retriever Tables

* [aidb.retrievers](retrievers#aidbretrievers)

### Functions
### Retriever Functions

* [aidb.create_retriever_for_table](retrievers#aidbcreate_retriever_for_table)
* [aidb.create_retriever_for_volume](retrievers#aidbcreate_retriever_for_volume)
Expand All @@ -38,11 +38,11 @@ navigation:
* [aidb.retrieve_text](retrievers#aidbretrieve_text)
* [aidb.delete_retriever](retrievers#aidbdelete_retriever)
* [aidb.create_volume](retrievers#aidbcreate_volume)
* [aidb.drop_volume](retrievers#aidbdrop_volume)
* [aidb.delete_volume](retrievers#aidbdelete_volume)

## PGFS

### Functions
### PGFS Functions

* [pgfs.create_foreign_table](pgfs#pgfscreate_foreign_table)
* [pgfs.create_storage_location](pgfs#pgfscreate_storage_location)
Expand All @@ -53,4 +53,3 @@ navigation:
* [pgfs.update_storage_location](pgfs#pgfsupdate_storage_location)
* [pgfs.set_default_storage_location](pgfs#pgfsset_default_storage_location)
* [pgfs.get_default_storage_location](pgfs#pgfsget_default_storage_location)

Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Returns the configuration for a model in the registry.
#### Example

```sql
SELECT * FROM aidb.getmodel('t5');
SELECT * FROM aidb.get_model('t5');
__OUTPUT__
name | provider | options
------+----------+---------------
Expand Down Expand Up @@ -138,7 +138,7 @@ __OUTPUT__

### `aidb.encode_text`

Encodes text using a registered model, generating a vector representation of a given text input.
Encodes text using a model, generating a vector representation of a given text input.

#### Parameters

Expand All @@ -149,7 +149,7 @@ Encodes text using a registered model, generating a vector representation of a g

### `aidb.encode_text_batch`

Encodes a batch of text using a registered model, generating a vector representation of a given text inputs.
Encodes a batch of text using a model, generating a vector representation of a given text inputs.

#### Parameters

Expand All @@ -161,7 +161,7 @@ Encodes a batch of text using a registered model, generating a vector representa

### `aidb.decode_text`

Decodes text using a registered model, generating a vector representation of a given text input.
Decodes text using a model, generating a vector representation of a given text input.

#### Parameters

Expand All @@ -178,7 +178,7 @@ Decodes text using a registered model, generating a vector representation of a g

### `aidb.decode_text_batch`

Decodes a batch of text using a registered model, generating a representation of a given text input.
Decodes a batch of text using a model, generating a representation of a given text input.

#### Parameters

Expand All @@ -195,7 +195,7 @@ Decodes a batch of text using a registered model, generating a representation of

### `aidb.encode_image`

Encodes an image using a registered model, generating a vector representation of a given image input.
Encodes an image using a model, generating a vector representation of a given image input.

#### Parameters

Expand Down
Loading

0 comments on commit 0f31952

Please sign in to comment.