qtype 0.1.11__py3-none-any.whl → 0.1.13__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 (263) hide show
  1. qtype/` +0 -0
  2. qtype/application/__init__.py +0 -2
  3. qtype/application/converters/tools_from_api.py +67 -57
  4. qtype/application/converters/tools_from_module.py +66 -32
  5. qtype/base/types.py +6 -1
  6. qtype/commands/convert.py +3 -6
  7. qtype/commands/generate.py +97 -10
  8. qtype/commands/mcp.py +68 -0
  9. qtype/commands/run.py +116 -44
  10. qtype/commands/validate.py +4 -4
  11. qtype/docs/.pages +8 -0
  12. qtype/docs/Concepts/mental-model-and-philosophy.md +363 -0
  13. qtype/docs/Contributing/.pages +4 -0
  14. qtype/docs/Contributing/index.md +283 -0
  15. qtype/docs/Contributing/roadmap.md +81 -0
  16. qtype/docs/Decisions/ADR-001-Chat-vs-Completion-Endpoint-Features.md +56 -0
  17. qtype/docs/Gallery/dataflow_pipelines.md +81 -0
  18. qtype/docs/Gallery/dataflow_pipelines.mermaid +45 -0
  19. qtype/docs/Gallery/research_assistant.md +97 -0
  20. qtype/docs/Gallery/research_assistant.mermaid +42 -0
  21. qtype/docs/Gallery/simple_chatbot.md +38 -0
  22. qtype/docs/Gallery/simple_chatbot.mermaid +35 -0
  23. qtype/docs/How To/Authentication/configure_aws_authentication.md +60 -0
  24. qtype/docs/How To/Authentication/use_api_key_authentication.md +40 -0
  25. qtype/docs/How To/Command Line Usage/load_multiple_inputs_from_files.md +77 -0
  26. qtype/docs/How To/Command Line Usage/pass_inputs_on_the_cli.md +52 -0
  27. qtype/docs/How To/Command Line Usage/serve_with_auto_reload.md +27 -0
  28. qtype/docs/How To/Data Processing/adjust_concurrency.md +40 -0
  29. qtype/docs/How To/Data Processing/cache_step_results.md +71 -0
  30. qtype/docs/How To/Data Processing/decode_json_xml.md +24 -0
  31. qtype/docs/How To/Data Processing/explode_collections.md +40 -0
  32. qtype/docs/How To/Data Processing/gather_results.md +68 -0
  33. qtype/docs/How To/Data Processing/invoke_other_flows.md +71 -0
  34. qtype/docs/How To/Data Processing/load_data_from_athena.md +49 -0
  35. qtype/docs/How To/Data Processing/read_data_from_files.md +61 -0
  36. qtype/docs/How To/Data Processing/read_sql_databases.md +46 -0
  37. qtype/docs/How To/Data Processing/write_data_to_file.md +39 -0
  38. qtype/docs/How To/Invoke Models/call_large_language_models.md +51 -0
  39. qtype/docs/How To/Invoke Models/create_embeddings.md +49 -0
  40. qtype/docs/How To/Invoke Models/reuse_prompts_with_templates.md +38 -0
  41. qtype/docs/How To/Language Features/include_qtype_yaml.md +45 -0
  42. qtype/docs/How To/Language Features/include_raw_text_from_other_files.md +48 -0
  43. qtype/docs/How To/Language Features/reference_entities_by_id.md +51 -0
  44. qtype/docs/How To/Language Features/use_agent_skills.md +29 -0
  45. qtype/docs/How To/Language Features/use_environment_variables.md +48 -0
  46. qtype/docs/How To/Language Features/use_optional_variables.md +42 -0
  47. qtype/docs/How To/Language Features/use_qtype_mcp.md +59 -0
  48. qtype/docs/How To/Observability & Debugging/trace_calls_with_open_telemetry.md +49 -0
  49. qtype/docs/How To/Observability & Debugging/validate_qtype_yaml.md +36 -0
  50. qtype/docs/How To/Observability & Debugging/visualize_application_architecture.md +61 -0
  51. qtype/docs/How To/Observability & Debugging/visualize_example.mermaid +35 -0
  52. qtype/docs/How To/Qtype Server/flow_as_ui.png +0 -0
  53. qtype/docs/How To/Qtype Server/serve_flows_as_apis.md +40 -0
  54. qtype/docs/How To/Qtype Server/serve_flows_as_ui.md +41 -0
  55. qtype/docs/How To/Qtype Server/use_conversational_interfaces.md +56 -0
  56. qtype/docs/How To/Qtype Server/use_variables_with_ui_hints.md +48 -0
  57. qtype/docs/How To/Tools & Integration/bind_tool_inputs_and_outputs.md +47 -0
  58. qtype/docs/How To/Tools & Integration/create_tools_from_openapi_specifications.md +85 -0
  59. qtype/docs/How To/Tools & Integration/create_tools_from_python_modules.md +87 -0
  60. qtype/docs/Reference/cli.md +336 -0
  61. qtype/docs/Reference/plugins.md +99 -0
  62. qtype/docs/Reference/semantic-validation-rules.md +184 -0
  63. qtype/docs/Tutorials/.pages +1 -0
  64. qtype/docs/Tutorials/01-first-qtype-application.md +249 -0
  65. qtype/docs/Tutorials/02-conversational-chatbot.md +327 -0
  66. qtype/docs/Tutorials/03-structured-data.md +480 -0
  67. qtype/docs/Tutorials/04-tools-and-function-calling.md +476 -0
  68. qtype/docs/Tutorials/example_chat.png +0 -0
  69. qtype/docs/Tutorials/index.md +92 -0
  70. qtype/docs/components/APIKeyAuthProvider.md +7 -0
  71. qtype/docs/components/APITool.md +10 -0
  72. qtype/docs/components/AWSAuthProvider.md +13 -0
  73. qtype/docs/components/AWSSecretManager.md +5 -0
  74. qtype/docs/components/Agent.md +6 -0
  75. qtype/docs/components/Aggregate.md +7 -0
  76. qtype/docs/components/AggregateStats.md +7 -0
  77. qtype/docs/components/Application.md +22 -0
  78. qtype/docs/components/AuthorizationProvider.md +6 -0
  79. qtype/docs/components/AuthorizationProviderList.md +5 -0
  80. qtype/docs/components/BearerTokenAuthProvider.md +6 -0
  81. qtype/docs/components/BedrockReranker.md +8 -0
  82. qtype/docs/components/ChatContent.md +7 -0
  83. qtype/docs/components/ChatMessage.md +6 -0
  84. qtype/docs/components/Collect.md +6 -0
  85. qtype/docs/components/ConstantPath.md +5 -0
  86. qtype/docs/components/Construct.md +6 -0
  87. qtype/docs/components/CustomType.md +7 -0
  88. qtype/docs/components/Decoder.md +8 -0
  89. qtype/docs/components/DecoderFormat.md +8 -0
  90. qtype/docs/components/DocToTextConverter.md +7 -0
  91. qtype/docs/components/Document.md +7 -0
  92. qtype/docs/components/DocumentEmbedder.md +6 -0
  93. qtype/docs/components/DocumentIndex.md +7 -0
  94. qtype/docs/components/DocumentSearch.md +7 -0
  95. qtype/docs/components/DocumentSource.md +12 -0
  96. qtype/docs/components/DocumentSplitter.md +9 -0
  97. qtype/docs/components/Echo.md +8 -0
  98. qtype/docs/components/Embedding.md +7 -0
  99. qtype/docs/components/EmbeddingModel.md +6 -0
  100. qtype/docs/components/Explode.md +5 -0
  101. qtype/docs/components/FieldExtractor.md +21 -0
  102. qtype/docs/components/FileSource.md +6 -0
  103. qtype/docs/components/FileWriter.md +7 -0
  104. qtype/docs/components/Flow.md +14 -0
  105. qtype/docs/components/FlowInterface.md +7 -0
  106. qtype/docs/components/Index.md +8 -0
  107. qtype/docs/components/IndexUpsert.md +6 -0
  108. qtype/docs/components/InvokeEmbedding.md +7 -0
  109. qtype/docs/components/InvokeFlow.md +8 -0
  110. qtype/docs/components/InvokeTool.md +8 -0
  111. qtype/docs/components/LLMInference.md +9 -0
  112. qtype/docs/components/ListType.md +5 -0
  113. qtype/docs/components/Memory.md +8 -0
  114. qtype/docs/components/MessageRole.md +14 -0
  115. qtype/docs/components/Model.md +10 -0
  116. qtype/docs/components/ModelList.md +5 -0
  117. qtype/docs/components/OAuth2AuthProvider.md +9 -0
  118. qtype/docs/components/PrimitiveTypeEnum.md +20 -0
  119. qtype/docs/components/PromptTemplate.md +7 -0
  120. qtype/docs/components/PythonFunctionTool.md +7 -0
  121. qtype/docs/components/RAGChunk.md +7 -0
  122. qtype/docs/components/RAGDocument.md +10 -0
  123. qtype/docs/components/RAGSearchResult.md +8 -0
  124. qtype/docs/components/Reranker.md +5 -0
  125. qtype/docs/components/SQLSource.md +8 -0
  126. qtype/docs/components/Search.md +7 -0
  127. qtype/docs/components/SearchResult.md +7 -0
  128. qtype/docs/components/SecretManager.md +7 -0
  129. qtype/docs/components/SecretReference.md +7 -0
  130. qtype/docs/components/Source.md +5 -0
  131. qtype/docs/components/Step.md +8 -0
  132. qtype/docs/components/TelemetrySink.md +9 -0
  133. qtype/docs/components/Tool.md +9 -0
  134. qtype/docs/components/ToolList.md +5 -0
  135. qtype/docs/components/TypeList.md +5 -0
  136. qtype/docs/components/Variable.md +8 -0
  137. qtype/docs/components/VariableList.md +5 -0
  138. qtype/docs/components/VectorIndex.md +7 -0
  139. qtype/docs/components/VectorSearch.md +6 -0
  140. qtype/docs/components/VertexAuthProvider.md +9 -0
  141. qtype/docs/components/Writer.md +5 -0
  142. qtype/docs/example_ui.png +0 -0
  143. qtype/docs/index.md +81 -0
  144. qtype/docs/legacy_how_tos/.pages +6 -0
  145. qtype/docs/legacy_how_tos/Configuration/modular-yaml.md +366 -0
  146. qtype/docs/legacy_how_tos/Configuration/phoenix_projects.png +0 -0
  147. qtype/docs/legacy_how_tos/Configuration/phoenix_traces.png +0 -0
  148. qtype/docs/legacy_how_tos/Configuration/reference-by-id.md +251 -0
  149. qtype/docs/legacy_how_tos/Configuration/telemetry-setup.md +259 -0
  150. qtype/docs/legacy_how_tos/Data Types/custom-types.md +52 -0
  151. qtype/docs/legacy_how_tos/Data Types/domain-types.md +113 -0
  152. qtype/docs/legacy_how_tos/Debugging/visualize-apps.md +147 -0
  153. qtype/docs/legacy_how_tos/Tools/api-tools.md +29 -0
  154. qtype/docs/legacy_how_tos/Tools/python-tools.md +299 -0
  155. qtype/docs/skills/architect/SKILL.md +188 -0
  156. qtype/docs/skills/architect/references/cheatsheet.md +198 -0
  157. qtype/docs/skills/architect/references/patterns.md +29 -0
  158. qtype/docs/stylesheets/extra.css +27 -0
  159. qtype/dsl/custom_types.py +2 -1
  160. qtype/dsl/linker.py +23 -7
  161. qtype/dsl/loader.py +3 -3
  162. qtype/dsl/model.py +181 -67
  163. qtype/examples/authentication/aws_authentication.qtype.yaml +63 -0
  164. qtype/examples/conversational_ai/hello_world_chat.qtype.yaml +43 -0
  165. qtype/examples/conversational_ai/simple_chatbot.qtype.yaml +40 -0
  166. qtype/examples/data_processing/athena_query.qtype.yaml +56 -0
  167. qtype/examples/data_processing/batch_inputs.csv +5 -0
  168. qtype/examples/data_processing/batch_processing.qtype.yaml +54 -0
  169. qtype/examples/data_processing/cache_step_results.qtype.yaml +78 -0
  170. qtype/examples/data_processing/collect_results.qtype.yaml +55 -0
  171. qtype/examples/data_processing/create_sample_db.py +129 -0
  172. qtype/examples/data_processing/dataflow_pipelines.qtype.yaml +108 -0
  173. qtype/examples/data_processing/decode_json.qtype.yaml +23 -0
  174. qtype/examples/data_processing/explode_items.qtype.yaml +25 -0
  175. qtype/examples/data_processing/invoke_other_flows.qtype.yaml +98 -0
  176. qtype/examples/data_processing/read_file.qtype.yaml +60 -0
  177. qtype/examples/data_processing/reviews.db +0 -0
  178. qtype/examples/data_processing/sample_article.txt +1 -0
  179. qtype/examples/data_processing/sample_documents.jsonl +5 -0
  180. qtype/examples/invoke_models/create_embeddings.qtype.yaml +28 -0
  181. qtype/examples/invoke_models/simple_llm_call.qtype.yaml +32 -0
  182. qtype/examples/language_features/include_raw.qtype.yaml +27 -0
  183. qtype/examples/language_features/optional_variables.qtype.yaml +32 -0
  184. qtype/examples/language_features/story_prompt.txt +6 -0
  185. qtype/examples/language_features/ui_hints.qtype.yaml +52 -0
  186. qtype/examples/legacy/bedrock/data_analysis_with_telemetry.qtype.yaml +169 -0
  187. qtype/examples/legacy/bedrock/hello_world.qtype.yaml +39 -0
  188. qtype/examples/legacy/bedrock/hello_world_chat.qtype.yaml +37 -0
  189. qtype/examples/legacy/bedrock/hello_world_chat_with_telemetry.qtype.yaml +40 -0
  190. qtype/examples/legacy/bedrock/hello_world_chat_with_thinking.qtype.yaml +40 -0
  191. qtype/examples/legacy/bedrock/hello_world_completion.qtype.yaml +41 -0
  192. qtype/examples/legacy/bedrock/hello_world_completion_with_auth.qtype.yaml +44 -0
  193. qtype/examples/legacy/bedrock/simple_agent_chat.qtype.yaml +46 -0
  194. qtype/examples/legacy/chat_with_langfuse.qtype.yaml +50 -0
  195. qtype/examples/legacy/data/customers.csv +6 -0
  196. qtype/examples/legacy/data_processor.qtype.yaml +48 -0
  197. qtype/examples/legacy/echo/debug_example.qtype.yaml +59 -0
  198. qtype/examples/legacy/echo/prompt.qtype.yaml +22 -0
  199. qtype/examples/legacy/echo/readme.md +29 -0
  200. qtype/examples/legacy/echo/test.qtype.yaml +26 -0
  201. qtype/examples/legacy/echo/video.qtype.yaml +20 -0
  202. qtype/examples/legacy/field_extractor_example.qtype.yaml +137 -0
  203. qtype/examples/legacy/multi_flow_example.qtype.yaml +125 -0
  204. qtype/examples/legacy/openai/hello_world_chat.qtype.yaml +43 -0
  205. qtype/examples/legacy/openai/hello_world_chat_with_telemetry.qtype.yaml +46 -0
  206. qtype/examples/legacy/qtype_plugin_example.py +51 -0
  207. qtype/examples/legacy/rag.qtype.yaml +207 -0
  208. qtype/examples/legacy/sample_data.txt +43 -0
  209. qtype/examples/legacy/time_utilities.qtype.yaml +64 -0
  210. qtype/examples/legacy/vertex/README.md +11 -0
  211. qtype/examples/legacy/vertex/hello_world_chat.qtype.yaml +36 -0
  212. qtype/examples/legacy/vertex/hello_world_completion.qtype.yaml +40 -0
  213. qtype/examples/legacy/vertex/hello_world_completion_with_auth.qtype.yaml +45 -0
  214. qtype/examples/observability_debugging/trace_with_opentelemetry.qtype.yaml +40 -0
  215. qtype/examples/research_assistant/research_assistant.qtype.yaml +94 -0
  216. qtype/examples/research_assistant/tavily.oas.yaml +722 -0
  217. qtype/examples/research_assistant/tavily.qtype.yaml +216 -0
  218. qtype/examples/tutorials/01_hello_world.qtype.yaml +48 -0
  219. qtype/examples/tutorials/02_conversational_chat.qtype.yaml +37 -0
  220. qtype/examples/tutorials/03_structured_data.qtype.yaml +130 -0
  221. qtype/examples/tutorials/04_tools_and_function_calling.qtype.yaml +89 -0
  222. qtype/interpreter/api.py +4 -1
  223. qtype/interpreter/base/base_step_executor.py +3 -1
  224. qtype/interpreter/base/stream_emitter.py +19 -13
  225. qtype/interpreter/conversions.py +7 -3
  226. qtype/interpreter/converters.py +142 -26
  227. qtype/interpreter/executors/agent_executor.py +2 -3
  228. qtype/interpreter/executors/aggregate_executor.py +3 -4
  229. qtype/interpreter/executors/construct_executor.py +15 -15
  230. qtype/interpreter/executors/doc_to_text_executor.py +1 -3
  231. qtype/interpreter/executors/field_extractor_executor.py +13 -12
  232. qtype/interpreter/executors/file_source_executor.py +21 -34
  233. qtype/interpreter/executors/file_writer_executor.py +4 -4
  234. qtype/interpreter/executors/index_upsert_executor.py +1 -1
  235. qtype/interpreter/executors/invoke_embedding_executor.py +1 -4
  236. qtype/interpreter/executors/invoke_flow_executor.py +2 -2
  237. qtype/interpreter/executors/invoke_tool_executor.py +19 -18
  238. qtype/interpreter/executors/llm_inference_executor.py +16 -18
  239. qtype/interpreter/executors/prompt_template_executor.py +1 -3
  240. qtype/interpreter/executors/sql_source_executor.py +1 -1
  241. qtype/interpreter/resource_cache.py +3 -1
  242. qtype/interpreter/rich_progress.py +6 -3
  243. qtype/interpreter/stream/chat/converter.py +25 -17
  244. qtype/interpreter/stream/chat/ui_request_to_domain_type.py +2 -2
  245. qtype/interpreter/tools/function_tool_helper.py +11 -10
  246. qtype/interpreter/types.py +89 -4
  247. qtype/interpreter/typing.py +35 -38
  248. qtype/mcp/__init__.py +0 -0
  249. qtype/mcp/server.py +722 -0
  250. qtype/schema/qtype.schema.json +4016 -0
  251. qtype/semantic/checker.py +20 -1
  252. qtype/semantic/generate.py +6 -9
  253. qtype/semantic/model.py +26 -33
  254. qtype/semantic/resolver.py +7 -0
  255. qtype/semantic/visualize.py +45 -53
  256. {qtype-0.1.11.dist-info → qtype-0.1.13.dist-info}/METADATA +65 -44
  257. qtype-0.1.13.dist-info/RECORD +352 -0
  258. {qtype-0.1.11.dist-info → qtype-0.1.13.dist-info}/WHEEL +1 -2
  259. qtype/application/facade.py +0 -177
  260. qtype-0.1.11.dist-info/RECORD +0 -142
  261. qtype-0.1.11.dist-info/top_level.txt +0 -1
  262. {qtype-0.1.11.dist-info → qtype-0.1.13.dist-info}/entry_points.txt +0 -0
  263. {qtype-0.1.11.dist-info → qtype-0.1.13.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,56 @@
1
+ # Use Conversational Interfaces
2
+
3
+ The `Conversational` interface tells the QType UI to render a chat instead of just an "execute flow" button.
4
+
5
+ Note that, if you set the interface to Conversational, QType will validate that the input and outputs are of type `ChatMessage`. If you set the interface to Conversational and this is not true, and error will be thrown.
6
+
7
+ ### QType YAML
8
+
9
+ ```yaml
10
+ flows:
11
+ - type: Flow
12
+ id: simple_chat_example
13
+ interface:
14
+ type: Conversational
15
+ variables:
16
+ - id: user_message
17
+ type: ChatMessage
18
+ - id: response_message
19
+ type: ChatMessage
20
+ inputs:
21
+ - user_message
22
+ outputs:
23
+ - response_message
24
+ ```
25
+
26
+ ### Web UI
27
+
28
+ When you serve a conversational flow with `qtype serve`, the UI renders a chat interface:
29
+
30
+ ![Chat interface showing conversation with memory](../../Tutorials/example_chat.png)
31
+
32
+
33
+ ### Explanation
34
+
35
+ - **interface.type: Conversational**: Configures the flow to be served as a chat interface in the web UI rather than a simple form
36
+ - **ChatMessage type**: Domain type that structures messages with content blocks, role metadata, and conversation context
37
+ - **Reset on refresh**: Starting a new browser session creates a new conversation with fresh memory
38
+
39
+ ## Complete Example
40
+
41
+ ```yaml
42
+ --8<-- "../examples/tutorials/02_conversational_chat.qtype.yaml"
43
+ ```
44
+
45
+ **Start the chat interface:**
46
+ ```bash
47
+ qtype serve 02_conversational_chat.qtype.yaml
48
+ ```
49
+
50
+ Visit [http://localhost:8000/ui](http://localhost:8000/ui) to interact with the chatbot.
51
+
52
+ ## See Also
53
+
54
+ - [Serve Flows as UI](serve_flows_as_ui.md)
55
+ - [Tutorial: Conversational Chatbot](../../Tutorials/02-conversational-chatbot.md)
56
+ - [ChatMessage Reference](../../components/ChatMessage.md)
@@ -0,0 +1,48 @@
1
+ # Use Variables with UI Hints
2
+
3
+ Customize how input variables are displayed in the web UI using the `ui` field on variable definitions.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ flows:
9
+ - type: Flow
10
+ id: generate_story
11
+
12
+ variables:
13
+ # Use textarea widget for multi-line text input
14
+ - id: story_prompt
15
+ type: text
16
+ ui:
17
+ widget: textarea
18
+
19
+ # Use file upload widget with mime type filtering
20
+ - id: document
21
+ type: file
22
+ ui:
23
+ accept: "application/pdf"
24
+
25
+ # Variables without ui hints use default widgets
26
+ - id: max_length
27
+ type: int
28
+ ```
29
+
30
+ ### Explanation
31
+
32
+ - **ui.widget**: For `text` variables, controls input style (`text` for single-line, `textarea` for multi-line)
33
+ - **ui.accept**: For `file` variables, specifies accepted mime types (e.g., `"application/pdf"`, `"image/*"`, `"*/*"`)
34
+ - **Default widgets**: Variables without `ui` hints automatically use appropriate widgets based on their type
35
+
36
+ **Note**: UI hints are currently limited to text and file input customization. Other variable types use standard widgets.
37
+
38
+ ## Complete Example
39
+
40
+ ```yaml
41
+ --8<-- "../examples/language_features/ui_hints.qtype.yaml"
42
+ ```
43
+
44
+ ## See Also
45
+
46
+ - [Serve Flows as UI](serve_flows_as_ui.md)
47
+ - [Variable Reference](../../components/Variable.md)
48
+ - [Use Optional Variables](../Language%20Features/use_optional_variables.md)
@@ -0,0 +1,47 @@
1
+ # Bind Tool Inputs and Outputs
2
+
3
+ Map flow variables to tool parameters and capture tool results using `input_bindings` and `output_bindings` in the InvokeTool step.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ steps:
9
+ # Tool with no inputs, only output binding
10
+ - type: InvokeTool
11
+ id: get_current_time
12
+ tool: qtype.application.commons.tools.get_current_timestamp
13
+ input_bindings: {}
14
+ output_bindings:
15
+ result: current_time
16
+ outputs: [current_time]
17
+
18
+ # Tool with multiple input bindings
19
+ - type: InvokeTool
20
+ id: add_days
21
+ tool: qtype.application.commons.tools.timedelta
22
+ input_bindings:
23
+ timestamp: current_time # Tool param ← flow variable
24
+ days: days_until_due # Tool param ← flow variable
25
+ output_bindings:
26
+ result: deadline_time # Tool output → flow variable
27
+ outputs: [deadline_time]
28
+ ```
29
+
30
+ ### Explanation
31
+
32
+ - **input_bindings**: Maps tool parameter names (left) to flow variable names (right)
33
+ - **output_bindings**: Maps tool output names (left) to flow variable names (right)
34
+ - **outputs**: Lists flow variables this step produces (must match output_bindings values)
35
+ - **Chaining**: Output variables from one tool become input variables for the next tool
36
+
37
+ ## Complete Example
38
+
39
+ ```yaml
40
+ --8<-- "../examples/tutorials/04_tools_and_function_calling.qtype.yaml"
41
+ ```
42
+
43
+ ## See Also
44
+
45
+ - [Tutorial: Tools and Function Calling](../../Tutorials/04-tools-and-function-calling.md)
46
+ - [InvokeTool Reference](../../components/InvokeTool.md)
47
+ - [Create Tools from Python Modules](create_tools_from_python_modules.md)
@@ -0,0 +1,85 @@
1
+ # Create Tools from OpenAPI Specifications
2
+
3
+ Generate QType tool definitions automatically from OpenAPI/Swagger specifications using `qtype convert api`, which parses API endpoints, parameters, and schemas to create properly typed API tools.
4
+
5
+ ### Command
6
+
7
+ ```bash
8
+ # Convert from a URL (or use a local file path)
9
+ qtype convert api https://petstore3.swagger.io/api/v3/openapi.json --output petstore_tools.qtype.yaml
10
+ ```
11
+
12
+ This creates the `petstore_tools.qtype.yaml` qtype file you can import into your application.
13
+
14
+ ### QType YAML
15
+
16
+ **Generated tool YAML** (`petstore_tools.qtype.yaml`):
17
+ ```yaml
18
+ id: swagger-petstore---openapi-30
19
+ description: Tools created from API specification petstore_api.json
20
+
21
+ auths:
22
+ - id: swagger-petstore---openapi-30_api_key_api_key
23
+ type: api_key
24
+ api_key: your_api_key_here
25
+
26
+ tools:
27
+ - id: getPetById
28
+ name: Find pet by ID.
29
+ description: Returns a single pet.
30
+ type: APITool
31
+ method: GET
32
+ endpoint: /api/v3/pet/{petId}
33
+ auth: swagger-petstore---openapi-30_api_key_api_key
34
+ inputs:
35
+ - id: petId
36
+ type: int
37
+ outputs:
38
+ - id: id
39
+ type: int?
40
+ - id: name
41
+ type: text
42
+ - id: status
43
+ type: text?
44
+ parameters: []
45
+ ```
46
+
47
+ ### Explanation
48
+
49
+ - **`convert api`**: CLI subcommand that converts OpenAPI specifications to tool definitions
50
+ - **OpenAPI spec**: JSON or YAML file following OpenAPI 3.0+ or Swagger 2.0 format
51
+ - **`--output`**: Target YAML file path; omit to print to stdout
52
+ - **operationId**: Becomes the tool ID (e.g., `getPetById`)
53
+ - **parameters**: Path, query, and header parameters become tool `parameters`
54
+ - **responses**: Response schema properties become tool `outputs`
55
+ - **servers**: Base URL is combined with path to create full endpoint
56
+ - **method**: HTTP method (GET, POST, PUT, DELETE, etc.)
57
+ - **securitySchemes**: Generates auth providers (API key, OAuth2, Bearer token)
58
+
59
+ ### Using Generated Tools
60
+
61
+ ```yaml
62
+ references:
63
+ - !include petstore_tools.qtype.yaml
64
+
65
+ flows:
66
+ - id: fetch_pet
67
+ steps:
68
+ - type: InvokeTool
69
+ id: get_pet
70
+ tool: getPetById
71
+ input_bindings:
72
+ petId: pet_id
73
+ output_bindings:
74
+ name: pet_name
75
+ status: pet_status
76
+ ```
77
+
78
+ See [Tutorial: Adding Tools to Your Application](../../Tutorials/04-tools-and-function-calling.md) for a detailed usage.
79
+
80
+
81
+ ## See Also
82
+
83
+ - [Tutorial: Tools and Function Calling](../../Tutorials/04-tools-and-function-calling.md)
84
+ - [Create Tools from Python Modules](create_tools_from_python_modules.md)
85
+ - [APITool Reference](../../components/APITool.md)
@@ -0,0 +1,87 @@
1
+ # Create Tools from Python Modules
2
+
3
+ Generate QType tool definitions automatically from Python functions using `qtype convert module`, which analyzes type hints and docstrings to create properly typed tools.
4
+
5
+ ### Command
6
+
7
+ ```bash
8
+ qtype convert module myapp.utils --output tools.qtype.yaml
9
+ ```
10
+
11
+ ### QType YAML
12
+
13
+ **Input Python module** (`myapp/utils.py`):
14
+ ```python
15
+ from datetime import datetime
16
+
17
+ def calculate_age(birth_date: datetime, reference_date: datetime) -> int:
18
+ """Calculate age in years between two dates.
19
+
20
+ Args:
21
+ birth_date: The birth date
22
+ reference_date: The date to calculate age at
23
+
24
+ Returns:
25
+ Age in complete years
26
+ """
27
+ age = reference_date.year - birth_date.year
28
+ if (reference_date.month, reference_date.day) < (birth_date.month, birth_date.day):
29
+ age -= 1
30
+ return age
31
+ ```
32
+
33
+ **Generated tool YAML** (`tools.qtype.yaml`):
34
+ ```yaml
35
+ id: myapp.utils
36
+ description: Tools created from Python module myapp.utils
37
+ tools:
38
+ - id: myapp.utils.calculate_age
39
+ description: Calculate age in years between two dates.
40
+ type: PythonFunctionTool
41
+ function_name: calculate_age
42
+ module_path: myapp.utils
43
+ name: calculate_age
44
+ inputs:
45
+ - id: birth_date
46
+ type: datetime
47
+ - id: reference_date
48
+ type: datetime
49
+ outputs:
50
+ - id: calculate_age_result
51
+ type: int
52
+ ```
53
+
54
+ ### Explanation
55
+
56
+ - **`convert module`**: CLI subcommand that converts Python modules to tool definitions
57
+ - **module path**: Dot-separated Python module (e.g., `myapp.utils`, `package.submodule`) - must be importable
58
+ - **`--output`**: Target YAML file path; omit to print to stdout
59
+ - **Type hints**: Required on all parameters and return values; converted to QType types (int, text, datetime, etc.)
60
+ - **Optional parameters**: Detected from default values (e.g., `name: str = "default"` becomes `optional: true`)
61
+ - **Docstrings**: First line becomes tool description; supports Google, NumPy, and reStructuredText formats
62
+ - **Public functions only**: Functions starting with `_` are skipped
63
+
64
+ ### Using Generated Tools
65
+
66
+ ```yaml
67
+ references:
68
+ - !include tools.qtype.yaml
69
+
70
+ flows:
71
+ - id: check_age
72
+ steps:
73
+ - type: InvokeTool
74
+ id: calc
75
+ tool: myapp.utils.calculate_age
76
+ input_bindings:
77
+ birth_date: dob
78
+ reference_date: today
79
+ output_bindings:
80
+ result: age
81
+ ```
82
+
83
+ ## See Also
84
+
85
+ - [Tutorial: Tools and Function Calling](../../Tutorials/04-tools-and-function-calling.md)
86
+ - [Create Tools from OpenAPI Specifications](create_tools_from_openapi_specifications.md)
87
+ - [PythonFunctionTool Reference](../../components/PythonFunctionTool.md)
@@ -0,0 +1,336 @@
1
+ # Command Line Interface
2
+
3
+ The QType CLI lets you run applications, validate specifications, serve web interfaces, and generating resources.
4
+
5
+ ## Installation
6
+
7
+ The QType CLI is installed with the qtype package. Run commands with:
8
+
9
+ ```bash
10
+ qtype [command] [options]
11
+ ```
12
+
13
+ ## Global Options
14
+
15
+ ```
16
+ --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
17
+ Set the logging level (default: INFO)
18
+ ```
19
+
20
+ ## Commands
21
+
22
+ ### run
23
+
24
+ Execute a QType application locally.
25
+
26
+ ```bash
27
+ qtype run [options] spec
28
+ ```
29
+
30
+ #### Arguments
31
+
32
+ - **`spec`** - Path to the QType YAML spec file
33
+
34
+ #### Options
35
+
36
+ - **`-f FLOW, --flow FLOW`** - The name of the flow to run. If not specified, runs the first flow found
37
+ - **`-i INPUT, --input INPUT`** - JSON blob of input values for the flow (default: `{}`)
38
+ - **`-I INPUT_FILE, --input-file INPUT_FILE`** - Path to a file (e.g., CSV, JSON, Parquet) with input data for batch processing
39
+ - **`-o OUTPUT, --output OUTPUT`** - Path to save output data. If input is a DataFrame, output will be saved as parquet. If single result, saved as JSON
40
+ - **`--progress`** - Show progress bars during flow execution
41
+
42
+ #### Examples
43
+
44
+ Run a simple application:
45
+ ```bash
46
+ qtype run app.qtype.yaml
47
+ ```
48
+
49
+ Run with inline JSON inputs:
50
+ ```bash
51
+ qtype run app.qtype.yaml -i '{"question": "What is AI?"}'
52
+ ```
53
+
54
+ Run a specific flow:
55
+ ```bash
56
+ qtype run app.qtype.yaml --flow process_data
57
+ ```
58
+
59
+ Batch process data from a file:
60
+ ```bash
61
+ qtype run app.qtype.yaml --input-file inputs.csv --output results.parquet
62
+ ```
63
+
64
+ #### See Also
65
+
66
+ - [Pass Inputs On The CLI](../How%20To/Command%20Line%20Usage/pass_inputs_on_the_cli.md)
67
+ - [Load Multiple Inputs from Files](../How%20To/Command%20Line%20Usage/load_multiple_inputs_from_files.md)
68
+ - [Tutorial: Your First QType Application](../Tutorials/01-first-qtype-application.md)
69
+
70
+ ---
71
+
72
+ ### validate
73
+
74
+ Validate a QType YAML spec against the schema and semantic rules.
75
+
76
+ ```bash
77
+ qtype validate [options] spec
78
+ ```
79
+
80
+ #### Arguments
81
+
82
+ - **`spec`** - Path to the QType YAML spec file
83
+
84
+ #### Options
85
+
86
+ - **`-p, --print`** - Print the spec after validation (default: False)
87
+
88
+ #### Examples
89
+
90
+ Validate a specification:
91
+ ```bash
92
+ qtype validate app.qtype.yaml
93
+ ```
94
+
95
+ Validate and print the parsed spec:
96
+ ```bash
97
+ qtype validate app.qtype.yaml --print
98
+ ```
99
+
100
+ #### See Also
101
+
102
+ - [Validate QType YAML](../How%20To/Observability%20%26%20Debugging/validate_qtype_yaml.md)
103
+ - [Semantic Validation Rules](semantic-validation-rules.md)
104
+
105
+ ---
106
+
107
+ ### serve
108
+
109
+ Serve a web experience for a QType application with an interactive UI.
110
+
111
+ ```bash
112
+ qtype serve [options] spec
113
+ ```
114
+
115
+ #### Arguments
116
+
117
+ - **`spec`** - Path to the QType YAML spec file
118
+
119
+ #### Options
120
+
121
+ - **`-p PORT, --port PORT`** - Port to run the server on (default: 8080)
122
+ - **`-H HOST, --host HOST`** - Host to bind the server to (default: 0.0.0.0)
123
+ - **`--reload`** - Enable auto-reload on code changes (default: False)
124
+
125
+ #### Examples
126
+
127
+ Serve an application:
128
+ ```bash
129
+ qtype serve app.qtype.yaml
130
+ ```
131
+
132
+ Serve on a specific port:
133
+ ```bash
134
+ qtype serve app.qtype.yaml --port 3000
135
+ ```
136
+
137
+ Serve with auto-reload for development:
138
+ ```bash
139
+ qtype serve app.qtype.yaml --reload
140
+ ```
141
+
142
+ #### See Also
143
+
144
+ - [Serve Flows as APIs](../How%20To/Qtype%20Server/serve_flows_as_apis.md)
145
+ - [Serve Flows as UI](../How%20To/Qtype%20Server/serve_flows_as_ui.md)
146
+ - [Tutorial: Conversational Chatbot](../Tutorials/02-conversational-chatbot.md)
147
+
148
+ ---
149
+
150
+ ### mcp
151
+
152
+ Start the QType Model Context Protocol (MCP) server for AI agent integration.
153
+
154
+ ```bash
155
+ qtype mcp [options]
156
+ ```
157
+
158
+ #### Options
159
+
160
+ - **`-t TRANSPORT, --transport TRANSPORT`** - Transport protocol to use: `stdio`, `sse`, or `streamable-http` (default: stdio)
161
+ - **`--host HOST`** - Host to bind to for HTTP/SSE transports (default: 0.0.0.0)
162
+ - **`-p PORT, --port PORT`** - Port to bind to for HTTP/SSE transports (default: 8000)
163
+
164
+ #### Examples
165
+
166
+ Start MCP server with stdio transport (default, for local AI agents):
167
+ ```bash
168
+ qtype mcp
169
+ ```
170
+
171
+ Start with Server-Sent Events transport:
172
+ ```bash
173
+ qtype mcp --transport sse --port 8000
174
+ ```
175
+
176
+ Start with streamable HTTP transport on a specific host and port:
177
+ ```bash
178
+ qtype mcp --transport streamable-http --host 127.0.0.1 --port 3000
179
+ ```
180
+
181
+ #### Description
182
+
183
+ The MCP server exposes QType functionality to AI agents and assistants through the Model Context Protocol. It provides tools for:
184
+
185
+ - Converting API specifications to QType tools
186
+ - Converting Python modules to QType tools
187
+ - Validating QType YAML specifications
188
+ - Visualizing QType architectures
189
+ - Accessing QType documentation and component schemas
190
+
191
+ The stdio transport is ideal for local AI agent integration, while SSE and streamable-http transports are suitable for network-based integrations.
192
+
193
+ ---
194
+
195
+ ### visualize
196
+
197
+ Generate a visual diagram of your QType application architecture.
198
+
199
+ ```bash
200
+ qtype visualize [options] spec
201
+ ```
202
+
203
+ #### Arguments
204
+
205
+ - **`spec`** - Path to the QType YAML file
206
+
207
+ #### Options
208
+
209
+ - **`-o OUTPUT, --output OUTPUT`** - If provided, write the mermaid diagram to this file
210
+ - **`-nd, --no-display`** - If set, don't display the diagram in a browser (default: False)
211
+
212
+ #### Examples
213
+
214
+ Visualize and open in browser:
215
+ ```bash
216
+ qtype visualize app.qtype.yaml
217
+ ```
218
+
219
+ Save to file without displaying:
220
+ ```bash
221
+ qtype visualize app.qtype.yaml --output diagram.mmd --no-display
222
+ ```
223
+
224
+ Generate and save diagram:
225
+ ```bash
226
+ qtype visualize app.qtype.yaml --output architecture.mmd
227
+ ```
228
+
229
+ #### See Also
230
+
231
+ - [Visualize Application Architecture](../How%20To/Observability%20%26%20Debugging/visualize_application_architecture.md)
232
+
233
+ ---
234
+
235
+ ### convert
236
+
237
+ Create QType tool definitions from external sources.
238
+
239
+ ```bash
240
+ qtype convert {module,api} [options]
241
+ ```
242
+
243
+ #### Subcommands
244
+
245
+ ##### convert module
246
+
247
+ Convert a Python module to QType tools format.
248
+
249
+ ```bash
250
+ qtype convert module [options] module_path
251
+ ```
252
+
253
+ **Arguments:**
254
+
255
+ - **`module_path`** - Path to the Python module to convert
256
+
257
+ **Options:**
258
+
259
+ - **`-o OUTPUT, --output OUTPUT`** - Output file path. If not specified, prints to stdout
260
+
261
+ **Examples:**
262
+
263
+ Convert a Python module:
264
+ ```bash
265
+ qtype convert module myapp.utils --output tools.qtype.yaml
266
+ ```
267
+
268
+ Print to stdout:
269
+ ```bash
270
+ qtype convert module myapp.utils
271
+ ```
272
+
273
+ **See Also:**
274
+
275
+ - [Create Tools from Python Modules](../How%20To/Tools%20%26%20Integration/create_tools_from_python_modules.md)
276
+ - [Tutorial: Tools and Function Calling](../Tutorials/04-tools-and-function-calling.md)
277
+
278
+ ##### convert api
279
+
280
+ Convert an OpenAPI/Swagger specification to QType format.
281
+
282
+ ```bash
283
+ qtype convert api [options] api_spec
284
+ ```
285
+
286
+ **Arguments:**
287
+
288
+ - **`api_spec`** - Path to the API specification file (supports local files or URLs)
289
+
290
+ **Options:**
291
+
292
+ - **`-o OUTPUT, --output OUTPUT`** - Output file path. If not specified, prints to stdout
293
+
294
+ **Examples:**
295
+
296
+ Convert an OpenAPI spec:
297
+ ```bash
298
+ qtype convert api spec.oas.yaml --output api_tools.qtype.yaml
299
+ ```
300
+
301
+ Convert from a URL:
302
+ ```bash
303
+ qtype convert api https://petstore3.swagger.io/api/v3/openapi.json --output petstore.qtype.yaml
304
+ ```
305
+
306
+ **See Also:**
307
+
308
+ - [Create Tools from OpenAPI Specifications](../How%20To/Tools%20%26%20Integration/create_tools_from_openapi_specifications.md)
309
+ - [Tutorial: Tools and Function Calling](../Tutorials/04-tools-and-function-calling.md)
310
+
311
+ ---
312
+
313
+ ### generate
314
+
315
+ Generate QType project resources (primarily for internal development).
316
+
317
+ ```bash
318
+ qtype generate {commons,schema,dsl-docs,semantic-model} [options]
319
+ ```
320
+
321
+ This command is primarily used for QType development and maintenance.
322
+
323
+ #### Subcommands
324
+
325
+ - **`commons`** - Generates the commons library tools from `tools.py`
326
+ - **`schema`** - Generates the JSON schema for the QType DSL from `model.py`
327
+ - **`dsl-docs`** - Generates markdown documentation for the QType DSL classes from `model.py`
328
+ - **`semantic-model`** - Generates the semantic model from QType DSL (See [Contributing](../Contributing/index.md))
329
+
330
+ ---
331
+
332
+ ## Exit Codes
333
+
334
+ - **0** - Success
335
+ - **1** - Error (validation failure, runtime error, etc.)
336
+