Skip to content
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

Add new attribute 'citations' to ConversationMessage type #193

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

hghandri
Copy link
Contributor

@hghandri hghandri commented Jan 6, 2025

Issue number:

Summary

Update the type "ConversationMessage" to include a "citations" property, allowing the possibility to reference the sources used by the LLM to generate its responses.
This is the first step towards enabling everyone to conveniently use citations for each agent, with built-in source and citation capabilities.

Changes

Please provide a summary of what's being changed

User experience

Please share what the user experience looks like before and after this change

For certain LLMs that use the web or knowledge base systems, it might be beneficial to track the source of the response, such as a link to a website or a document in the knowledge base.

Checklist

If your change doesn't seem to apply, please leave them unchecked.

  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented
Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@hghandri hghandri changed the title Add new attribute 'citations' to ConversationMessage Add new attribute 'citations' to ConversationMessage type Jan 6, 2025
@brnaba-aws
Copy link
Contributor

Hi @hghandri
Thanks for your contribution.
I like the idea of adding citations to the ConversationMessage.
However, I think it might be a good opportunity to make it more flexible. Citations can be text, but they could also include document name, pages etc...
Also, as part of extending ConversationMessage, we could also think about adding usage (tokens) to it.
I'd suggest to make it a metadata type that could include much more than just citations.

@hghandri
Copy link
Contributor Author

hghandri commented Jan 6, 2025

Great idea ! I will work on it.
What kind of metadata do you think we should implement exactly?
An exhaustive list is required to define an appropriate subtype of ConversationMessage.

By the way, I’ve made some changes to integrate the usage of the new version of ConversationMessage.

@brnaba-aws
Copy link
Contributor

This is a good start:
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-runtime/client/converse_stream.html

usage and latency

@hghandri
Copy link
Contributor Author

hghandri commented Jan 6, 2025

@brnaba-aws : I’ve made some changes to the Bedrock LLM agent. What do you think? Is this the right approach expected ?

@hghandri
Copy link
Contributor Author

@brnaba-aws : I've just pushed a last update of source, could you check ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants