Add kagi_fastgpt tool - #23
Open
MarcelDuchamp wants to merge 1 commit into
Open
MarcelDuchamp wants to merge 1 commit into
MarcelDuchamp wants to merge 1 commit into
Conversation
FastGPT combines live web search with an LLM to return a concise, cited answer to a natural-language query. Complements the existing search and summarizer tools and, unlike kagi_search_fetch, works with any standard Kagi API key (no Search-API beta required). - New tool kagi_fastgpt(query, cache=True) calling POST /api/v0/fastgpt. - Output formats the answer followed by a numbered reference list. - Bypasses kagiapi 0.2.1's .fastgpt() helper, which serializes `cache` as a JSON string that the endpoint rejects; posts through the authenticated session directly with a real boolean. - README: new "Tools" section documenting all three tools and which ones require the Search-API beta.
Contributor
|
Going to leave this PR open for now. We use different API keys for the v0 fastgpt and the v1 search API. These will be merged soon, so I'll build off this and merge once we do that, to keep things simple. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new
kagi_fastgptMCP tool that wraps the Kagi FastGPT API(
POST /api/v0/fastgpt). FastGPT answers natural-language questions witha short synthesized response plus numbered web citations, and — unlike
kagi_search_fetch— works with any standard Kagi API key withoutrequiring Search API beta access.
What's new
kagi_fastgpt(query, cache=True)posts to/api/v0/fastgptand returnsthe answer text followed by a numbered reference list for any cited
sources. Schema-compatible with the existing FastMCP tool style.
which require Search API beta access.
Implementation note
kagiapi 0.2.1has a bug in itsKagiClient.fastgpt()helper: itserializes the
cacheparam as the JSON string"true"/"false",which the FastGPT endpoint rejects with
{"code": 1, "msg": "Unexpected JSON value for parameter \"cache\""}.Sending a real boolean works. This PR bypasses the helper and posts
through the client's authenticated session directly with a real boolean,
so the tool works today against the live API without needing an upstream
kagiapirelease. Happy to open a separate PR onkagisearch/kagiapi if you'd like.
Testing
Against a standard key,
kagi_fastgpt(query="What is the capital of Iceland?")returns a cited answer;
kagi_fastgpt(query=..., cache=False)forces afresh search. Existing
kagi_summarizerremains unchanged and verifiedworking alongside the new tool.