Open maxhniebergall opened 2 days ago
A POC for the unified API communicating with OpenAI
The _unified route is behind a feature flag, so to enable it run es like this:
_unified
./gradlew :run -Drun.license_type=trial -Des.inference_unified_feature_flag_enabled=true
Creating a completion endpoint
PUT http://localhost:9200/_inference/completion/test { "service": "openai", "service_settings": { "api_key": "<api key>", "model_id": "gpt-4o" } }
Completion request
POST http://localhost:9200/_inference/completion/test/_unified { "model": "gpt-4o", "messages": [ { "role": "user", "content": "What is the weather like in Boston today?" } ], "stop": "none", "tools": [ { "type": "function", "function": { "name": "get_current_weather", "description": "Get the current weather in a given location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" }, "unit": { "type": "string", "enum": [ "celsius", "fahrenheit" ] } }, "required": [ "location" ] } } } ], "tool_choice": "auto" }
Implementing the response format is still in progress
Pinging @elastic/ml-core (Team:ML)
Hi @maxhniebergall, I've created a changelog YAML for you.
Tests to add:
castTo
Address outstanding TODOs
A POC for the unified API communicating with OpenAI
Testing
Running ES
The
_unified
route is behind a feature flag, so to enable it run es like this:Creating endpoint and sending requestions
Creating a completion endpoint
Completion request
Response format
Implementing the response format is still in progress