qtype 0.1.12__py3-none-any.whl → 0.1.14__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. qtype/` +0 -0
  2. qtype/application/__init__.py +0 -2
  3. qtype/application/converters/tools_from_api.py +28 -22
  4. qtype/application/converters/tools_from_module.py +66 -32
  5. qtype/base/__init__.py +8 -2
  6. qtype/base/logging.py +0 -17
  7. qtype/base/resources.py +193 -0
  8. qtype/cli.py +5 -9
  9. qtype/commands/generate.py +95 -7
  10. qtype/commands/run.py +153 -54
  11. qtype/docs/.pages +8 -0
  12. {docs → qtype/docs}/Concepts/mental-model-and-philosophy.md +1 -1
  13. qtype/docs/Contributing/.pages +4 -0
  14. {docs → qtype/docs}/Contributing/index.md +8 -1
  15. {docs → qtype/docs}/Gallery/dataflow_pipelines.md +18 -4
  16. qtype/docs/Gallery/recipe_chatbot.md +103 -0
  17. qtype/docs/Gallery/recipe_chatbot.mermaid +62 -0
  18. qtype/docs/Gallery/recipe_chatbot.png +0 -0
  19. {docs → qtype/docs}/Gallery/research_assistant.md +4 -5
  20. {docs → qtype/docs}/Gallery/simple_chatbot.md +3 -1
  21. {docs → qtype/docs}/How To/Authentication/configure_aws_authentication.md +2 -2
  22. {docs → qtype/docs}/How To/Authentication/use_api_key_authentication.md +2 -2
  23. {docs → qtype/docs}/How To/Command Line Usage/load_multiple_inputs_from_files.md +24 -9
  24. {docs → qtype/docs}/How To/Command Line Usage/pass_inputs_on_the_cli.md +7 -4
  25. {docs → qtype/docs}/How To/Command Line Usage/serve_with_auto_reload.md +3 -2
  26. {docs → qtype/docs}/How To/Data Processing/adjust_concurrency.md +3 -4
  27. {docs → qtype/docs}/How To/Data Processing/cache_step_results.md +2 -2
  28. {docs → qtype/docs}/How To/Data Processing/decode_json_xml.md +1 -1
  29. {docs → qtype/docs}/How To/Data Processing/explode_collections.md +2 -2
  30. {docs → qtype/docs}/How To/Data Processing/gather_results.md +4 -4
  31. qtype/docs/How To/Data Processing/invoke_other_flows.md +71 -0
  32. qtype/docs/How To/Data Processing/load_data_from_athena.md +49 -0
  33. qtype/docs/How To/Data Processing/load_documents.md +74 -0
  34. qtype/docs/How To/Data Processing/read_data_from_files.md +61 -0
  35. {docs → qtype/docs}/How To/Data Processing/read_sql_databases.md +4 -3
  36. {docs → qtype/docs}/How To/Data Processing/write_data_to_file.md +1 -2
  37. {docs → qtype/docs}/How To/Invoke Models/call_large_language_models.md +1 -1
  38. {docs → qtype/docs}/How To/Invoke Models/create_embeddings.md +1 -1
  39. {docs → qtype/docs}/How To/Invoke Models/reuse_prompts_with_templates.md +2 -3
  40. {docs → qtype/docs}/How To/Language Features/include_raw_text_from_other_files.md +2 -1
  41. {docs → qtype/docs}/How To/Language Features/reference_entities_by_id.md +2 -2
  42. qtype/docs/How To/Language Features/use_agent_skills.md +29 -0
  43. {docs → qtype/docs}/How To/Language Features/use_environment_variables.md +2 -1
  44. qtype/docs/How To/Language Features/use_optional_variables.md +42 -0
  45. {docs → qtype/docs}/How To/Language Features/use_qtype_mcp.md +4 -4
  46. {docs → qtype/docs}/How To/Observability & Debugging/trace_calls_with_open_telemetry.md +1 -1
  47. {docs → qtype/docs}/How To/Observability & Debugging/validate_qtype_yaml.md +3 -2
  48. {docs → qtype/docs}/How To/Observability & Debugging/visualize_application_architecture.md +1 -1
  49. {docs → qtype/docs}/How To/Qtype Server/serve_flows_as_apis.md +3 -3
  50. {docs → qtype/docs}/How To/Qtype Server/serve_flows_as_ui.md +2 -3
  51. {docs → qtype/docs}/How To/Qtype Server/use_conversational_interfaces.md +1 -4
  52. {docs → qtype/docs}/How To/Qtype Server/use_variables_with_ui_hints.md +3 -2
  53. {docs → qtype/docs}/How To/Tools & Integration/bind_tool_inputs_and_outputs.md +1 -2
  54. {docs → qtype/docs}/How To/Tools & Integration/create_tools_from_openapi_specifications.md +10 -14
  55. {docs → qtype/docs}/How To/Tools & Integration/create_tools_from_python_modules.md +5 -8
  56. {docs → qtype/docs}/Reference/cli.md +16 -17
  57. qtype/docs/Tutorials/.pages +1 -0
  58. {docs → qtype/docs}/Tutorials/01-first-qtype-application.md +4 -3
  59. {docs → qtype/docs}/Tutorials/02-conversational-chatbot.md +3 -3
  60. {docs → qtype/docs}/Tutorials/03-structured-data.md +10 -11
  61. {docs → qtype/docs}/Tutorials/04-tools-and-function-calling.md +13 -20
  62. {docs → qtype/docs}/components/APITool.md +1 -1
  63. qtype/docs/components/Aggregate.md +7 -0
  64. qtype/docs/components/Collect.md +6 -0
  65. qtype/docs/components/Construct.md +6 -0
  66. {docs → qtype/docs}/components/DocumentEmbedder.md +0 -1
  67. {docs → qtype/docs}/components/DocumentSplitter.md +0 -1
  68. qtype/docs/components/Explode.md +5 -0
  69. {docs → qtype/docs}/components/FieldExtractor.md +2 -1
  70. qtype/docs/components/InvokeFlow.md +8 -0
  71. qtype/docs/components/InvokeTool.md +8 -0
  72. {docs → qtype/docs}/components/PrimitiveTypeEnum.md +0 -1
  73. {docs → qtype/docs}/components/Source.md +0 -1
  74. {docs → qtype/docs}/components/Step.md +0 -1
  75. {docs → qtype/docs}/components/Tool.md +2 -2
  76. {docs → qtype/docs}/components/Variable.md +2 -0
  77. qtype/docs/legacy_how_tos/.pages +6 -0
  78. qtype/docs/skills/architect/SKILL.md +188 -0
  79. qtype/docs/skills/architect/references/cheatsheet.md +198 -0
  80. qtype/docs/skills/architect/references/patterns.md +29 -0
  81. qtype/docs/stylesheets/extra.css +27 -0
  82. qtype/dsl/linker.py +8 -0
  83. qtype/dsl/model.py +177 -84
  84. qtype/examples/conversational_ai/simple_chatbot_with_auth.qtype.yaml +48 -0
  85. qtype/examples/data_processing/athena_query.qtype.yaml +56 -0
  86. qtype/examples/data_processing/batch_inputs.csv +5 -0
  87. qtype/examples/data_processing/create_sample_db.py +129 -0
  88. qtype/examples/data_processing/invoke_other_flows.qtype.yaml +98 -0
  89. qtype/examples/data_processing/load_documents.qtype.yaml +31 -0
  90. qtype/examples/data_processing/reviews.db +0 -0
  91. qtype/examples/data_processing/sample_article.txt +1 -0
  92. qtype/examples/data_processing/sample_documents.jsonl +5 -0
  93. qtype/examples/invoke_models/invoke_embedding_aws.qtype.yaml +45 -0
  94. qtype/examples/language_features/optional_variables.qtype.yaml +32 -0
  95. qtype/examples/language_features/story_prompt.txt +6 -0
  96. qtype/examples/legacy/data/customers.csv +6 -0
  97. qtype/examples/legacy/echo/readme.md +29 -0
  98. qtype/examples/legacy/qtype_plugin_example.py +51 -0
  99. qtype/examples/legacy/sample_data.txt +43 -0
  100. qtype/examples/legacy/vertex/README.md +11 -0
  101. qtype/examples/rag/recipe_chatbot.qtype.yaml +216 -0
  102. qtype/examples/research_assistant/tavily.qtype.yaml +216 -0
  103. {examples → qtype/examples}/tutorials/03_structured_data.qtype.yaml +2 -2
  104. {examples → qtype/examples}/tutorials/04_tools_and_function_calling.qtype.yaml +5 -5
  105. qtype/interpreter/auth/aws.py +94 -17
  106. qtype/interpreter/auth/generic.py +11 -12
  107. qtype/interpreter/base/secrets.py +4 -2
  108. qtype/interpreter/base/stream_emitter.py +19 -13
  109. qtype/interpreter/conversions.py +15 -14
  110. qtype/interpreter/converters.py +142 -26
  111. qtype/interpreter/executors/agent_executor.py +2 -3
  112. qtype/interpreter/executors/aggregate_executor.py +3 -4
  113. qtype/interpreter/executors/bedrock_reranker_executor.py +17 -28
  114. qtype/interpreter/executors/construct_executor.py +15 -15
  115. qtype/interpreter/executors/doc_to_text_executor.py +1 -3
  116. qtype/interpreter/executors/document_embedder_executor.py +1 -12
  117. qtype/interpreter/executors/field_extractor_executor.py +13 -12
  118. qtype/interpreter/executors/file_source_executor.py +18 -31
  119. qtype/interpreter/executors/invoke_embedding_executor.py +24 -37
  120. qtype/interpreter/executors/invoke_flow_executor.py +2 -2
  121. qtype/interpreter/executors/invoke_tool_executor.py +19 -18
  122. qtype/interpreter/executors/llm_inference_executor.py +18 -18
  123. qtype/interpreter/executors/prompt_template_executor.py +1 -3
  124. qtype/interpreter/executors/sql_source_executor.py +6 -2
  125. qtype/interpreter/flow.py +11 -1
  126. qtype/interpreter/tools/function_tool_helper.py +11 -10
  127. qtype/interpreter/types.py +89 -4
  128. qtype/interpreter/typing.py +31 -32
  129. qtype/mcp/server.py +194 -86
  130. {schema → qtype/schema}/qtype.schema.json +77 -79
  131. qtype/semantic/checker.py +19 -0
  132. qtype/semantic/generate.py +3 -6
  133. qtype/semantic/model.py +26 -33
  134. qtype/semantic/resolver.py +7 -0
  135. qtype/semantic/visualize.py +18 -6
  136. {qtype-0.1.12.dist-info → qtype-0.1.14.dist-info}/METADATA +47 -46
  137. qtype-0.1.14.dist-info/RECORD +361 -0
  138. {qtype-0.1.12.dist-info → qtype-0.1.14.dist-info}/WHEEL +1 -2
  139. docs/How To/Data Processing/read_data_from_files.md +0 -35
  140. docs/components/Aggregate.md +0 -8
  141. docs/components/InvokeFlow.md +0 -8
  142. docs/components/InvokeTool.md +0 -8
  143. docs/components/ToolParameter.md +0 -6
  144. examples/research_assistant/tavily.qtype.yaml +0 -289
  145. qtype/application/facade.py +0 -177
  146. qtype-0.1.12.dist-info/RECORD +0 -325
  147. qtype-0.1.12.dist-info/top_level.txt +0 -1
  148. {docs → qtype/docs}/Contributing/roadmap.md +0 -0
  149. {docs → qtype/docs}/Decisions/ADR-001-Chat-vs-Completion-Endpoint-Features.md +0 -0
  150. {docs → qtype/docs}/Gallery/dataflow_pipelines.mermaid +0 -0
  151. {docs → qtype/docs}/Gallery/research_assistant.mermaid +0 -0
  152. {docs → qtype/docs}/Gallery/simple_chatbot.mermaid +0 -0
  153. {docs → qtype/docs}/How To/Language Features/include_qtype_yaml.md +0 -0
  154. {docs → qtype/docs}/How To/Observability & Debugging/visualize_example.mermaid +0 -0
  155. {docs → qtype/docs}/How To/Qtype Server/flow_as_ui.png +0 -0
  156. {docs → qtype/docs}/Reference/plugins.md +0 -0
  157. {docs → qtype/docs}/Reference/semantic-validation-rules.md +0 -0
  158. {docs → qtype/docs}/Tutorials/example_chat.png +0 -0
  159. {docs → qtype/docs}/Tutorials/index.md +0 -0
  160. {docs → qtype/docs}/components/APIKeyAuthProvider.md +0 -0
  161. {docs → qtype/docs}/components/AWSAuthProvider.md +0 -0
  162. {docs → qtype/docs}/components/AWSSecretManager.md +0 -0
  163. {docs → qtype/docs}/components/Agent.md +0 -0
  164. {docs → qtype/docs}/components/AggregateStats.md +0 -0
  165. {docs → qtype/docs}/components/Application.md +0 -0
  166. {docs → qtype/docs}/components/AuthorizationProvider.md +0 -0
  167. {docs → qtype/docs}/components/AuthorizationProviderList.md +0 -0
  168. {docs → qtype/docs}/components/BearerTokenAuthProvider.md +0 -0
  169. {docs → qtype/docs}/components/BedrockReranker.md +0 -0
  170. {docs → qtype/docs}/components/ChatContent.md +0 -0
  171. {docs → qtype/docs}/components/ChatMessage.md +0 -0
  172. {docs → qtype/docs}/components/ConstantPath.md +0 -0
  173. {docs → qtype/docs}/components/CustomType.md +0 -0
  174. {docs → qtype/docs}/components/Decoder.md +0 -0
  175. {docs → qtype/docs}/components/DecoderFormat.md +0 -0
  176. {docs → qtype/docs}/components/DocToTextConverter.md +0 -0
  177. {docs → qtype/docs}/components/Document.md +0 -0
  178. {docs → qtype/docs}/components/DocumentIndex.md +0 -0
  179. {docs → qtype/docs}/components/DocumentSearch.md +0 -0
  180. {docs → qtype/docs}/components/DocumentSource.md +0 -0
  181. {docs → qtype/docs}/components/Echo.md +0 -0
  182. {docs → qtype/docs}/components/Embedding.md +0 -0
  183. {docs → qtype/docs}/components/EmbeddingModel.md +0 -0
  184. {docs → qtype/docs}/components/FileSource.md +0 -0
  185. {docs → qtype/docs}/components/FileWriter.md +0 -0
  186. {docs → qtype/docs}/components/Flow.md +0 -0
  187. {docs → qtype/docs}/components/FlowInterface.md +0 -0
  188. {docs → qtype/docs}/components/Index.md +0 -0
  189. {docs → qtype/docs}/components/IndexUpsert.md +0 -0
  190. {docs → qtype/docs}/components/InvokeEmbedding.md +0 -0
  191. {docs → qtype/docs}/components/LLMInference.md +0 -0
  192. {docs → qtype/docs}/components/ListType.md +0 -0
  193. {docs → qtype/docs}/components/Memory.md +0 -0
  194. {docs → qtype/docs}/components/MessageRole.md +0 -0
  195. {docs → qtype/docs}/components/Model.md +0 -0
  196. {docs → qtype/docs}/components/ModelList.md +0 -0
  197. {docs → qtype/docs}/components/OAuth2AuthProvider.md +0 -0
  198. {docs → qtype/docs}/components/PromptTemplate.md +0 -0
  199. {docs → qtype/docs}/components/PythonFunctionTool.md +0 -0
  200. {docs → qtype/docs}/components/RAGChunk.md +0 -0
  201. {docs → qtype/docs}/components/RAGDocument.md +0 -0
  202. {docs → qtype/docs}/components/RAGSearchResult.md +0 -0
  203. {docs → qtype/docs}/components/Reranker.md +0 -0
  204. {docs → qtype/docs}/components/SQLSource.md +0 -0
  205. {docs → qtype/docs}/components/Search.md +0 -0
  206. {docs → qtype/docs}/components/SearchResult.md +0 -0
  207. {docs → qtype/docs}/components/SecretManager.md +0 -0
  208. {docs → qtype/docs}/components/SecretReference.md +0 -0
  209. {docs → qtype/docs}/components/TelemetrySink.md +0 -0
  210. {docs → qtype/docs}/components/ToolList.md +0 -0
  211. {docs → qtype/docs}/components/TypeList.md +0 -0
  212. {docs → qtype/docs}/components/VariableList.md +0 -0
  213. {docs → qtype/docs}/components/VectorIndex.md +0 -0
  214. {docs → qtype/docs}/components/VectorSearch.md +0 -0
  215. {docs → qtype/docs}/components/VertexAuthProvider.md +0 -0
  216. {docs → qtype/docs}/components/Writer.md +0 -0
  217. {docs → qtype/docs}/example_ui.png +0 -0
  218. {docs → qtype/docs}/index.md +0 -0
  219. {docs → qtype/docs}/legacy_how_tos/Configuration/modular-yaml.md +0 -0
  220. {docs → qtype/docs}/legacy_how_tos/Configuration/phoenix_projects.png +0 -0
  221. {docs → qtype/docs}/legacy_how_tos/Configuration/phoenix_traces.png +0 -0
  222. {docs → qtype/docs}/legacy_how_tos/Configuration/reference-by-id.md +0 -0
  223. {docs → qtype/docs}/legacy_how_tos/Configuration/telemetry-setup.md +0 -0
  224. {docs → qtype/docs}/legacy_how_tos/Data Types/custom-types.md +0 -0
  225. {docs → qtype/docs}/legacy_how_tos/Data Types/domain-types.md +0 -0
  226. {docs → qtype/docs}/legacy_how_tos/Debugging/visualize-apps.md +0 -0
  227. {docs → qtype/docs}/legacy_how_tos/Tools/api-tools.md +0 -0
  228. {docs → qtype/docs}/legacy_how_tos/Tools/python-tools.md +0 -0
  229. {examples → qtype/examples}/authentication/aws_authentication.qtype.yaml +0 -0
  230. {examples → qtype/examples}/conversational_ai/hello_world_chat.qtype.yaml +0 -0
  231. {examples → qtype/examples}/conversational_ai/simple_chatbot.qtype.yaml +0 -0
  232. {examples → qtype/examples}/data_processing/batch_processing.qtype.yaml +0 -0
  233. {examples → qtype/examples}/data_processing/cache_step_results.qtype.yaml +0 -0
  234. {examples → qtype/examples}/data_processing/collect_results.qtype.yaml +0 -0
  235. {examples → qtype/examples}/data_processing/dataflow_pipelines.qtype.yaml +0 -0
  236. {examples → qtype/examples}/data_processing/decode_json.qtype.yaml +0 -0
  237. {examples → qtype/examples}/data_processing/explode_items.qtype.yaml +0 -0
  238. {examples → qtype/examples}/data_processing/read_file.qtype.yaml +0 -0
  239. {examples → qtype/examples}/invoke_models/create_embeddings.qtype.yaml +0 -0
  240. {examples → qtype/examples}/invoke_models/simple_llm_call.qtype.yaml +0 -0
  241. {examples → qtype/examples}/language_features/include_raw.qtype.yaml +0 -0
  242. {examples → qtype/examples}/language_features/ui_hints.qtype.yaml +0 -0
  243. {examples → qtype/examples}/legacy/bedrock/data_analysis_with_telemetry.qtype.yaml +0 -0
  244. {examples → qtype/examples}/legacy/bedrock/hello_world.qtype.yaml +0 -0
  245. {examples → qtype/examples}/legacy/bedrock/hello_world_chat.qtype.yaml +0 -0
  246. {examples → qtype/examples}/legacy/bedrock/hello_world_chat_with_telemetry.qtype.yaml +0 -0
  247. {examples → qtype/examples}/legacy/bedrock/hello_world_chat_with_thinking.qtype.yaml +0 -0
  248. {examples → qtype/examples}/legacy/bedrock/hello_world_completion.qtype.yaml +0 -0
  249. {examples → qtype/examples}/legacy/bedrock/hello_world_completion_with_auth.qtype.yaml +0 -0
  250. {examples → qtype/examples}/legacy/bedrock/simple_agent_chat.qtype.yaml +0 -0
  251. {examples → qtype/examples}/legacy/chat_with_langfuse.qtype.yaml +0 -0
  252. {examples → qtype/examples}/legacy/data_processor.qtype.yaml +0 -0
  253. {examples → qtype/examples}/legacy/echo/debug_example.qtype.yaml +0 -0
  254. {examples → qtype/examples}/legacy/echo/prompt.qtype.yaml +0 -0
  255. {examples → qtype/examples}/legacy/echo/test.qtype.yaml +0 -0
  256. {examples → qtype/examples}/legacy/echo/video.qtype.yaml +0 -0
  257. {examples → qtype/examples}/legacy/field_extractor_example.qtype.yaml +0 -0
  258. {examples → qtype/examples}/legacy/multi_flow_example.qtype.yaml +0 -0
  259. {examples → qtype/examples}/legacy/openai/hello_world_chat.qtype.yaml +0 -0
  260. {examples → qtype/examples}/legacy/openai/hello_world_chat_with_telemetry.qtype.yaml +0 -0
  261. {examples → qtype/examples}/legacy/rag.qtype.yaml +0 -0
  262. {examples → qtype/examples}/legacy/time_utilities.qtype.yaml +0 -0
  263. {examples → qtype/examples}/legacy/vertex/hello_world_chat.qtype.yaml +0 -0
  264. {examples → qtype/examples}/legacy/vertex/hello_world_completion.qtype.yaml +0 -0
  265. {examples → qtype/examples}/legacy/vertex/hello_world_completion_with_auth.qtype.yaml +0 -0
  266. {examples → qtype/examples}/observability_debugging/trace_with_opentelemetry.qtype.yaml +0 -0
  267. {examples → qtype/examples}/research_assistant/research_assistant.qtype.yaml +0 -0
  268. {examples → qtype/examples}/research_assistant/tavily.oas.yaml +0 -0
  269. {examples → qtype/examples}/tutorials/01_hello_world.qtype.yaml +0 -0
  270. {examples → qtype/examples}/tutorials/02_conversational_chat.qtype.yaml +0 -0
  271. {qtype-0.1.12.dist-info → qtype-0.1.14.dist-info}/entry_points.txt +0 -0
  272. {qtype-0.1.12.dist-info → qtype-0.1.14.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,188 @@
1
+ ---
2
+ name: qtype-architect
3
+ description: Expert assistant for designing and building AI applications using QType's declarative YAML specification language. Helps users architect flows from concept to implementation, validates QType code, generates visualizations, and recommends best practices. Use when users want to build chatbots, RAG systems, agents, data pipelines, or any AI application with QType. Use when the user mentions building AI apps, RAG pipelines, or YAML-based agent orchestration.
4
+ compatibility: Requires the 'qtype-mcp' MCP server to be active for schema lookup and validation.
5
+ metadata:
6
+ author: qtype
7
+ version: "1.0"
8
+ allowed-tools: qtype-mcp:*
9
+ ---
10
+
11
+ # QType Architect
12
+
13
+ Expert assistant for designing and building AI applications using the QType DSL.
14
+
15
+ ## When to use this skill
16
+
17
+ Activate when users want to:
18
+ - Design QType applications (chatbots, RAG, agents, pipelines)
19
+ - Convert requirements into QType YAML specifications
20
+ - Validate or debug QType code
21
+ - Visualize application architecture
22
+ - Learn QType best practices and patterns
23
+
24
+ ## What is QType?
25
+
26
+ **QType is a domain-specific language (DSL) for rapid prototyping of AI applications.**
27
+
28
+ Qtype is a declarative, text-based language that lets you specify *what* your AI application should do, not *how* to do it. You write YAML specifications that describe flows, steps, models, and data transformations, and QType handles the execution.
29
+
30
+ **Elevator pitch:** QType turns AI application prototypes from days of Python coding into hours of YAML configuration, without sacrificing maintainability or requiring you to learn yet another GUI tool.
31
+
32
+ ## Core Mental Model
33
+
34
+ Understanding QType requires understanding core concepts and how they relate:
35
+
36
+ **Think of QType like this:**
37
+
38
+ **Variables** are your data containers (typed boxes)
39
+ **Steps** are your transformations (functions on boxes)
40
+ **Flows** are your pipelines (sequences of transformations)
41
+ **The DSL** is your specification language (what you write)
42
+ **The Semantic layer** is your validator (what checks it)
43
+ **The Interpreter** is your executor (what runs it)
44
+
45
+ ## Core workflow
46
+
47
+ ### 1. Understand requirements
48
+
49
+ Clarify the user's goal through targeted questions:
50
+ - What is the overall goal?
51
+ - What are the inputs and outputs?
52
+ - What processing steps are needed?
53
+ - Which models, APIs, or tools are required?
54
+ - Authentication requirements?
55
+ - Conversational vs batch processing?
56
+
57
+ Prefer inferring reasonable defaults over excessive questions.
58
+
59
+ ### 2. Use MCP tools to research
60
+
61
+ **CRITICAL: Always use the qtype-mcp server to look up information rather than guessing.**
62
+
63
+ - Use `list_components` to discover available component types
64
+ - Use `get_component_schema` to get detailed field requirements for specific components
65
+ - Use `search_library` to find relevant documentation and examples
66
+ - Use `list_examples` and `get_example` to see real QType code patterns
67
+ - Use `list_documentation` and `get_documentation` to get specific guides, tutorials, or references
68
+
69
+ **Don't make assumptions about component fields, syntax, or capabilities - look them up!**
70
+
71
+ ### 3. Design architecture
72
+
73
+ Map requirements to QType components. For guidance:
74
+ - See [references/patterns.md](references/patterns.md) for common architecture patterns
75
+ - See [references/cheatsheet.md](references/cheatsheet.md) for quick component reference
76
+ - See `assets/*.qtype.yaml` for complete working examples
77
+
78
+ Use MCP tools to verify component schemas and field requirements as you design.
79
+
80
+ ### 4. Generate and validate
81
+
82
+ **ALWAYS validate:**
83
+
84
+ 1. Generate complete QType YAML
85
+ 2. Call `validate_qtype_yaml` with your YAML
86
+ 3. If errors: fix specific issues and validate again
87
+ 4. Present validated code to user
88
+ 5. If success and you have mermaid preview capability, call `visualize_qtype_architecture` and use the mermaid preview to visalize the result to the user.
89
+
90
+ **Never skip validation.** Invalid code wastes user time.
91
+
92
+ ### 5. Visualization (Optional)
93
+
94
+ The `visualize` tool in qtype-mcp converts the qtype yaml to an archiecture diagram.
95
+ If you or the user desires it, use the tool and then open it with either the claude-mermaid mcp (if you are claude code) or the mermaid preview (if you are in vscode).
96
+ If neither of those tools are available, just let the user know and save the mermaid to disk.
97
+
98
+ ### 6. Provide context
99
+
100
+ After presenting validated code:
101
+ - Explain key architectural decisions
102
+ - Show how to run: `qtype run`, or `qtype validate`, `qtype serve`
103
+ - Point to relevant documentation
104
+ - Suggest next steps or improvements
105
+
106
+ ### 7. Optional Next Steps
107
+
108
+ If the user desires, or you think they would like it, you can run `qtype serve --reload <yaml_file>` to start the interpreter server. The serve command will print a url, open that in the users web browser so they can see the app.
109
+
110
+ The `--reload` will refresh each time the yaml is changed.
111
+
112
+ ## Using the qtype-mcp server
113
+
114
+ **CRITICAL: Use MCP tools constantly - don't guess or rely on memory!**
115
+
116
+ The qtype-mcp server provides tools for:
117
+ - **Discovery**: Browse components, docs, and examples
118
+ - **Schema lookup**: Get exact field requirements with `get_component_schema`
119
+ - **Search**: Full-text search across all documentation and examples
120
+ - **Validation**: `validate_qtype_yaml` - **Use before every code presentation**
121
+ - **Visualization**: Generate Mermaid diagrams of flows
122
+ - **Code generation**: Convert APIs/Python to QType tools
123
+
124
+ **Key workflow patterns:**
125
+ 1. Unsure about a component? → Use `get_component_schema`
126
+ 2. Need an example? → Use `search_library` or `list_examples`
127
+ 3. Generated YAML? → **Always call `validate_qtype_yaml`**
128
+ 4. Complex flow? → Use `visualize_qtype_architecture`
129
+
130
+ ## Reference materials
131
+
132
+ See bundled reference files for quick lookup:
133
+ - [references/patterns.md](references/patterns.md) - Common architecture patterns
134
+ - [references/cheatsheet.md](references/cheatsheet.md) - Component quick reference
135
+ - `assets/examples/*.qtype.yaml` for complete working examples.
136
+
137
+ ## Key guidelines
138
+
139
+ ### Self-correction on validation failure
140
+ If validation fails:
141
+ - **Do not guess the fix**
142
+ - Read the error message carefully
143
+ - Call `get_component_schema` for the failing component
144
+ - Compare your YAML against the official schema
145
+ - Make precise corrections based on schema requirements
146
+
147
+ ### Use MCP for everything
148
+ - Component details? → `get_component_schema`
149
+ - Need examples? → `list_examples` + `get_example`
150
+ - Unclear syntax? → `search_library` for relevant docs
151
+ - Best practices? → `get_documentation` for concept guides
152
+
153
+ ### Common pitfalls
154
+ ❌ Skipping validation
155
+ ❌ Guessing component fields instead of using `get_component_schema`
156
+ ❌ Undefined variables
157
+ ❌ Missing authentication
158
+ ❌ Hardcoding secrets instead of `${ENV_VAR}`
159
+
160
+ ### Respect Virtual Environments
161
+
162
+ The user is likely running in a virtual environment. The `qtype` executable may not be in your default `path`.
163
+
164
+ You may try:
165
+ ```
166
+ uv run qtype
167
+ ```
168
+ If the user is using `uv`
169
+
170
+ or `source .venv/bin/activate` before calling `qtype`.
171
+
172
+
173
+ ## Response format
174
+
175
+ 0. **High-level plan** - Briefly state which components you've chosen and why they fit the user's requirements based on [references/patterns.md](references/patterns.md) and the components listed in the mcp server.
176
+ 1. **Brief explanation** (what it does, how data flows)
177
+ 2. **Complete validated YAML** (with comments)
178
+ 3. **Visualization** (for complex flows)
179
+ 4. **Next steps** (`qtype validate`, `qtype run`, `qtype serve`)
180
+
181
+ ## When NOT to use QType
182
+
183
+ QType doesn't fit:
184
+ - Complex conditional branching (use Python)
185
+ - Pure data pipelines without AI (use Dagster/Airflow)
186
+ - Simple API calls (use SDKs directly)
187
+
188
+ Be honest if QType isn't the right tool.
@@ -0,0 +1,198 @@
1
+ # Cheatsheet
2
+
3
+ ## Abbreviated Shape Reference
4
+
5
+ ### Application (Root Object)
6
+ ```yaml
7
+ id: <string> # REQUIRED
8
+ flows: [<Flow>] # REQUIRED (at least one)
9
+ models: [<Model>] # OPTIONAL
10
+ tools: [<Tool>] # OPTIONAL
11
+ types: [<CustomType>] # OPTIONAL
12
+ ```
13
+
14
+ ### Flow
15
+ ```yaml
16
+ type: Flow
17
+ id: <string> # REQUIRED
18
+ steps: [<Step>] # REQUIRED (at least one)
19
+ variables: [<Variable>] # OPTIONAL
20
+ inputs: [<string>] # OPTIONAL (Variable IDs)
21
+ outputs: [<string>] # OPTIONAL (Variable IDs)
22
+ interface: # OPTIONAL
23
+ type: <chat|form|agent>
24
+ ```
25
+
26
+ ### Variable
27
+ ```yaml
28
+ type: Variable
29
+ id: <string> # REQUIRED
30
+ value_type: <type> # REQUIRED (see Type Reference)
31
+ ui: # OPTIONAL
32
+ type: <text-input|text-area|...>
33
+ label: <string>
34
+ ```
35
+
36
+ **Type Reference:**
37
+ - Primitives: `string`, `int`, `float`, `bool`
38
+ - Collections: `list`, `dict`
39
+ - Built-ins: `ChatMessage`, `Document`, `Embedding`
40
+ - Custom: Any CustomType `id`
41
+ - List syntax: `value_type: list` + `item_type: <type>`
42
+
43
+ ### Model
44
+ ```yaml
45
+ type: Model
46
+ id: <string> # REQUIRED
47
+ provider: <bedrock|openai|anthropic> # REQUIRED
48
+ model_id: <string> # REQUIRED
49
+ auth: <string> # OPTIONAL (AuthProvider ID)
50
+ ```
51
+
52
+ ### CustomType
53
+ ```yaml
54
+ id: <string> # REQUIRED
55
+ fields: # REQUIRED (at least one)
56
+ - name: <string> # REQUIRED
57
+ field_type: <type> # REQUIRED
58
+ - name: <string>
59
+ field_type: list[<type>]
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Abbreviated Step Reference
65
+
66
+ ### LLMInference
67
+ ```yaml
68
+ type: LLMInference
69
+ id: <string> # REQUIRED
70
+ model: <string> # REQUIRED (Model ID)
71
+ inputs: [<string>] # OPTIONAL (Variable IDs)
72
+ outputs: [<string>] # OPTIONAL (Variable IDs)
73
+ system_message: <string> # OPTIONAL
74
+ memory: <string> # OPTIONAL (Variable ID for chat history)
75
+ ```
76
+
77
+ ### Agent
78
+ ```yaml
79
+ type: Agent
80
+ id: <string> # REQUIRED
81
+ model: <string> # REQUIRED (Model ID)
82
+ tools: [<string>] # REQUIRED (Tool IDs)
83
+ inputs: [<string>] # OPTIONAL
84
+ outputs: [<string>] # OPTIONAL
85
+ system_message: <string> # OPTIONAL
86
+ ```
87
+
88
+ ### PromptTemplate
89
+ ```yaml
90
+ type: PromptTemplate
91
+ id: <string> # REQUIRED
92
+ template: <string> # REQUIRED (use {{var_id}} syntax)
93
+ inputs: [<string>] # REQUIRED (Variable IDs to interpolate)
94
+ outputs: [<string>] # REQUIRED (single Variable ID)
95
+ ```
96
+
97
+ ### InvokeFlow
98
+ ```yaml
99
+ type: InvokeFlow
100
+ id: <string> # REQUIRED
101
+ flow: <string> # REQUIRED (Flow ID)
102
+ input_bindings: # REQUIRED (even if empty: {})
103
+ <flow_input_id>: <local_var_id>
104
+ output_bindings: # REQUIRED (even if empty: {})
105
+ <local_var_id>: <flow_output_id>
106
+ ```
107
+
108
+ ### InvokeTool
109
+ ```yaml
110
+ type: InvokeTool
111
+ id: <string> # REQUIRED
112
+ tool: <string> # REQUIRED (Tool ID)
113
+ input_bindings: # REQUIRED
114
+ <tool_param>: <local_var_id>
115
+ output_bindings: # REQUIRED
116
+ <tool_output>: <local_var_id>
117
+ ```
118
+
119
+ ### Decoder
120
+ ```yaml
121
+ type: Decoder
122
+ id: <string> # REQUIRED
123
+ format: <json|xml> # REQUIRED
124
+ inputs: [<string>] # REQUIRED (single Variable ID with text)
125
+ outputs: [<string>] # REQUIRED (single Variable ID)
126
+ ```
127
+
128
+ ### Construct
129
+ ```yaml
130
+ type: Construct
131
+ id: <string> # REQUIRED
132
+ output_type: <string> # REQUIRED (CustomType ID)
133
+ field_bindings: # REQUIRED
134
+ <field_name>: <var_id>
135
+ outputs: [<string>] # REQUIRED (single Variable ID)
136
+ ```
137
+
138
+ ### VectorSearch
139
+ ```yaml
140
+ type: VectorSearch
141
+ id: <string> # REQUIRED
142
+ index: <string> # REQUIRED (DocumentIndex ID)
143
+ inputs: [<string>] # REQUIRED (query Variable ID)
144
+ outputs: [<string>] # REQUIRED (results Variable ID)
145
+ top_k: <int> # OPTIONAL (default: 5)
146
+ ```
147
+
148
+ ### Explode
149
+ ```yaml
150
+ type: Explode
151
+ id: <string> # REQUIRED
152
+ inputs: [<string>] # REQUIRED (list Variable ID)
153
+ outputs: [<string>] # REQUIRED (single item Variable ID)
154
+ ```
155
+
156
+ ### FileSource
157
+ ```yaml
158
+ type: FileSource
159
+ id: <string> # REQUIRED
160
+ path: <string> # REQUIRED
161
+ outputs: [<string>] # REQUIRED (Variable ID)
162
+ ```
163
+
164
+ ## Critical Rules
165
+
166
+ ### ID Rules
167
+ - All `id` fields must be unique within their scope
168
+ - IDs must be valid identifiers (alphanumeric + underscore/hyphen)
169
+ - Reference other objects by their exact `id` string
170
+
171
+ ### Variable Rules
172
+ - Variables in `inputs`/`outputs` must be defined in `variables` list
173
+ - Variables must have `value_type` specified
174
+ - List variables REQUIRE `item_type` field
175
+ - Variable types must match their usage in steps
176
+
177
+ ### Step Rules
178
+ - Steps execute in order within `steps` array
179
+ - Step `inputs` must reference existing variables (from previous steps or flow inputs)
180
+ - Step `outputs` create or update variables for subsequent steps
181
+ - All referenced Model/Tool/Flow/CustomType IDs must exist
182
+
183
+ ### Binding Rules
184
+ - `input_bindings`: Map local variables TO external inputs
185
+ - Format: `{external_input_name: local_variable_id}`
186
+ - `output_bindings`: Map external outputs TO local variables
187
+ - Format: `{local_variable_id: external_output_name}`
188
+ - Both must be present even if empty: `{}`
189
+
190
+ ### Template Rules
191
+ - Use `{{variable_id}}` syntax only
192
+ - All variables in template must be in `inputs` list
193
+ - Template must be a single string (use `\n` for newlines)
194
+
195
+ ### Type Rules
196
+ - Decoder outputs must match expected structure
197
+ - Construct `field_bindings` must map to all required CustomType fields
198
+ - List operations (Explode/Collect) require matching list types
@@ -0,0 +1,29 @@
1
+ # QType Examples
2
+
3
+ ## Pattern: Simple Chatbot
4
+
5
+ Basic conversational interface with memory.
6
+
7
+ ```yaml
8
+ --8<-- "../examples/conversational_ai/simple_chatbot.qtype.yaml"
9
+ ```
10
+
11
+ ---
12
+
13
+ ## Pattern: Tool-Based Research
14
+
15
+ Web search with synthesis using external tools.
16
+
17
+ ```yaml
18
+ --8<-- "../examples/research_assistant/research_assistant.qtype.yaml"
19
+ ```
20
+
21
+ ---
22
+
23
+ ## Pattern: Data Pipeline with LLM Processing
24
+
25
+ Parallel processing of database records with LLM analysis.
26
+
27
+ ```yaml
28
+ --8<-- "../examples/data_processing/dataflow_pipelines.qtype.yaml"
29
+ ```
@@ -0,0 +1,27 @@
1
+ /* Custom styles for QType documentation */
2
+
3
+ /* Increase max width of main content area */
4
+ .md-grid {
5
+ max-width: 75rem; /* Default is 61rem (976px), this increases to 1280px */
6
+ }
7
+
8
+ /* Adjust content width for better readability */
9
+ .md-content {
10
+ max-width: none;
11
+ }
12
+
13
+ /* Ensure sidebars remain proportional */
14
+ .md-sidebar--primary {
15
+ left: 0;
16
+ }
17
+
18
+ .md-sidebar--secondary {
19
+ right: 0;
20
+ }
21
+
22
+ /* Make section headers darker gray */
23
+ .md-nav__title,
24
+ .md-nav__item--section > .md-nav__link {
25
+ color: #424242 !important;
26
+ font-weight: 600;
27
+ }
qtype/dsl/linker.py CHANGED
@@ -291,6 +291,10 @@ def _resolve_list_references(
291
291
  field_value[i] = _resolve_reference(
292
292
  item.ref, type(item), lookup_map
293
293
  )
294
+ case str():
295
+ # Resolve string IDs to their objects (e.g., variable IDs to Variables)
296
+ if item in lookup_map:
297
+ field_value[i] = lookup_map[item]
294
298
  case BaseModel():
295
299
  _resolve_all_references(item, lookup_map)
296
300
 
@@ -309,6 +313,10 @@ def _resolve_dict_references(
309
313
  match v:
310
314
  case base_types.Reference():
311
315
  field_value[k] = _resolve_reference(v.ref, type(v), lookup_map)
316
+ case str():
317
+ # Resolve string IDs to their objects (e.g., variable IDs to Variables)
318
+ if v in lookup_map:
319
+ field_value[k] = lookup_map[v]
312
320
  case BaseModel():
313
321
  _resolve_all_references(v, lookup_map)
314
322