create a function, call the function whenever you need such query. you will probably be getting your data from some endpoint anyway. but even if you are loading it from say a JSON file, you can still invoke a function to make your analysis and just use the AI to hand the result to you in a conversational way.