diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/installing/complete.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/installing/complete.mdx index 76e8034827e..cb8a5e13e4f 100644 --- a/advocacy_docs/edb-postgres-ai/ai-accelerator/installing/complete.mdx +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/installing/complete.mdx @@ -34,8 +34,8 @@ __OUTPUT__ List of installed extensions Name | Version | Schema | Description ------------------+---------+------------+------------------------------------------------------------ - aidb | 1.0.7 | aidb | aidb: makes it easy to build AI applications with postgres - pgfs | 1.0.4 | pgfs | pgfs: enables access to filesystem-like storage locations + aidb | 2.1.1 | aidb | aidb: makes it easy to build AI applications with postgres + pgfs | 1.0.6 | pgfs | pgfs: enables access to filesystem-like storage locations vector | 0.8.0 | public | vector data type and ivfflat and hnsw access methods ``` diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/installing/index.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/installing/index.mdx index 7df0a19b640..a97d6c9a638 100644 --- a/advocacy_docs/edb-postgres-ai/ai-accelerator/installing/index.mdx +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/installing/index.mdx @@ -12,4 +12,3 @@ Pipelines is delivered as a set of extensions. Depending on how you are deployin - [Manually installing pipelines packages](packages) Once the packages are installed, you can [complete the installation](complete) by activating the extensions within Postgres. - diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/limitations.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/limitations.mdx index aea7609a886..46c2a560576 100644 --- a/advocacy_docs/edb-postgres-ai/ai-accelerator/limitations.mdx +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/limitations.mdx @@ -32,3 +32,14 @@ The impact of this depends on what type of embedding is being performed. ### Data Formats * Pipelines currently only supports Text and Image formats. Other formats, including structured data, video, and audio, are not currently supported. + +### Upgrading + +When upgrading the aidb and pgfs extension, there is currently no support for Postgres extension upgrades. You must therefor drop and recreate the extensions when upgrading to a new version of the extensions. + +```sql +DROP EXTENSION aidb CASCADE; +DROP EXTENSION pgfs CASCADE; +CREATE EXTENSION aidb CASCADE; +CREATE EXTENSION pgfs CASCADE; +``` diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/openai-api-compatibility.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/openai-api-compatibility.mdx index 42be732e6d2..0e0d5e24569 100644 --- a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/openai-api-compatibility.mdx +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/openai-api-compatibility.mdx @@ -4,7 +4,7 @@ navTitle: "OpenAI Compatible Models" description: "Using an OpenAI compatible API with Pipelines by setting options and credentials." --- -To make use of an OpenAI compliant API, you can use the openai_embeddings or openai_completions model providers. Note that a retriever will need to encode first so you can only use the embeddings model provider with a retriever. +To make use of an OpenAI compliant API, you can use the embeddings or completions model providers. Note that a retriever will need to encode first so you can only use the embeddings model provider with a retriever. ## Why use an OpenAI compatible API? @@ -21,7 +21,7 @@ The starting point for this process is creating a model. When you create a model ```sql select aidb.create_model( 'my_local_ollama', -'openai_embeddings', +'embeddings', '{"model":"llama3.3", "url":"http://llama.local:11434/v1/embeddings", "dimensions":8192}'::JSONB, '{"api_key":""}'::JSONB); ``` @@ -30,7 +30,7 @@ select aidb.create_model( The model name is the first parameter and set to “my_local_ollama” which we will use later. -We specify the model provider as “openai_embeddings” which is the provider that defaults to using OpenAI servers, but can be overridden by the configuration (the next parameter), to talk to any compliant server. +We specify the model provider as “embeddings” which is the provider that defaults to using OpenAI servers, but can be overridden by the configuration (the next parameter), to talk to any compliant server. ### Configuration @@ -56,7 +56,7 @@ That completes the configuration parameter. ### Credentials -The last parameter is the credentials parameter, which is another JSON string. It’s usually used for carrying the `api_key` for the OpenAI service and any other necessary credential information. It is not part of the configuration and by being separate, it can be securely hidden from users with lesser permissions. For our ollama connection, we don’t need an api\_key, but the model provider currently requires that one is specified. We can specify an empty string for the api\_key to satisfy this requirement. +The last parameter is the credentials parameter, which is another JSON string. It’s usually used for carrying the `api_key` for the OpenAI service and any other necessary credential information. It is not part of the configuration and by being separate, it can be securely hidden from users with lesser permissions. For our ollama connection, we don’t need an `api_key`, but the model provider currently requires that one is specified. We can specify an empty string for the `api_key` to satisfy this requirement. ## Using the model diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/primitives.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/primitives.mdx index 4c90ab98cae..565ba6da4d2 100644 --- a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/primitives.mdx +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/primitives.mdx @@ -65,3 +65,17 @@ select aidb.decode_text_batch('my_bert_model', ARRAY[ 'summarize: The missile knows where it is at all times. It knows this because it knows where it isn''t. By subtracting where it is from where it isn''t, or where it isn''t from where it is (whichever is greater), it obtains a difference, or deviation. The guidance subsystem uses deviations to generate corrective commands to drive the missile from a position where it is to a position where it isn''t, and arriving at a position where it wasn''t, it now is.' ]); ``` + +## Rerank Text + +Call aidb.rerank_text to get text reranking logits. + +```sql +SELECT aidb.rerank_text('my_reranking_model', + 'What is the best open source database?', + ARRAY[ + 'PostgreSQL', + 'The quick brown fox jumps over the lazy dog.', + 'Hercule Poirot' + ]); +``` diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/completions.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/completions.mdx new file mode 100644 index 00000000000..b1fd3c5bbec --- /dev/null +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/completions.mdx @@ -0,0 +1,104 @@ +--- +title: "Completions" +navTitle: "Completions" +description: "Completions is a text completion model that enables use of any OpenAI API compatible text generation model." +--- + +Model name: `completions` + +Model aliases: + +* `openai_completions` +* `nim_completions` + +## About Completions + +Completions is a text completion model that enables use of any OpenAI API compatible text generation model. + +It is suitable for chat/text transforms, text completion, and other text generation tasks. + +Depending on the name of the model, the model provider will set defaults accordingly. + +When invoked as `completions` or `openai_completions`, the model provider will default to using the OpenAI API. + +When invoked as `nim_completions`, the model provider will default to using the NVIDIA NIM API. + + +## Supported aidb operations + +* decode_text +* decode_text_batch + +## Supported models + +* Any text generation model that is supported by the provider. + +## Supported OpenAI models + +See a list of supported OpenAI models [here](https://platform.openai.com/docs/models#models-overview). + +## Supported NIM models + +* [ibm/granite-guardian-3.0-8b](https://build.nvidia.com/ibm/granite-guardian-3_0-8b) +* [ibm/granite-3.0-8b-instruct](https://build.nvidia.com/ibm/granite-3_0-8b-instruct) +* [ibm/granite-3.0-3b-a800m-instruct](https://build.nvidia.com/ibm/granite-3_0-3b-a800m-instruct) +* [meta/llama-3.3-70b-instruct](https://build.nvidia.com/meta/llama-3_3-70b-instruct) +* [meta/llama-3.2-3b-instruct](https://build.nvidia.com/meta/llama-3.2-3b-instruct) +* [meta/llama-3.2-1b-instruct](https://build.nvidia.com/meta/llama-3.2-1b-instruct) +* [meta/llama-3.1-405b-instruct](https://build.nvidia.com/meta/llama-3_1-405b-instruct) +* [meta/llama-3.1-70b-instruct](https://build.nvidia.com/meta/llama-3_1-70b-instruct) +* [meta/llama-3.1-8b-instruct](https://build.nvidia.com/meta/llama-3_1-8b-instruct) +* [meta/llama3-70b-instruct](https://build.nvidia.com/meta/llama3-70b) +* [meta/llama3-8b-instruct](https://build.nvidia.com/meta/llama3-8b) +* [nvidia/llama-3.1-nemotron-70b-instruct](https://build.nvidia.com/nvidia/llama-3_1-nemotron-70b-instruct) +* [nvidia/llama-3.1-nemotron-51b-instruct](https://build.nvidia.com/nvidia/llama-3_1-nemotron-51b-instruct) +* [nvidia/nemotron-mini-4b-instruct](https://build.nvidia.com/nvidia/nemotron-mini-4b-instruct) +* [nvidia/nemotron-4-340b-instruct](https://build.nvidia.com/nvidia/nemotron-4-340b-instruct) +* [google/shieldgemma-9b](https://build.nvidia.com/google/shieldgemma-9b) +* [google/gemma-7b](https://build.nvidia.com/google/gemma-7b) +* [google/codegemma-7b](https://build.nvidia.com/google/codegemma-7b) + +## Creating the default model + +There is no default model for Completions. You can create any supported model using the `aidb.create_model` function. + +## Creating an OpenAI model + +You can create any supported OpenAI model using the `aidb.create_model` function. + +In this example, we are creating a GPT-4o model with the name `my_openai_model`: + +```sql +SELECT aidb.create_model( + 'my_openai_model', + 'openai_completions', + '{"model": "gpt-4o"}'::JSONB, + '{"api_key": "sk-abc123xyz456def789ghi012jkl345mn"}'::JSONB +); +``` + +## Creating a NIM model + +```sql +SELECT aidb.create_model( + 'my_nim_completions', + 'nim_completions', + '{"model": "meta/llama-3.2-1b-instruct"}'::JSONB, + credentials=>'{"api_key": "sk-abc123xyz456def789ghi012jkl345mn"'::JSONB); +``` + +## Model configuration settings + +The following configuration settings are available for OpenAI models: + +* `model` - The model to use. +* `url` - The URL of the model to use. This is optional and can be used to specify a custom model URL. + * If `openai_completions` (or `completions`) is the `model`, `url` defaults to `https://api.openai.com/v1/chat/completions`. + * If `nim_completions` is the `model`, `url` defaults to `https://integrate.api.nvidia.com/v1/chat/completions`. +* `max_concurrent_requests` - The maximum number of concurrent requests to make to the OpenAI model. Defaults to `25`. + +## Model credentials + +The following credentials are required for these models: + +* `api_key` - The API key to use for authentication. diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/openai-embeddings.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/embeddings.mdx similarity index 55% rename from advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/openai-embeddings.mdx rename to advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/embeddings.mdx index 4a18cdd522d..28d0cbacfa6 100644 --- a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/openai-embeddings.mdx +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/embeddings.mdx @@ -1,16 +1,25 @@ --- -title: "OpenAI Embeddings" -navTitle: "OpenAI Embeddings" -description: "OpenAI Embeddings is a text embedding model that enables use of any OpenAI text embedding model." +title: "Embeddings" +navTitle: "Embeddings" +description: "Embeddings is a text embedding model that enables use of any OpenAI API compatible text embedding model." --- -Model name: `openai_embeddings` +Model name: `embeddings` -## About OpenAI Embeddings +Model aliases: -OpenAI Embeddings is a text embedding model that enables use of any supported OpenAI text embedding model. It is suitable for text classification, clustering, and other text embedding tasks. +* `openai_embeddings` +* `nim_embeddings` -See a list of supported OpenAI models [here](https://platform.openai.com/docs/guides/embeddings#embedding-models). +## About Embeddings + +OpenAI Embeddings is a text embedding model that enables use of any OpenAI API complatible text embedding model. It is suitable for text classification, clustering, and other text embedding tasks. + +Depending on the name of the model, the model provider will set defaults accordingly. + +When invoked as `embeddings` or `openai_embeddings`, the model provider will default to using the OpenAI API. + +When invoked as `nim_embeddings`, the model provider will default to using the NVIDIA NIM API. ## Supported aidb operations @@ -19,10 +28,18 @@ See a list of supported OpenAI models [here](https://platform.openai.com/docs/gu ## Supported models -* Any text embedding model that is supported by OpenAI. This includes `text-embedding-3-small`, `text-embedding-3-large`, and `text-embedding-ada-002`. +* Any text embedding model that is supported by the provider. + +### Supported OpenAI models + +* Any text embedding model that is supported by OpenAI. This includes `text-embedding-3-small`, `text-embedding-3-large`, and `text-embedding-ada-002`. See a list of supported OpenAI models [here](https://platform.openai.com/docs/guides/embeddings#embedding-models). * Defaults to `text-embedding-3-small`. -## Creating the default model +### Supported NIM models + +* [nvidia/nv-embedqa-e5-v5](https://build.nvidia.com/nvidia/nv-embedqa-e5-v5) (default) + +## Creating the default with OpenAI model ```sql SELECT aidb.create_model('my_openai_embeddings', @@ -52,23 +69,11 @@ Because we are passing the configuration options and the credentials, unlike the The following configuration settings are available for OpenAI models: * `model` - The OpenAI model to use. -* `url` - The URL of the OpenAI model to use. This is optional and can be used to specify a custom model URL. Defaults to `https://api.openai.com/v1/chat/completions`. +* `url` - The URL of the model to use. This is optional and can be used to specify a custom model URL. + * If `openai_completions` (or `completions`) is the `model`, `url` defaults to `https://api.openai.com/v1/chat/completions`. + * If `nim_completions` is the `model`, `url` defaults to `https://integrate.api.nvidia.com/v1/chat/completions`. * `max_concurrent_requests` - The maximum number of concurrent requests to make to the OpenAI model. Defaults to `25`. -## Available OpenAI Embeddings models - -* sentence-transformers/all-MiniLM-L6-v2 (default) -* sentence-transformers/all-MiniLM-L6-v1 -* sentence-transformers/all-MiniLM-L12-v1 -* sentence-transformers/msmarco-bert-base-dot-v5 -* sentence-transformers/multi-qa-MiniLM-L6-dot-v1 -* sentence-transformers/paraphrase-TinyBERT-L6-v2 -* sentence-transformers/all-distilroberta-v1 -* sentence-transformers/all-MiniLM-L6-v2 -* sentence-transformers/multi-qa-MiniLM-L6-cos-v1 -* sentence-transformers/paraphrase-multilingual-mpnet-base-v2 -* sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 - ## Model credentials The following credentials are required for OpenAI models: diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/index.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/index.mdx index 59b628aaf42..5b3aa6eb68c 100644 --- a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/index.mdx +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/index.mdx @@ -12,8 +12,11 @@ navigation: This section provides details of the supported models in EDB Postgres AI - AI Accelerator - Pipelines and their capabilities. -* [T5](t5) -* [OpenAI Embeddings](openai-embeddings) -* [OpenAI Completions](openai-completions) -* [BERT](bert) -* [CLIP](clip) +* [T5](t5). +* [Embeddings](embeddings), including openai-embeddings and nim-embeddings. +* [Completions](completions), including openai-completions and nim-completions. +* [BERT](bert). +* [CLIP](clip). +* [NIM_CLIP](nim_clip). +* [NIM_RERANKING](nim_reranking). + diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/nim_clip.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/nim_clip.mdx new file mode 100644 index 00000000000..c872e1211c8 --- /dev/null +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/nim_clip.mdx @@ -0,0 +1,54 @@ +--- +title: "CLIP" +navTitle: "CLIP" +description: "CLIP (Contrastive Language-Image Pre-training) is a model that learns visual concepts from natural language supervision." +--- + +Model name: `nim_clip` + +## About CLIP + +CLIP (Contrastive Language-Image Pre-training) is a model that learns visual concepts from natural language supervision. It is a zero-shot learning model that can be used for a wide range of vision and language tasks. + +This specific model runs on NVIDIA NIM. More information about CLIP on NIM can be found [here](https://build.nvidia.com/nvidia/nvclip). + + +## Supported aidb operations + +* encode_text +* encode_text_batch +* encode_image +* encode_image_batch + +## Supported models + +### NVIDIA NGC + +* nvidia/nvclip (default) + + +## Creating the default model + +```sql +SELECT aidb.create_model( + 'my_nim_clip_model', + 'nim_clip', + credentials=>'{"api_key": ""'::JSONB +); +``` + +There is only one model, the default `nvidia/nvclip`, so we do not need to specify the model in the configuration. + +## Model configuration settings + +The following configuration settings are available for CLIP models: + +* `model` - The NIM model to use. The default is `nvidia/nvclip` and is the only model available. +* `url` - The URL of the model to use. This is optional and can be used to specify a custom model URL. Defaults to `https://integrate.api.nvidia.com/v1/embeddings`. +* `dimensions` - Model output vector size, defaults to 1024 + +## Model credentials + +The following credentials are required if executing inside NVIDIA NGC: + +* `api_key` - The NVIDIA Cloud API key to use for authentication. diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/nim_reranking.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/nim_reranking.mdx new file mode 100644 index 00000000000..3380a453c82 --- /dev/null +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/nim_reranking.mdx @@ -0,0 +1,48 @@ +--- +title: "Reranking (NIM)" +navTitle: "reranking" +description: "Reranking is a method in text search that sorts results by relevance to make them more accurate." +--- + +Model name: `nim_reranking` + +## About Reranking + +Reranking is a method in text search that sorts results by relevance to make them more accurate. It gives scores to documents using cross-attention mechanisms, improving the initial search results. + +## Supported aidb operations + +* rerank_text + +## Supported models + +### NVIDIA NGC + +* nvidia/llama-3.2-nv-rerankqa-1b-v2 (default) + + + +## Creating the default model + +```sql +SELECT aidb.create_model( + 'my_nim_reranker', + 'nim_reranking', + credentials=>'{"api_key": ""'::JSONB +); +``` + +There is only one model, the default `nvidia/nvclip`, so we do not need to specify the model in the configuration. + +## Model configuration settings + +The following configuration settings are available for CLIP models: + +* `model` - The NIM model to use. The default is `nvidia/llama-3.2-nv-rerankqa-1b-v2` and is the only model available. +* `url` - The URL of the model to use. This is optional and can be used to specify a custom model URL. Defaults to `https://ai.api.nvidia.com/v1/retrieval`. + +## Model credentials + +The following credentials are required if executing inside NVIDIA NGC: + +* `api_key` - The NVIDIA Cloud API key to use for authentication. diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/openai-completions.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/openai-completions.mdx deleted file mode 100644 index fbf672d710b..00000000000 --- a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/supported-models/openai-completions.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: "OpenAI Completions" -navTitle: "OpenAI Completions" -description: "OpenAI Completions is a text completion model that enables use of any OpenAI text generation model." ---- - -Model name: `openai_completions` - -## About OpenAI Completions - -OpenAI Completions is a text completion model that enables use of any supported OpenAI text generation model. It is suitable for chat/text transforms, text completion, and other text generation tasks. - -See a list of supported OpenAI models [here](https://platform.openai.com/docs/models#models-overview). - -## Supported aidb operations - -* decode_text -* decode_text_batch - -## Supported models - -* Any text generation model that is supported by OpenAI. This includes models such as GPT-4o, GPT-4o mini, GPT-4 and GPT-3.5. - -## Creating the default 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 create any supported OpenAI model using the `aidb.create_model` function. - -In this example, we are creating a GPT-4o model with the name `my_openai_model`: - -```sql -SELECT aidb.create_model( - 'my_openai_model', - 'openai_completions', - '{"model": "gpt-4o"}'::JSONB, - '{"api_key": "sk-abc123xyz456def789ghi012jkl345mn"}'::JSONB -); -``` - -## Model configuration settings - -The following configuration settings are available for OpenAI models: - -* `model` - The OpenAI model to use. -* `url` - The URL of the OpenAI model to use. This is optional and can be used to specify a custom model URL. Defaults to `https://api.openai.com/v1/chat/completions`. -* `max_concurrent_requests` - The maximum number of concurrent requests to make to the OpenAI model. Defaults to `25`. - -## Model credentials - -The following credentials are required for OpenAI models: - -* `api_key` - The OpenAI API key to use for authentication. - diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/using-models.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/using-models.mdx index d172956444c..b27ec20db49 100644 --- a/advocacy_docs/edb-postgres-ai/ai-accelerator/models/using-models.mdx +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/models/using-models.mdx @@ -49,11 +49,18 @@ __OUTPUT__ server_name | server_options --------------------+---------------- t5_local | + embeddings | + completions | openai_embeddings | openai_completions | + nim_completions | + nim_embeddings | + nim_clip | + nim_reranking | bert_local | clip_local | dummy | +(12 rows) ``` This will return a list of all the model providers that are currently available in the system. You can find out more about these providers and their capabilities in the [Supported Models](./supported-models) section. @@ -73,7 +80,7 @@ This will create a model named `my_model` that uses the `bert_local` model provi ## 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. +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. Similarly the `nim-completions` and `nim-embeddings` models are models which you can create to make use of NVIDIA's completions and embeddings APIs. 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: @@ -101,9 +108,24 @@ SELECT aidb.create_model( This will create the `text-embedding-3-large` model with the name `my_openai_embeddings`. You can now use this model in your Pipelines functions to generate embeddings for text data. -## Using models with OpenAI compatible APIs +Where models do use credentials, the credentials set in the first use of create model for the model provider will be used with all subsequent uses of that model. It is not possible to use different credentia;s for different models that use the same provider. + +If you need to change the credentials, you can use the `replace_credentials` option when creating a new model that updates the credentials for the model provider. -These OpenAI models work with any OpenAI compatible API. This allows you to connect and use an even wider range of models, just by passing the appropriate API endpoint to the `url` option in the `aidb.create_model` function's options. +```sql +SELECT aidb.create_model( + 'my_new_openai_model', + 'openai_completions', + '{"model": "gpt-4o"}'::JSONB, + '{"api_key": "sk-ngl234meh789ski1111bid011i"}'::JSONB, + replace_credentials => true + ); +``` + +You can delete the new model with `SELECT aidb.delete_model('my_new_openai_model')` if you only needed to change the credentials. + +## Using models with OpenAI compatible APIs -For more information about the OpenAI models, see the [OpenAI Completions](./supported-models/openai-completions) and [OpenAI Embeddings](./supported-models/openai-embeddings) pages. +The `completions` and `embeddings` models work with any OpenAI compatible API. This allows you to connect and use an even wider range of models, just by passing the appropriate API endpoint to the `url` option in the `aidb.create_model` function's options. +For more information about the models, see the [Completions](./supported-models/completions) and [Embeddings](./supported-models/embeddings) pages. diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/reference/index.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/reference/index.mdx index 36b66ab7bd4..0a13ddfcbdf 100644 --- a/advocacy_docs/edb-postgres-ai/ai-accelerator/reference/index.mdx +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/reference/index.mdx @@ -20,6 +20,12 @@ navigation: * [aidb.list_models](models#aidblist_models) * [aidb.get_model](models#aidbget_model) * [aidb.delete_model](models#aidbdelete_model) +* [aidb.encode_text](models#aidbencode_text) +* [aidb.encode_text_batch](models#aidbencode_text_batch) +* [aidb.decode_text](models#aidbdecode_text) +* [aidb.decode_text_batch](models#aidbdecode_text_batch) +* [aidb.encode_image](models#aidbencode_image) +* [aidb.rerank_text](models#aidbrerank_text) ## Retrievers diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/reference/models.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/reference/models.mdx index c830f065e85..b605bb7030d 100644 --- a/advocacy_docs/edb-postgres-ai/ai-accelerator/reference/models.mdx +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/reference/models.mdx @@ -27,12 +27,13 @@ Creates a new model in the system by saving its name, provider and optional conf #### Parameters -| Parameter | Type | Default | Description | -|---------------|-------|-------------|----------------------------------------------------------------------------------------| -| `name` | text | | User defined name for the model. | -| `provider` | text | | Name of the model provider (as found in [aidb.model_providers](#aidbmodel_providers)). | -| `config` | jsonb | '{}'::jsonb | Optional configuration for the model provider. | -| `credentials` | jsonb | '{}'::jsonb | Optional credentials for the model provider. | +| Parameter | Type | Default | Description | +|-----------------------|---------|-------------|-------------------------------------------------------------------------------------------------------------| +| `name` | text | | User defined name for the model. | +| `provider` | text | | Name of the model provider (as found in [aidb.model_providers](#aidbmodel_providers)). | +| `config` | jsonb | '{}'::jsonb | Optional configuration for the model provider. | +| `credentials` | jsonb | '{}'::jsonb | Optional credentials for the model provider. | +| `replace_credentials` | boolean | false | If true, replace the credentials for the model provider. If false, the credentials will not be overwritten. | #### Example @@ -52,6 +53,19 @@ or equivalently, using default values: SELECT aidb.create_model('my_t5', 't5_local'); ``` +or if updating the credentials of a model's provider, which has already been created. + +```sql +SELECT aidb.create_model( + name => 'my_t5'::text, + provider => 't5_local'::character varying, + config => '{"param1": "value1", "param2": "value2"}'::jsonb, + credentials => '{"token": "abcd"}'::jsonb, + replace_credentials => true + ); +``` + + ### `aidb.list_models` Returns a list of all models in the registry and their configured options. @@ -210,3 +224,20 @@ Encodes an image using a model, generating a vector representation of a given im |--------------|------|-------------------| | `encode_image` | bytea | The encoded image. | +### `aidb.rerank_text` + +Reranks text using a model, generating a vector representation of a given text input. + +#### Parameters + +| Parameter | Type | Default | Description | +|--------------|------------------|---------|-----------------------------------| +| `model_name` | text | | Name of the model to rerank with. | `text` | text | | Text to rerank. | +| `inputs` | strings\[\] | \[\] | Inputs for the model provider. | + +#### Returns + +| Column | Type | Description | +|---------------|----------------------|----------------------------| +| `rerank_text` | double precision\[\] | Array of reranking logits. | + diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/rel_notes/ai-accelerator_2.1.1_rel_notes.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/rel_notes/ai-accelerator_2.1.1_rel_notes.mdx new file mode 100644 index 00000000000..c303c05819f --- /dev/null +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/rel_notes/ai-accelerator_2.1.1_rel_notes.mdx @@ -0,0 +1,22 @@ +--- +title: AI Accelerator - Pipelines 2.1.1 release notes +navTitle: Version 2.1.1 +--- + +Released: 3 February 2025 + + +## Highlights + +- Support for Nvidia NIM. +- `embeddings` and `completions` are new model names. +- Reranking using NIM available. + +## Enhancements + + + +
DescriptionAddresses
Renaming of openai_embedding and openai_completion

The model names openai_embedding and openai_completion have been renamed to embeddings and completions respectively. The old names are still supported for backward compatibility.

+
+ + diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/rel_notes/index.mdx b/advocacy_docs/edb-postgres-ai/ai-accelerator/rel_notes/index.mdx index e3daad74bea..a906a73002b 100644 --- a/advocacy_docs/edb-postgres-ai/ai-accelerator/rel_notes/index.mdx +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/rel_notes/index.mdx @@ -4,6 +4,7 @@ navTitle: Release notes description: Release notes for EDB Postgres AI - AI Accelerator indexCards: none navigation: + - ai-accelerator_2.1.1_rel_notes - ai-accelerator_2.0.0_rel_notes - ai-accelerator_1.0.7_rel_notes --- @@ -14,5 +15,6 @@ The EDB Postgres AI - AI Accelerator describes the latest version of AI Accelera | AI Accelerator version | Release Date | |---|---| +| [2.1.1](./ai-accelerator_2.1.1_rel_notes) | 03 Feb 2025 | | [2.0.0](./ai-accelerator_2.0.0_rel_notes) | 13 Jan 2025 | | [1.0.7](./ai-accelerator_1.0.7_rel_notes) | 10 Dec 2024 | diff --git a/advocacy_docs/edb-postgres-ai/ai-accelerator/rel_notes/src/rel_notes_2.1.1.yml b/advocacy_docs/edb-postgres-ai/ai-accelerator/rel_notes/src/rel_notes_2.1.1.yml new file mode 100644 index 00000000000..524637c3543 --- /dev/null +++ b/advocacy_docs/edb-postgres-ai/ai-accelerator/rel_notes/src/rel_notes_2.1.1.yml @@ -0,0 +1,17 @@ +product: AI Accelerator - Pipelines +version: 2.1.1 +date: 3 February 2025 +intro: | + +highlights: | + - Support for Nvidia NIM. + - `embeddings` and `completions` are new model names. + - Reranking using NIM available. +relnotes: +- relnote: Renaming of openai_embedding and openai_completion + details: | + The model names `openai_embedding` and `openai_completion` have been renamed to `embeddings` and `completions` respectively. The old names are still supported for backward compatibility. + jira: "" + addresses: "" + type: Enhancement + impact: High