karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.04k stars 113 forks source link

kagi fastgpt integration #166

Closed ParetoOptimalDev closed 5 months ago

ParetoOptimalDev commented 6 months ago

https://help.kagi.com/kagi/api/fastgpt.html#examples

I think you mentioned using this @karthink so you might have it? I'm trying to see if it just works right now, but I'm guessing at least some work will need to be done for parsing the json result:

{
  "data": {
    "output": "Python 3.11 is a major release of the Python programming language released in October 2021. It will receive bugfix updates approximately every 2 months until October 2027 according to [1]. \n\nSome key changes and features in Python 3.11 include:\n\n- Starred unpacking expressions can now be used in for statements [2].\n\n- Asynchronous comprehensions are now supported [2]. \n\n- Python 3.11.7 is the newest bugfix release as of October 2022 [3].\n\n- Python 3.11 will receive bugfix support until October 2027 as per the release schedule [4].\n\n- Performance improvements have been reported when integrating Python 3.11 with the FreeCAD application [5].\n\n- Release notes for changes between versions like 3.11.1 and 3.11.0 are not explicitly documented on python.org [6].\n\nLet me know if you need any clarification or have additional questions!",
    "tokens": 0,
    "references": [
      {
        "title": "PEP 664 – Python 3.11 Release Schedule | peps.python.org",
        "snippet": " 3.11 will receive bugfix updates approximately every 2 months for approximately 18 months. Some time after the release of 3.12.0 final, the ...",
        "url": "https://peps.python.org/pep-0664/"
      },
      {
        "title": "What's New In Python 3.11 — Python 3.12.1 documentation",
        "snippet": "Other Language Changes¶ · Starred unpacking expressions can now be used in for statements. (See bpo-46725 for more details.) · Asynchronous comprehensions are ...",
        "url": "https://docs.python.org/3/whatsnew/3.11.html"
      },
      {
        "title": "Python Release Python 3.11.7 | Python.org",
        "snippet": " This is the seventh maintenance release of Python 3.11. Python 3.11.7 is the newest major release of the Python programming language, and it ...",
        "url": "https://www.python.org/downloads/release/python-3117/"
      },
      {
        "title": "Download Python | Python.org",
        "snippet": "Active Python Releases · 3.13 prerelease 2024-10-01 (planned) 2029-10 PEP 719 · 3.12 bugfix 2023-10-02 2028-10 PEP 693 · 3.11 bugfix 2022-10-24 2027-10 PEP 664 ...",
        "url": "https://www.python.org/downloads/"
      },
      {
        "title": "(1) Discussion: Python 3.11 Integration to FreeCAD (apparently ...",
        "snippet": " Discussion: Python 3.11 Integration to FreeCAD (apparently there is a performance boost) ... At the moment, Python 3.11 is being prepared for ...",
        "url": "https://forum.freecad.org/viewtopic.php?t=74026"
      },
      {
        "title": "3.11.1 vs 3.11.0 diff? - Ideas - Discussions on Python.org",
        "snippet": " It would be nice if Python Release Python 3.11.1 | Python.org showed a listing of differences between 3.11.1 and 3.11.",
        "url": "https://discuss.python.org/t/3-11-1-vs-3-11-0-diff/22081"
      }
    ]
  }
}
karthink commented 6 months ago

It's on the kagi-fastgpt branch of the repo, the backend definition example is in the README.

I'm guessing at least some work will need to be done for parsing the json result:

This work has been done. It works but it's not merged yet because Kagi's fastgpt has no concept of a "system message" or multi-turn conversations, so it will probably confuse users who try to use it like ChatGPT. We can fake the "system message" by prepending the prompt with it (this is what I do for Gemini), but the lack of chat is a bit more of a problem.

ParetoOptimalDev commented 6 months ago

Oh okay.. thanks! I'll give it a try in a bit and maybe after I experience it I'll have some useful feedback or ideas.

karthink commented 6 months ago

Likewise, it's simple to implement Kagi's summarizer API, but I'm not sure how to integrate it with gptel.

karthink commented 5 months ago

I merged Kagi support into master, with the caveat that multi-turn conversations are not supported.

Only the FastGPT model is supported -- adding support for Kagi summarizer requires new UI ideas and I'm still prototyping how to send files etc. It can be a separate issue if required, closing this now.

karthink commented 5 months ago

Support for Kagi's Universal Summarizer has been added. The Readme mentions it in the Kagi section.