kagi
Crystal shard for interacting with the Kagi REST API.
Supports the following APIs:
- Kagi Search API via
Kagi::Search
- Enrichment API via
Kagi::Enrich
- Universal Summarizer API via
Kagi::Summarize
- FastGPT API via
Kagi::FastGPT
Installation
-
Add the dependency to your
shard.yml
:dependencies: kagi: github: nobodywasishere/kagi.cr
-
Run
shards install
-
Get a Kagi API key from here
-
Set the environment variable
KAGI_API_KEY
with your API key
Usage
Library
require "kagi"
results = Kagi::Enrich.web("steve jobs")
results # => # Array of `Kagi::Object::Result | Kagi::Object::RelatedResults`
results.each do |result|
next if result.is_a? Kagi::Object::RelatedResults
result = result.as(Kagi::Object::Result)
puts <<-RESULT
#{result.rank}: #{result.title}
#{result.url}
RESULT
end
CLI
$ ./bin/kagi
Usage: kagi [subcommand] [argument]
kagi search [query] - Search Kagi
kagi enrich [news|web] [query] - Search Enrichment APIs
kagi fast-gpt [query] - Ask FastGPT
kagi summarize [url] - Summarize a URL
$ ./bin/kagi enrich web steve jobs
1: Dennis Forbes on Software and Technology - Steve Jobs Just Murdered the Web
https://web.archive.org/web/20100414005022/http://www.yafla.com/dforbes/Steve_Jobs_Just_Murdered_the_Web/
2: World Wild Web: Steve Jobs Stanford Commencement Speech 2005
http://satyajeetsingh.blogspot.com/2007/10/steve-jobs-stanford-commencement-speech.html
3: 15 Great Google Web Fonts Demonstrated By The Best Steve Jobs Quotes
https://www.shareaholic.com/blog/google-web-fonts/
4: Steve Jobs | I, Cringely
http://www.cringely.com/2011/10/steve-jobs-is-dead/
5: Why web developers have more to learn from Wall Street than Steve Jobs
https://scoutapm.com/blog/why-web-developers-have-more-learn-to-from-wall-street-than-steve-jobs
6: Steve Jobs: 1955-2011 - Marco.org
https://marco.org/2011/10/05/steve-jobs-dies
7: Steve Jobs - Wikipedia
https://en.wikipedia.org/wiki/Steve_Jobs
8: Steve Paul Jobs
https://ei.cs.vt.edu/~history/Jobs.html
9: Steve Jobs: The Next Insanely Great Thing ��� (The Web) | The Web Ahead
http://thewebahead.net/linkblog/2014/09/steve-jobs-the-next-insanely-great-thing-the-web
10: Steve Jobs – De Programmatica Ipsum
https://deprogrammaticaipsum.com/steve-jobs/
Development
Improvements:
- [ ] Better CLI interface / use a CLI library
- [ ] Capture metadata from requests (potentially map latest metadata to
Kagi::Request.meta
) - [ ] Render and/or strip HTML from
Kagi::FastGPT.query
output - [ ] Validate engines / summary type / target language before executing the request
Contributing
- Fork it (https://github.com/nobodywasishere/kagi.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Margret Riegert - creator and maintainer