|
| 1 | +--- |
| 2 | +sidebar_position: 1.9 |
| 3 | +sidebar_label: Architecture |
| 4 | +description: |
| 5 | + "Learn about the high-level architecture of PromptQL and the importance of the semantic metadata layer in giving you |
| 6 | + reliable and accurate answers to your questions." |
| 7 | +keywords: |
| 8 | + - promptql |
| 9 | + - architecture |
| 10 | +--- |
| 11 | + |
| 12 | +# Architecture |
| 13 | + |
| 14 | +## Introduction |
| 15 | + |
| 16 | +Below, you'll find a functional overview of PromptQL's architecture and the key components that power it. At the heart |
| 17 | +of PromptQL is the **semantic metadata layer** — the intelligent foundation that makes natural language data queries |
| 18 | +possible. |
| 19 | + |
| 20 | +## High-level overview |
| 21 | + |
| 22 | +```mermaid |
| 23 | +
|
| 24 | +flowchart TD |
| 25 | + Client[Client] --> PlaygroundServer[Playground Server] |
| 26 | + Metadata[Semantic Metadata] --> PlaygroundServer |
| 27 | + PlaygroundServer --> LLM[LLM-of-choice] |
| 28 | + LLM --> QueryPlan[Query Plan] |
| 29 | + QueryPlan --> PlaygroundServer |
| 30 | + PlaygroundServer --> Runtime[Python Runtime] |
| 31 | + Runtime --> Engine[Distributed Query Engine] |
| 32 | + Engine --> Connectors[Data Connectors] |
| 33 | + Connectors --> DataSources[Data Sources] |
| 34 | +``` |
| 35 | + |
| 36 | +## How it works |
| 37 | + |
| 38 | +### Request initiation |
| 39 | + |
| 40 | +When you ask PromptQL a question, the **Playground Server** receives your natural language query and combines it with |
| 41 | +your **semantic metadata** — the intelligent layer that describes your connected data sources, schemas, relationships, |
| 42 | +business logic, and access controls. |
| 43 | + |
| 44 | +This metadata layer is generated automatically when you connect a data source and evolves as you and your team use |
| 45 | +PromptQL. |
| 46 | + |
| 47 | +### Query plan generation |
| 48 | + |
| 49 | +The Playground Server sends both your question and the semantic metadata to your chosen LLM. **This semantic context is |
| 50 | +what transforms a general-purpose LLM into a data expert for your specific organization.** The metadata tells the LLM |
| 51 | +exactly what data exists, how it's structured, what different fields mean in your business context, and how tables |
| 52 | +relate to each other. |
| 53 | + |
| 54 | +With this rich context, the LLM generates a precise query plan that maps your natural language request to the right data |
| 55 | +operations. |
| 56 | + |
| 57 | +### Query execution |
| 58 | + |
| 59 | +The Playground Server passes the query plan to PromptQL's **Python runtime**, which executes it through the |
| 60 | +**distributed query engine**. The engine uses **data connectors** to fetch data from your **data sources**, respecting |
| 61 | +all access controls and mappings defined in your metadata. |
| 62 | + |
| 63 | +### Response delivery |
| 64 | + |
| 65 | +The retrieved data flows back through the same path: from data sources through connectors, engine, and runtime, where |
| 66 | +it's packaged and returned to you via the Playground Server. |
| 67 | + |
| 68 | +This architecture ensures that your LLM has complete context about your data landscape while maintaining security and |
| 69 | +performance through the distributed execution layer. |
| 70 | + |
| 71 | +## Next steps |
| 72 | + |
| 73 | +With a broad perspective of the different services powering a PromptQL application, we recommend learning more about the |
| 74 | +[semantic metadata layer](/data-modeling/overview.mdx) next. |
0 commit comments