Skip to content

TODO: Go Rewrite #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
callbacked opened this issue Oct 25, 2024 · 3 comments
Open

TODO: Go Rewrite #7

callbacked opened this issue Oct 25, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@callbacked
Copy link
Owner

go is cool and awesome

@callbacked callbacked changed the title Go Rewrite TODO: Go Rewrite Oct 25, 2024
@callbacked callbacked added the enhancement New feature or request label Oct 25, 2024
@kth8
Copy link

kth8 commented Oct 29, 2024

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

@callbacked
Copy link
Owner Author

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.

@kth8
Copy link

kth8 commented Oct 30, 2024

I remembered this project tgpt is written in Go and also connects to DuckDuckGo's AI Chat so perhaps you can take a look at their implementation and use it as another reference when the time comes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants