Set a provider for embedding model
Determine which AI provider to use for your embedding model to work in the AI Search RAG application.
Vorbereitungen
Configure a connection and credential alias for your preferred provider. See Create a Connection & Credential alias.
Role required: admin
Prozedur
- Navigate to All, and then enter sys_one_extend_capability.list in the filter to go to the OneExtend Capabilities table.
- Select the Bring Your Own Embedding Model capability to configure.
- In the OneExtend Capability Definitions related list, select New.
- In the Name field, enter the name of the capability definition.
- In the API type field, select system.
-
In the API field, select the search icon to select the document.
- In the Table name field, select One API System Executor [one_api_system_executor].
- In the Document field, select Generic Embedder.
- Select OK.
- In the Connection And Credential Alias, select the alias that you want to integrate with your custom embedding model.
- Select the Advanced option.
-
Write pre-processing and post-processing scripts.
To have AI Search RAG application understand the format of the inputs and outputs of your embedding model, you must write pre-processing and post-processing scripts. These scripts depend on the expected request and response objects that are interpreted by your model.
For example, the Azure OpenAI request structure looks like the following script:
The preprocessor script for that request structure is the following script:{"messages": [{"role":"user", "content":"Summarize the following text: <<content>>"}], "max_tokens": 800, "temperature": 0.7}
The response structure from Azure OpenAI looks like this script: <tbd>(function(inputs) { /* write code here to transform capability input to definition input.*/ inputs = JSON.parse(inputs); return inputs; })(inputs);
Because of that response structure, the response postprocessor script looks like this script:{ "choices": [{ "finish_reason": "stop", "index": 0, "message": { "content": "<<response>>", "role": "assistant" } }], "created": 1714994995, "id": "chatcmpl-9LqpXeLVXDAi6kciPfLeIDjmALeea", "model": "gpt-35-turbo-16k", "object": "chat.completion", "usage": { "completion_tokens": 47, "prompt_tokens": 70, "total_tokens": 117 } }(function(inputs) { /* write code here to transform definition output to capability output.*/ to transform the llm response into an array of text responses, using the inputs object inputs structure: { inputs = JSON.parse(inputs); return inputs; })(inputs); - Select Submit.