Translate Google AI grounding metadata to LangChain Citations.
Example:
metadata = { ... "web_search_queries": ["UEFA Euro 2024 winner"], ... "grounding_chunks": [ ... { ... "web": { ... "uri": "https://uefa.com/euro2024", ... "title": "UEFA Euro 2024 Results", ... } ... } ... ], ... "grounding_supports": [ ... { ... "segment": { ... "start_index": 0, ... "end_index": 47, ... "text": "Spain won the UEFA Euro 2024 championship", ... }, ... "grounding_chunk_indices": [0], ... } ... ], ... } citations = translate_grounding_metadata_to_citations(metadata) len(citations) 1 citations[0]["url"] 'https://uefa.com/euro2024'