Translate LangChain Citations to Google AI grounding metadata format.
translate_citations_to_grounding_metadata(
citations: list[types.Citation],
web_search_queries: list[str] | None = None
) -> dict[str, Any]Example:
citations = [
create_citation(
url="https://uefa.com/euro2024",
title="UEFA Euro 2024 Results",
start_index=0,
end_index=47,
cited_text="Spain won the UEFA Euro 2024 championship",
)
]
metadata = translate_citations_to_grounding_metadata(citations)
len(metadata["groundingChunks"])
# -> 1
metadata["groundingChunks"][0]["web"]["uri"]
# -> 'https://uefa.com/euro2024'