Open reuschling opened 2 months ago
I did it - the connector was not well defined for the OpenAi compatibel endpoint.
The documentation lacks a bit for defining a connector for an agent for an OpenAi endpoint. I found two solutions:
Legacy /v1/completions
endpoint with parameters.prompt:
{
"name": "OpenAI connector for the agent framework",
"version": 2,
"description": "Uses parameters.prompt which is filled from the agent framework",
"protocol": "http",
"parameters": {
"endpoint": "xyz:8000",
"model": "meta-llama-3.1-70b-instruct-fp8",
"response_filter": "$.choices[0].text"
},
"actions": [
{
"action_type": "PREDICT",
"method": "POST",
"url": "http://${parameters.endpoint}/v1/completions",
"request_body": "{ \"model\": \"${parameters.model}\", \"prompt\": \"${parameters.prompt}\" }"
}
]
}
/v1/chat/completions
by setting the json list with the prompt as first and only entry:
{
"name": "OpenAI connector for the agent framework",
"version": 2,
"description": "Uses parameters.prompt which is filled from the agent framework, give it as single message list entry",
"protocol": "http",
"parameters": {
"endpoint": "serv-3306.kl.dfki.de:8000",
"model": "meta-llama-3.1-70b-instruct-fp8",
"response_filter": "$.choices[0].message.content"
},
"actions": [
{
"action_type": "PREDICT",
"method": "POST",
"url": "http://${parameters.endpoint}/v1/chat/completions",
"request_body": "{ \"model\": \"${parameters.model}\", \"messages\": [{\"role\":\"user\",\"content\":\"${parameters.prompt}\"}] }"
}
]
}
Specifiying RAG with a retrieval_augmented_generation search response processor generates a correct json message list for OpenAi endpoints inside parameters.messages. For the agent framework, I only found parameters.prompt. Is there maybe also another parameter with the messages json list?
What is the correct way to connect to an OpenAi endpoint model with the agent framework?
we should create tutorials for agents configurations along with details for connector setting. assigning to @jngz-es
I have a running llm model that connects to a self-hosted, OpenAi compatible server with a Llama3.1 model behind. I can make requests to the model with OpenSearch, further everything works when I use this model in a RAG setting by specifying the RAG workflow with a search pipeline with the help of the 'retrieval_augmented_generation' response processor. Running requests like this works:
{{ _.openSearchUrl }}/_plugins/ml/models/{{ .LlmModelId }}/_predict
The connector definition looks like this. Note the model definition '\"model\": \"meta-llama-3.1-70b-instruct-fp8\"' which is mandatory for my server.
Now I want to define an agent with this model, i.e. a conversational agent that uses this llm model. This is my first test agent definition. It is just a simple boolean query into an index of mine, the same query running independently runs of course: (please ignore the placeholders for insomnia env variables)
{{ _.openSearchUrl }}/_plugins/_ml/agents/_register
Now I run the agent:
{{ _.openSearchUrl }}/_plugins/ml/agents/{{ .agentId }}/_execute
I get this error:
This is the according exception from the logs:
I have no idea what I can do, I have the impression that there is some check inside the agent framework that breaks the connector. This would be for no reason, the connector definition should be transparent for the agent framework.