Open callbacked opened 3 weeks ago
I saw this project from Reddit and it looks pretty cools. I tested this using Open WebUI and it worked well although the speed is noticeably slower compared to using duck.ai directly. I fed your code in my AI and got this after some prompting. It doesn't work exactly right as content gets printed out from the sever instead of to the client but atleast it's able to get a response https://gist.github.com/kth8/f9f660583484243d9ff071ec46a994b7
curl -s http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "keyless-gpt-4o-mini", "messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello!"}]}' | jq .
{
"id": "1c2fd1e8-f076-4b2a-897e-1e7a8a3ed604",
"object": "chat.completion",
"created": 1730203855,
"model": "keyless-gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": ""
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 2,
"completion_tokens": 0,
"total_tokens": 2
}
}
2024/10/29 12:10:48 Server is running on port 8080...
2024/10/29 12:10:55 Received chat completion request for conversation 1c2fd1e8-f076-4b2a-897e-1e7a8a3ed604
2024/10/29 12:10:55 DuckDuckGo response status code: 200
2024/10/29 12:10:55 DuckDuckGo response body: data: {"role":"assistant","message":"","created":1730203855,"id":"chatcmpl-ANfLj1zJJNNAXkl22NU1dN7G8HrNU","action":"success","model":"gpt-4o-mini-2024-07-18"}
data: {"message":"How","created":1730203855,"id":"chatcmpl-ANfLj1zJJNNAXkl22NU1dN7G8HrNU","action":"success","model":"gpt-4o-mini-2024-07-18"}
data: {"message":" can","created":1730203855,"id":"chatcmpl-ANfLj1zJJNNAXkl22NU1dN7G8HrNU","action":"success","model":"gpt-4o-mini-2024-07-18"}
data: {"message":" I","created":1730203855,"id":"chatcmpl-ANfLj1zJJNNAXkl22NU1dN7G8HrNU","action":"success","model":"gpt-4o-mini-2024-07-18"}
data: {"message":" assist","created":1730203855,"id":"chatcmpl-ANfLj1zJJNNAXkl22NU1dN7G8HrNU","action":"success","model":"gpt-4o-mini-2024-07-18"}
data: {"message":" you","created":1730203855,"id":"chatcmpl-ANfLj1zJJNNAXkl22NU1dN7G8HrNU","action":"success","model":"gpt-4o-mini-2024-07-18"}
data: {"message":" today","created":1730203855,"id":"chatcmpl-ANfLj1zJJNNAXkl22NU1dN7G8HrNU","action":"success","model":"gpt-4o-mini-2024-07-18"}
data: {"message":"?","created":1730203855,"id":"chatcmpl-ANfLj1zJJNNAXkl22NU1dN7G8HrNU","action":"success","model":"gpt-4o-mini-2024-07-18"}
data: {"created":1730203855,"id":"chatcmpl-ANfLj1zJJNNAXkl22NU1dN7G8HrNU","action":"success","model":"gpt-4o-mini-2024-07-18"}
data: [DONE
Wow, the code looks promising. For the time being I will look into performance optimizations to the current python code to see if I can speed some things up. Right now, I intend on tackling the issue of fetching the model names automatically, because I have them hardcoded, and if DuckDuckGo ever decides to add/update new models to their site, the API wrapper will break. Gonna prioritize that first.
Got a busy week ahead of me sadly, so I'll leave this for the weekend.
go is cool and awesome