QuestionQ50

VerifiedDesign and develop database solutions

You have an Azure SQL database named DB1 containing the knowledge_base and query_cache tables. knowledge_base stores support articles and embeddings, while query_cache stores chat questions, responses, and embeddings. DB1 supports an AI-enabled chat agent.

Design a solution that calls the external large language model (LLM) by using the sp_invoke_external_rest_endpoint stored procedure.

Each command can be used once, more than once, or not at all.

Drag & Drop
Serialize the retrieved rows from knowledge_base:
Extract the answer field from the response:
Extract the embeddings to store in query_cache:
Explanation

FOR JSON PATH serializes relational result rows as JSON. JSON_VALUE extracts a scalar JSON property, which is appropriate for the answer text. JSON_QUERY extracts a JSON object or array, which preserves the embeddings array for storage. OPENJSON is for parsing JSON into relational rows and columns rather than retaining the embedding array.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!