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

Request: ChatVertexAI preserving grounding_metadata #14548

Closed
jamesbraza opened this issue Dec 11, 2023 · 1 comment · Fixed by #16309
Closed

Request: ChatVertexAI preserving grounding_metadata #14548

jamesbraza opened this issue Dec 11, 2023 · 1 comment · Fixed by #16309
Labels
🤖:improvement Medium size change to existing code to handle new use-cases Ɑ: models Related to LLMs or chat model modules

Comments

@jamesbraza
Copy link
Contributor

Feature request

As of langchain==0.0.348 in ChatVertexAI here:

  1. vertexai.language_models.ChatSession.send_message returns a vertexai.language_models.MultiCandidateTextGenerationResponse response
  2. ChatVertexAI throws out the response's grounding_metadata, only preserving the text

The request is to not discard this useful metadata

Motivation

I am trying to use the response.grounding_metadata.citations in my own code

Your contribution

I will open a PR to make this:

generations = [
    ChatGeneration(
        message=AIMessage(content=r.text),
        generation_info=r.raw_prediction_response,
    )
    for r in response.candidates
]

So the raw response remains accessible

Copy link

dosubot bot commented Dec 11, 2023

🤖

Thank you for your interest in contributing to LangChain! It's great to see your motivation to enhance the functionality of ChatVertexAI by preserving the grounding_metadata. Your proposed solution looks promising, and I encourage you to go ahead and open a PR with your changes. Your contribution will definitely add value to the framework and benefit other users as well. Keep up the good work, and thank you for your contribution to the LangChain community!


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot dosubot bot added Ɑ: models Related to LLMs or chat model modules 🤖:improvement Medium size change to existing code to handle new use-cases labels Dec 11, 2023
efriis pushed a commit that referenced this issue Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:improvement Medium size change to existing code to handle new use-cases Ɑ: models Related to LLMs or chat model modules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant