[ML] Exposing OpenAI URL field in services API (#126638)
* Adding url configuration field * Fixing test
This commit is contained in:
parent
7ad2369f7e
commit
39e594f9b9
|
@ -60,6 +60,7 @@ import java.util.Set;
|
|||
import static org.elasticsearch.xpack.inference.external.action.ActionUtils.constructFailedToSendRequestMessage;
|
||||
import static org.elasticsearch.xpack.inference.services.ServiceFields.DIMENSIONS;
|
||||
import static org.elasticsearch.xpack.inference.services.ServiceFields.MODEL_ID;
|
||||
import static org.elasticsearch.xpack.inference.services.ServiceFields.URL;
|
||||
import static org.elasticsearch.xpack.inference.services.ServiceUtils.createInvalidModelException;
|
||||
import static org.elasticsearch.xpack.inference.services.ServiceUtils.parsePersistedConfigErrorMsg;
|
||||
import static org.elasticsearch.xpack.inference.services.ServiceUtils.removeFromMap;
|
||||
|
@ -418,6 +419,19 @@ public class OpenAiService extends SenderService {
|
|||
() -> {
|
||||
var configurationMap = new HashMap<String, SettingsConfiguration>();
|
||||
|
||||
configurationMap.put(
|
||||
URL,
|
||||
new SettingsConfiguration.Builder(SUPPORTED_TASK_TYPES_FOR_SERVICES_API).setDescription(
|
||||
"The absolute URL of the external service to send requests to."
|
||||
)
|
||||
.setLabel("URL")
|
||||
.setRequired(false)
|
||||
.setSensitive(false)
|
||||
.setUpdatable(false)
|
||||
.setType(SettingsConfigurationFieldType.STRING)
|
||||
.build()
|
||||
);
|
||||
|
||||
configurationMap.put(
|
||||
MODEL_ID,
|
||||
new SettingsConfiguration.Builder(SUPPORTED_TASK_TYPES_FOR_SERVICES_API).setDescription(
|
||||
|
|
|
@ -1590,6 +1590,15 @@ public class OpenAiServiceTests extends ESTestCase {
|
|||
"type": "str",
|
||||
"supported_task_types": ["text_embedding", "completion", "chat_completion"]
|
||||
},
|
||||
"url": {
|
||||
"description": "The absolute URL of the external service to send requests to.",
|
||||
"label": "URL",
|
||||
"required": false,
|
||||
"sensitive": false,
|
||||
"updatable": false,
|
||||
"type": "str",
|
||||
"supported_task_types": ["text_embedding", "completion", "chat_completion"]
|
||||
},
|
||||
"dimensions": {
|
||||
"description": "The number of dimensions the resulting embeddings should have. For more information refer to https://platform.openai.com/docs/api-reference/embeddings/create#embeddings-create-dimensions.",
|
||||
"label": "Dimensions",
|
||||
|
|
Loading…
Reference in New Issue