khoj-ai / khoj

Your AI second brain. Get answers to your questions, whether they be online or in your own notes. Use online AI models (e.g gpt4) or private, local LLMs (e.g llama3). Self-host locally or use our cloud instance. Access from Obsidian, Emacs, Desktop app, Web or Whatsapp.
https://khoj.dev
GNU Affero General Public License v3.0
12.63k stars 640 forks source link

Add support for Anthropic models #760

Closed sabaimran closed 3 months ago

sabaimran commented 3 months ago

Incoming

Long-time coming, add first-party support for using Anthropic models inside the Khoj codebase. I went with a first-party approach (instead of leveraging an OpenAI-API compatible server, for instance) because the Anthropic models have slight nuances in the way messages are handled. For example, the first message to the model always has to be a user message. It is also less good at honoring the prompt output format when it's intended to be JSON.

Closes #760