-
Notifications
You must be signed in to change notification settings - Fork 69
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
Support for Anthropic Citations #52
Comments
After reading the source files, I realize that we are storing the response text "concatenated" (Message's That's just a first thought. |
As for the API, we could probably add an option to the
|
This would be a fantastic addition to RubyLLM. Feel free to open a PR! I like |
Thank you for your reply. I'll try to open a PR this week |
Hold up! First, look at But here's the thing: RubyLLM's whole philosophy is having the most elegant API in the business. We should look at how Anthropic, OpenAI and others handle citations, pick the best approach, and then wrap it in a beautiful Ruby API. Users should never have to deal with raw provider responses - that's our job! |
Anthropic has introduced relatively recently the Citations feature, which forces the model to add references/footnotes, also called "Grounding" by other providers.
In addition to helping creating content with sources and footnotes, it also apparently helps the model to not hallucinate.
I'm sorry to be that person posting an issue to ask for a feature support :)
But I feel this would be a great add-on to RubyLLM.
That being said, it might have quite a bit impact on how RubyLLM handles the model response, as with citations enabled, the API returns the text sliced intro fragments (with some of them having citations, and some other without any), all this in a JSON payload.
Here is a response payload example (coming from Anthropic's doc):
Also, I'll be happy to discuss how to modelise these citations in the RubyLLM response object.
Source: https://docs.anthropic.com/en/docs/build-with-claude/citations
I'll try to dive into the source code later today to find out the first steps toward the citations support.
Also, let me know if you feel this is out of scope.
Thanks
The text was updated successfully, but these errors were encountered: