Skip to content

Get Metadata from NLSQLRetriever.retrieve #16010

Answered by dosubot bot
sambitlnt asked this question in Q&A
Discussion options

You must be logged in to vote

To retrieve just the metadata and store it in a variable when using NLSQLRetriever.retrieve, you can use the retrieve_with_metadata method. Here is an example of how you can do this:

# Assuming you have an instance of NLSQLRetriever named `retriever`
query = "Return the top 5 cities (along with their populations) with the highest population."
retrieved_nodes, metadata = retriever.retrieve_with_metadata(query)

# Store the metadata in a variable
metadata_variable = metadata

The retrieve_with_metadata method returns a tuple where the second element is the metadata. You can store this metadata in a variable as shown above. The metadata will include details such as the SQL query used and oth…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@sambitlnt
Comment options

@dosubot
Comment options

Answer selected by sambitlnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant