qtype 0.1.10__py3-none-any.whl → 0.1.12__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 (216) hide show
  1. docs/Concepts/mental-model-and-philosophy.md +363 -0
  2. docs/Contributing/index.md +276 -0
  3. docs/Contributing/roadmap.md +81 -0
  4. docs/Decisions/ADR-001-Chat-vs-Completion-Endpoint-Features.md +56 -0
  5. docs/Gallery/dataflow_pipelines.md +80 -0
  6. docs/Gallery/dataflow_pipelines.mermaid +45 -0
  7. docs/Gallery/research_assistant.md +98 -0
  8. docs/Gallery/research_assistant.mermaid +42 -0
  9. docs/Gallery/simple_chatbot.md +36 -0
  10. docs/Gallery/simple_chatbot.mermaid +35 -0
  11. docs/How To/Authentication/configure_aws_authentication.md +60 -0
  12. docs/How To/Authentication/use_api_key_authentication.md +40 -0
  13. docs/How To/Command Line Usage/load_multiple_inputs_from_files.md +62 -0
  14. docs/How To/Command Line Usage/pass_inputs_on_the_cli.md +52 -0
  15. docs/How To/Command Line Usage/serve_with_auto_reload.md +26 -0
  16. docs/How To/Data Processing/adjust_concurrency.md +41 -0
  17. docs/How To/Data Processing/cache_step_results.md +71 -0
  18. docs/How To/Data Processing/decode_json_xml.md +24 -0
  19. docs/How To/Data Processing/explode_collections.md +40 -0
  20. docs/How To/Data Processing/gather_results.md +68 -0
  21. docs/How To/Data Processing/read_data_from_files.md +35 -0
  22. docs/How To/Data Processing/read_sql_databases.md +47 -0
  23. docs/How To/Data Processing/write_data_to_file.md +40 -0
  24. docs/How To/Invoke Models/call_large_language_models.md +51 -0
  25. docs/How To/Invoke Models/create_embeddings.md +49 -0
  26. docs/How To/Invoke Models/reuse_prompts_with_templates.md +39 -0
  27. docs/How To/Language Features/include_qtype_yaml.md +45 -0
  28. docs/How To/Language Features/include_raw_text_from_other_files.md +47 -0
  29. docs/How To/Language Features/reference_entities_by_id.md +51 -0
  30. docs/How To/Language Features/use_environment_variables.md +47 -0
  31. docs/How To/Language Features/use_qtype_mcp.md +59 -0
  32. docs/How To/Observability & Debugging/trace_calls_with_open_telemetry.md +49 -0
  33. docs/How To/Observability & Debugging/validate_qtype_yaml.md +35 -0
  34. docs/How To/Observability & Debugging/visualize_application_architecture.md +61 -0
  35. docs/How To/Observability & Debugging/visualize_example.mermaid +35 -0
  36. docs/How To/Qtype Server/flow_as_ui.png +0 -0
  37. docs/How To/Qtype Server/serve_flows_as_apis.md +40 -0
  38. docs/How To/Qtype Server/serve_flows_as_ui.md +42 -0
  39. docs/How To/Qtype Server/use_conversational_interfaces.md +59 -0
  40. docs/How To/Qtype Server/use_variables_with_ui_hints.md +47 -0
  41. docs/How To/Tools & Integration/bind_tool_inputs_and_outputs.md +48 -0
  42. docs/How To/Tools & Integration/create_tools_from_openapi_specifications.md +89 -0
  43. docs/How To/Tools & Integration/create_tools_from_python_modules.md +90 -0
  44. docs/Reference/cli.md +338 -0
  45. docs/Reference/plugins.md +95 -0
  46. docs/Reference/semantic-validation-rules.md +179 -0
  47. docs/Tutorials/01-first-qtype-application.md +248 -0
  48. docs/Tutorials/02-conversational-chatbot.md +327 -0
  49. docs/Tutorials/03-structured-data.md +481 -0
  50. docs/Tutorials/04-tools-and-function-calling.md +483 -0
  51. docs/Tutorials/example_chat.png +0 -0
  52. docs/Tutorials/index.md +92 -0
  53. docs/components/APIKeyAuthProvider.md +7 -0
  54. docs/components/APITool.md +10 -0
  55. docs/components/AWSAuthProvider.md +13 -0
  56. docs/components/AWSSecretManager.md +5 -0
  57. docs/components/Agent.md +6 -0
  58. docs/components/Aggregate.md +8 -0
  59. docs/components/AggregateStats.md +7 -0
  60. docs/components/Application.md +22 -0
  61. docs/components/AuthorizationProvider.md +6 -0
  62. docs/components/AuthorizationProviderList.md +5 -0
  63. docs/components/BearerTokenAuthProvider.md +6 -0
  64. docs/components/BedrockReranker.md +8 -0
  65. docs/components/ChatContent.md +7 -0
  66. docs/components/ChatMessage.md +6 -0
  67. docs/components/ConstantPath.md +5 -0
  68. docs/components/CustomType.md +7 -0
  69. docs/components/Decoder.md +8 -0
  70. docs/components/DecoderFormat.md +8 -0
  71. docs/components/DocToTextConverter.md +7 -0
  72. docs/components/Document.md +7 -0
  73. docs/components/DocumentEmbedder.md +7 -0
  74. docs/components/DocumentIndex.md +7 -0
  75. docs/components/DocumentSearch.md +7 -0
  76. docs/components/DocumentSource.md +12 -0
  77. docs/components/DocumentSplitter.md +10 -0
  78. docs/components/Echo.md +8 -0
  79. docs/components/Embedding.md +7 -0
  80. docs/components/EmbeddingModel.md +6 -0
  81. docs/components/FieldExtractor.md +20 -0
  82. docs/components/FileSource.md +6 -0
  83. docs/components/FileWriter.md +7 -0
  84. docs/components/Flow.md +14 -0
  85. docs/components/FlowInterface.md +7 -0
  86. docs/components/Index.md +8 -0
  87. docs/components/IndexUpsert.md +6 -0
  88. docs/components/InvokeEmbedding.md +7 -0
  89. docs/components/InvokeFlow.md +8 -0
  90. docs/components/InvokeTool.md +8 -0
  91. docs/components/LLMInference.md +9 -0
  92. docs/components/ListType.md +5 -0
  93. docs/components/Memory.md +8 -0
  94. docs/components/MessageRole.md +14 -0
  95. docs/components/Model.md +10 -0
  96. docs/components/ModelList.md +5 -0
  97. docs/components/OAuth2AuthProvider.md +9 -0
  98. docs/components/PrimitiveTypeEnum.md +21 -0
  99. docs/components/PromptTemplate.md +7 -0
  100. docs/components/PythonFunctionTool.md +7 -0
  101. docs/components/RAGChunk.md +7 -0
  102. docs/components/RAGDocument.md +10 -0
  103. docs/components/RAGSearchResult.md +8 -0
  104. docs/components/Reranker.md +5 -0
  105. docs/components/SQLSource.md +8 -0
  106. docs/components/Search.md +7 -0
  107. docs/components/SearchResult.md +7 -0
  108. docs/components/SecretManager.md +7 -0
  109. docs/components/SecretReference.md +7 -0
  110. docs/components/Source.md +6 -0
  111. docs/components/Step.md +9 -0
  112. docs/components/TelemetrySink.md +9 -0
  113. docs/components/Tool.md +9 -0
  114. docs/components/ToolList.md +5 -0
  115. docs/components/ToolParameter.md +6 -0
  116. docs/components/TypeList.md +5 -0
  117. docs/components/Variable.md +6 -0
  118. docs/components/VariableList.md +5 -0
  119. docs/components/VectorIndex.md +7 -0
  120. docs/components/VectorSearch.md +6 -0
  121. docs/components/VertexAuthProvider.md +9 -0
  122. docs/components/Writer.md +5 -0
  123. docs/example_ui.png +0 -0
  124. docs/index.md +81 -0
  125. docs/legacy_how_tos/Configuration/modular-yaml.md +366 -0
  126. docs/legacy_how_tos/Configuration/phoenix_projects.png +0 -0
  127. docs/legacy_how_tos/Configuration/phoenix_traces.png +0 -0
  128. docs/legacy_how_tos/Configuration/reference-by-id.md +251 -0
  129. docs/legacy_how_tos/Configuration/telemetry-setup.md +259 -0
  130. docs/legacy_how_tos/Data Types/custom-types.md +52 -0
  131. docs/legacy_how_tos/Data Types/domain-types.md +113 -0
  132. docs/legacy_how_tos/Debugging/visualize-apps.md +147 -0
  133. docs/legacy_how_tos/Tools/api-tools.md +29 -0
  134. docs/legacy_how_tos/Tools/python-tools.md +299 -0
  135. examples/authentication/aws_authentication.qtype.yaml +63 -0
  136. examples/conversational_ai/hello_world_chat.qtype.yaml +43 -0
  137. examples/conversational_ai/simple_chatbot.qtype.yaml +40 -0
  138. examples/data_processing/batch_processing.qtype.yaml +54 -0
  139. examples/data_processing/cache_step_results.qtype.yaml +78 -0
  140. examples/data_processing/collect_results.qtype.yaml +55 -0
  141. examples/data_processing/dataflow_pipelines.qtype.yaml +108 -0
  142. examples/data_processing/decode_json.qtype.yaml +23 -0
  143. examples/data_processing/explode_items.qtype.yaml +25 -0
  144. examples/data_processing/read_file.qtype.yaml +60 -0
  145. examples/invoke_models/create_embeddings.qtype.yaml +28 -0
  146. examples/invoke_models/simple_llm_call.qtype.yaml +32 -0
  147. examples/language_features/include_raw.qtype.yaml +27 -0
  148. examples/language_features/ui_hints.qtype.yaml +52 -0
  149. examples/legacy/bedrock/data_analysis_with_telemetry.qtype.yaml +169 -0
  150. examples/legacy/bedrock/hello_world.qtype.yaml +39 -0
  151. examples/legacy/bedrock/hello_world_chat.qtype.yaml +37 -0
  152. examples/legacy/bedrock/hello_world_chat_with_telemetry.qtype.yaml +40 -0
  153. examples/legacy/bedrock/hello_world_chat_with_thinking.qtype.yaml +40 -0
  154. examples/legacy/bedrock/hello_world_completion.qtype.yaml +41 -0
  155. examples/legacy/bedrock/hello_world_completion_with_auth.qtype.yaml +44 -0
  156. examples/legacy/bedrock/simple_agent_chat.qtype.yaml +46 -0
  157. examples/legacy/chat_with_langfuse.qtype.yaml +50 -0
  158. examples/legacy/data_processor.qtype.yaml +48 -0
  159. examples/legacy/echo/debug_example.qtype.yaml +59 -0
  160. examples/legacy/echo/prompt.qtype.yaml +22 -0
  161. examples/legacy/echo/test.qtype.yaml +26 -0
  162. examples/legacy/echo/video.qtype.yaml +20 -0
  163. examples/legacy/field_extractor_example.qtype.yaml +137 -0
  164. examples/legacy/multi_flow_example.qtype.yaml +125 -0
  165. examples/legacy/openai/hello_world_chat.qtype.yaml +43 -0
  166. examples/legacy/openai/hello_world_chat_with_telemetry.qtype.yaml +46 -0
  167. examples/legacy/rag.qtype.yaml +207 -0
  168. examples/legacy/time_utilities.qtype.yaml +64 -0
  169. examples/legacy/vertex/hello_world_chat.qtype.yaml +36 -0
  170. examples/legacy/vertex/hello_world_completion.qtype.yaml +40 -0
  171. examples/legacy/vertex/hello_world_completion_with_auth.qtype.yaml +45 -0
  172. examples/observability_debugging/trace_with_opentelemetry.qtype.yaml +40 -0
  173. examples/research_assistant/research_assistant.qtype.yaml +94 -0
  174. examples/research_assistant/tavily.oas.yaml +722 -0
  175. examples/research_assistant/tavily.qtype.yaml +289 -0
  176. examples/tutorials/01_hello_world.qtype.yaml +48 -0
  177. examples/tutorials/02_conversational_chat.qtype.yaml +37 -0
  178. examples/tutorials/03_structured_data.qtype.yaml +130 -0
  179. examples/tutorials/04_tools_and_function_calling.qtype.yaml +89 -0
  180. qtype/application/converters/tools_from_api.py +39 -35
  181. qtype/base/types.py +6 -1
  182. qtype/commands/convert.py +3 -6
  183. qtype/commands/generate.py +7 -3
  184. qtype/commands/mcp.py +68 -0
  185. qtype/commands/validate.py +4 -4
  186. qtype/dsl/custom_types.py +2 -1
  187. qtype/dsl/linker.py +15 -7
  188. qtype/dsl/loader.py +3 -3
  189. qtype/dsl/model.py +24 -3
  190. qtype/interpreter/api.py +4 -1
  191. qtype/interpreter/base/base_step_executor.py +3 -1
  192. qtype/interpreter/conversions.py +7 -3
  193. qtype/interpreter/executors/construct_executor.py +1 -1
  194. qtype/interpreter/executors/document_splitter_executor.py +4 -1
  195. qtype/interpreter/executors/file_source_executor.py +3 -3
  196. qtype/interpreter/executors/file_writer_executor.py +4 -4
  197. qtype/interpreter/executors/index_upsert_executor.py +1 -1
  198. qtype/interpreter/executors/sql_source_executor.py +1 -1
  199. qtype/interpreter/resource_cache.py +3 -1
  200. qtype/interpreter/rich_progress.py +6 -3
  201. qtype/interpreter/stream/chat/converter.py +25 -17
  202. qtype/interpreter/stream/chat/ui_request_to_domain_type.py +2 -2
  203. qtype/interpreter/typing.py +5 -7
  204. qtype/mcp/__init__.py +0 -0
  205. qtype/mcp/server.py +467 -0
  206. qtype/semantic/checker.py +1 -1
  207. qtype/semantic/generate.py +3 -3
  208. qtype/semantic/visualize.py +38 -51
  209. {qtype-0.1.10.dist-info → qtype-0.1.12.dist-info}/METADATA +21 -1
  210. qtype-0.1.12.dist-info/RECORD +325 -0
  211. {qtype-0.1.10.dist-info → qtype-0.1.12.dist-info}/WHEEL +1 -1
  212. schema/qtype.schema.json +4018 -0
  213. qtype-0.1.10.dist-info/RECORD +0 -142
  214. {qtype-0.1.10.dist-info → qtype-0.1.12.dist-info}/entry_points.txt +0 -0
  215. {qtype-0.1.10.dist-info → qtype-0.1.12.dist-info}/licenses/LICENSE +0 -0
  216. {qtype-0.1.10.dist-info → qtype-0.1.12.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,52 @@
1
+ # Pass Inputs On The CLI
2
+
3
+ Provide input values to your QType flows directly from the command line using JSON-formatted input data, enabling dynamic parameterization of applications without modifying YAML files.
4
+
5
+ ### CLI Usage
6
+
7
+ ```bash
8
+ # Pass a single input variable
9
+ qtype run -i '{"user_name":"Alice"}' app.qtype.yaml
10
+
11
+ # Pass multiple input variables
12
+ qtype run -i '{"model_id":"claude-3", "temperature":0.7}' app.qtype.yaml
13
+
14
+ # Pass complex nested structures
15
+ qtype run -i '{"config":{"max_tokens":1000,"top_p":0.9}}' app.qtype.yaml
16
+
17
+ # Specify which flow to run with inputs
18
+ qtype run -f analyze_data -i '{"threshold":0.85}' app.qtype.yaml
19
+ ```
20
+
21
+ ### Explanation
22
+
23
+ - **`-i`, `--input`**: Accepts a JSON blob containing key-value pairs where keys match variable names declared in your flow's `inputs` field
24
+ - **JSON format**: Must be valid JSON with double quotes for strings, properly escaped special characters
25
+ - **Flow inputs**: The variables must match those declared in the flow's `inputs` list or the application's `inputs` list
26
+ - **`-f`, `--flow`**: Specifies which flow to run when your application contains multiple flows (defaults to first flow if omitted)
27
+
28
+ ## Complete Example
29
+
30
+ The [LLM Processing Pipelines](../../Gallery/dataflow_pipelines.md) example demonstrates passing the output file path as a CLI input:
31
+
32
+ ```bash
33
+ # Run the pipeline with a custom output path
34
+ qtype run -i '{"output_path":"results.parquet"}' \
35
+ --progress \
36
+ examples/data_processing/dataflow_pipelines.qtype.yaml
37
+ ```
38
+
39
+ The flow declares `output_path` in its inputs:
40
+
41
+ ```yaml
42
+ flows:
43
+ - name: analyze_reviews
44
+ inputs:
45
+ - output_path # Receives value from CLI -i flag
46
+ ```
47
+
48
+ ## See Also
49
+
50
+ - [Load Multiple Inputs from Files](load_inputs_from_files.md)
51
+ - [Use Session Inputs for Sticky Variables](../Language%20Features/use_session_inputs.md)
52
+ - [Example: LLM Processing Pipelines](../../Gallery/dataflow_pipelines.md)
@@ -0,0 +1,26 @@
1
+ # Serve Applications with Auto-Reload
2
+
3
+ Enable automatic reloading of your application when YAML files change during development using the `--reload` flag.
4
+
5
+ ### CLI Command
6
+
7
+ ```bash
8
+ qtype serve --reload my_app.qtype.yaml
9
+ ```
10
+
11
+ ### Explanation
12
+
13
+ - **--reload**: Watches YAML files for changes and automatically restarts the server
14
+ - **Development workflow**: Edit your YAML file, save, and immediately see changes without manual restart
15
+ - **Port option**: Combine with `-p`/`--port` to specify server port (default: 8000)
16
+
17
+ ### Example with Port
18
+
19
+ ```bash
20
+ qtype serve --reload -p 8080 examples/tutorials/01_hello_world.qtype.yaml
21
+ ```
22
+
23
+ ## See Also
24
+
25
+ - [Serve Command Reference](../../Reference/CLI.md#serve)
26
+ - [Tutorial: Hello World](../../Tutorials/01_hello_world.md)
@@ -0,0 +1,41 @@
1
+ # Adjust Concurrency
2
+
3
+ Control parallel execution of steps to optimize throughput and resource usage using the `concurrency_config` parameter on steps that support concurrent processing.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ steps:
9
+ - type: LLMInference
10
+ id: classify
11
+ model: nova
12
+ concurrency_config:
13
+ num_workers: 10 # Process up to 10 items in parallel
14
+ inputs: [document]
15
+ outputs: [classification]
16
+ ```
17
+
18
+ ### Explanation
19
+
20
+ - **concurrency_config**: Configuration object for concurrent processing with `num_workers` parameter
21
+ - **num_workers**: Maximum number of concurrent async workers for this step (default: 1)
22
+
23
+ ### Steps Supporting Concurrency
24
+
25
+ The following step types support `concurrency_config`:
26
+
27
+ - **LLMInference**: Parallel LLM inference calls
28
+ - **InvokeEmbedding**: Parallel embedding generation
29
+ - **InvokeTool**: Parallel tool invocations
30
+ - **DocToTextConverter**: Parallel document conversion
31
+ - **DocumentSplitter**: Parallel document chunking
32
+ - **DocumentEmbedder**: Parallel chunk embedding
33
+ - **DocumentSearch**: Parallel search queries
34
+ - **BedrockReranker**: Parallel reranking operations
35
+
36
+ ## See Also
37
+
38
+ - [LLMInference Reference](../../components/LLMInference.md)
39
+ - [InvokeEmbedding Reference](../../components/InvokeEmbedding.md)
40
+ - [DocumentEmbedder Reference](../../components/DocumentEmbedder.md)
41
+ - [LLM Processing Pipelines](../../Gallery/dataflow_pipelines.md)
@@ -0,0 +1,71 @@
1
+ # Cache Step Results
2
+
3
+ Avoid redundant computation by caching step results on disk, enabling faster re-runs when processing the same inputs.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ steps:
9
+ - type: LLMInference
10
+ id: classify
11
+ model: nova
12
+ inputs: [prompt]
13
+ outputs: [category]
14
+ cache_config:
15
+ namespace: document_classification # Logical grouping for cached data
16
+ version: "1.0" # Change to invalidate cache
17
+ on_error: Drop # Don't cache errors (default)
18
+ ttl: 3600 # Cache for 1 hour (seconds)
19
+ compress: false # Optionally compress cached data
20
+ ```
21
+
22
+ ### Explanation
23
+
24
+ - **cache_config**: Enables step-level caching with configuration options
25
+ - **namespace**: Logical separation for cache entries (e.g., different projects or data domains)
26
+ - **version**: Cache version string - increment to invalidate all cached results for this step
27
+ - **on_error**: How to handle errors - `Drop` (don't cache errors, default) or `Cache` (cache error results)
28
+ - **ttl**: Time-to-live in seconds before cached entries expire
29
+ - **compress**: Whether to compress cached data (saves disk space, adds CPU overhead)
30
+
31
+ Cached values are stored in the `.qtype-cache/` directory in your working directory.
32
+
33
+ ### Monitoring Cache Performance
34
+
35
+ Use the `--progress` flag to see cache hits and misses:
36
+
37
+ ```bash
38
+ qtype run app.qtype.yaml --flow my_flow --progress
39
+ ```
40
+
41
+ First run shows cache misses:
42
+ ```
43
+ Step classify ✔ 5 succeeded ✖ 0 errors ⟳ 0 hits ✗ 5 misses
44
+ ```
45
+
46
+ Subsequent runs show cache hits (much faster):
47
+ ```
48
+ Step classify ✔ 5 succeeded ✖ 0 errors ⟳ 5 hits ✗ 0 misses
49
+ ```
50
+
51
+ ## Complete Example
52
+
53
+ ```yaml
54
+ --8<-- "../examples/data_processing/cache_step_results.qtype.yaml"
55
+ ```
56
+
57
+ Run the example:
58
+ ```bash
59
+ # First run - cold cache
60
+ qtype run examples/data_processing/cache_step_results.qtype.yaml --progress -i '{"file_path": "examples/data_processing/sample_documents.jsonl"}'
61
+
62
+ # Second run - warm cache (much faster)
63
+ qtype run examples/data_processing/cache_step_results.qtype.yaml --progress -i '{"file_path": "examples/data_processing/sample_documents.jsonl"}'
64
+
65
+ ```
66
+
67
+ ## See Also
68
+
69
+ - [LLMInference Reference](../../components/LLMInference.md)
70
+ - [Adjust Concurrency](adjust_concurrency.md)
71
+ - [Tutorial: Your First QType Application](../../Tutorials/your_first_qtype_application.md)
@@ -0,0 +1,24 @@
1
+ # Decode JSON/XML to Structured Data
2
+
3
+ Parse string data in JSON or XML format into structured outputs. This is particularly useful for extracting structured data from llm outputs.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ --8<-- "../examples/data_processing/decode_json.qtype.yaml"
9
+ ```
10
+
11
+ ### Explanation
12
+
13
+ - **Decoder**: Step that parses string data (JSON or XML) into structured outputs
14
+ - **format**: The data format to parse - `json` (default) or `xml`
15
+ - **inputs**: String variable containing the encoded data to decode
16
+ - **outputs**: List of variables to extract from the decoded data (field names must match keys in the JSON/XML)
17
+ - **Error handling**: If parsing fails, the step raises returns an error
18
+ - **Markdown cleanup**: Automatically strips markdown code fences (```json, ```xml) if present in the input
19
+
20
+ ## See Also
21
+
22
+ - [Decoder Reference](../../components/Decoder.md)
23
+ - [CustomType Reference](../../components/CustomType.md)
24
+ - [Tutorial: Working with Types and Structured Data](../../Tutorials/structured_data.md)
@@ -0,0 +1,40 @@
1
+ # Fan-Out Collections with Explode
2
+
3
+ Transform a single list input into multiple outputs, one per item, enabling parallel processing of collection elements.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ steps:
9
+ - type: Explode
10
+ id: fan_out
11
+ inputs:
12
+ - items # Variable of type list[T]
13
+ outputs:
14
+ - item # Variable of type T
15
+ ```
16
+
17
+ ### Explanation
18
+
19
+ - **Explode**: Takes a single list and yields one output message per item
20
+ - **inputs**: Must be a single variable of type `list[T]`
21
+ - **outputs**: Single variable of the item type `T` (unwrapped from the list)
22
+ - **Fan-out pattern**: Each item is processed independently by downstream steps
23
+
24
+ ## Complete Example
25
+
26
+ ```yaml
27
+ --8<-- "../examples/data_processing/explode_items.qtype.yaml"
28
+ ```
29
+
30
+ **Run it:**
31
+ ```bash
32
+ qtype run examples/data_processing/explode_items.qtype.yaml \
33
+ -i '{"items": ["apple", "banana", "cherry"]}'
34
+ ```
35
+
36
+ ## See Also
37
+
38
+ - [Aggregate Data using Collect](./aggregate_data.md)
39
+ - [Explode Reference](../../components/Explode.md)
40
+ - [Adjust Concurrency](./adjust_concurrency.md)
@@ -0,0 +1,68 @@
1
+ # Gather Results into a List
2
+
3
+ Combine fan-out processing results into a single list while preserving variables that have the same value across all messages (common ancestors).
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ variables:
9
+ - id: processed_product
10
+ type: text
11
+ - id: all_processed
12
+ type: list[text]
13
+
14
+ steps:
15
+ - type: Collect
16
+ id: aggregate
17
+ inputs: [processed_product]
18
+ outputs: [all_processed]
19
+ ```
20
+
21
+ ### Explanation
22
+
23
+ - **Collect**: Gathers all input values from multiple messages into a single list output
24
+ - **Common ancestors**: Only variables that have the exact same value across ALL input messages are preserved in the output message
25
+ - **Fan-out pattern**: Typically used after `Explode` to reverse the fan-out and aggregate results
26
+ - **Single output**: Always produces exactly one output message containing the aggregated list
27
+
28
+ ### Understanding Common Ancestors
29
+
30
+ If you have these three messages flowing into `Collect`:
31
+
32
+ ```
33
+ Message 1: {category: "Electronics", region: "US", product: "Phone", processed: "Processed: Phone"}
34
+ Message 2: {category: "Electronics", region: "US", product: "Laptop", processed: "Processed: Laptop"}
35
+ Message 3: {category: "Electronics", region: "US", product: "Tablet", processed: "Processed: Tablet"}
36
+ ```
37
+
38
+ The `Collect` step will output:
39
+
40
+ ```
41
+ {category: "Electronics", region: "US", all_processed: ["Processed: Phone", "Processed: Laptop", "Processed: Tablet"]}
42
+ ```
43
+
44
+ Note that `product` is **not preserved** because it has different values across the messages. Only `category` and `region` (which are identical in all three messages) are included as common ancestors.
45
+
46
+ ## Complete Example
47
+
48
+ ```yaml
49
+ --8<-- "../examples/data_processing/collect_results.qtype.yaml"
50
+ ```
51
+
52
+ Run the example:
53
+
54
+ ```bash
55
+ qtype run examples/data_processing/collect_results.qtype.yaml \
56
+ -i '{"category": "Electronics", "region": "US", "products": ["Phone", "Laptop", "Tablet"]}'
57
+ ```
58
+
59
+ Output:
60
+ ```
61
+ all_processed: ['Processed: Phone', 'Processed: Laptop', 'Processed: Tablet']
62
+ ```
63
+
64
+ ## See Also
65
+
66
+ - [Explode Collections for Fan-Out Processing](explode_collections.md)
67
+ - [Collect Reference](../../components/Collect.md)
68
+ - [Explode Reference](../../components/Explode.md)
@@ -0,0 +1,35 @@
1
+ # Read Data from Files
2
+
3
+ Load structured data from files using FileSource, which supports CSV, JSON, JSONL, and Parquet formats with automatic format detection based on file extension.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ steps:
9
+ - id: read_data
10
+ type: FileSource
11
+ path: batch_inputs.csv
12
+ outputs:
13
+ - query
14
+ - topic
15
+ ```
16
+
17
+ ### Explanation
18
+
19
+ - **FileSource**: Step that reads structured data from files using fsspec-compatible URIs
20
+ - **path**: File path (relative to YAML file or absolute), supports local files and cloud storage (s3://, gs://, etc.)
21
+ - **outputs**: Column names from the file to extract as variables (must match actual column names)
22
+ - **Format detection**: Automatically determined by file extension (.csv, .json, .jsonl, .parquet)
23
+ - **Streaming**: Emits one FlowMessage per row, enabling downstream steps to process data in parallel
24
+
25
+ ## Complete Example
26
+
27
+ ```yaml
28
+ --8<-- "../examples/data_processing/read_file.qtype.yaml"
29
+ ```
30
+
31
+ ## See Also
32
+
33
+ - [FileSource Reference](../../components/FileSource.md)
34
+ - [Aggregate Reference](../../components/Aggregate.md)
35
+ - [Example: Batch Processing](../../Gallery/Data%20Processing/batch_processing.md)
@@ -0,0 +1,47 @@
1
+ # Read Data from SQL Databases
2
+
3
+ Query relational databases and process results row-by-row using the `SQLSource` step, which supports any database accessible via SQLAlchemy connection strings.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ steps:
9
+ - type: SQLSource
10
+ id: load_reviews
11
+ connection: "sqlite:///data/reviews.db"
12
+ query: |
13
+ SELECT
14
+ review_id,
15
+ product_name,
16
+ rating,
17
+ review_text
18
+ FROM product_reviews
19
+ WHERE rating >= 4
20
+ ORDER BY review_id
21
+ outputs:
22
+ - review_id
23
+ - product_name
24
+ - rating
25
+ - review_text
26
+ ```
27
+
28
+ ### Explanation
29
+
30
+ - **SQLSource**: Step type that executes SQL queries and emits one message per database row
31
+ - **connection**: SQLAlchemy-format connection string (e.g., `sqlite:///path.db`, `postgresql://user:pass@host/db`)
32
+ - **query**: SQL query to execute; column names must match output variable IDs
33
+ - **outputs**: Variables to populate from query result columns (order must match SELECT clause)
34
+ - **auth**: Optional reference to AuthorizationProvider for database credentials
35
+
36
+ ## Complete Example
37
+
38
+ ```yaml
39
+ --8<-- "../examples/data_processing/dataflow_pipelines.qtype.yaml"
40
+ ```
41
+
42
+ ## See Also
43
+
44
+ - [SQLSource Reference](../../components/SQLSource.md)
45
+ - [FileSource Reference](../../components/FileSource.md)
46
+ - [Tutorial: Working with Types and Structured Data](../../Tutorials/working_with_types_and_structured_data.md)
47
+ - [Example: Dataflow Pipeline](../../Gallery/Data%20Processing/dataflow_pipelines.md)
@@ -0,0 +1,40 @@
1
+ # Write Data to a File
2
+
3
+ Write flow data to files using the `FileWriter` step, which accumulates all messages and outputs data in Parquet format using fsspec-compatible URIs.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ steps:
9
+ - type: FileWriter
10
+ id: write_results
11
+ path: output_path # Variable containing file path
12
+ inputs:
13
+ - review_id
14
+ - product_name
15
+ - rating
16
+ - llm_analysis
17
+ - output_path
18
+ outputs:
19
+ - result_file
20
+ ```
21
+
22
+ ### Explanation
23
+
24
+ - **FileWriter**: Batches all incoming messages and writes them as a single Parquet file
25
+ - **path**: fsspec-compatible URI (can be a `ConstantPath`, Variable reference, or string) for the output file location
26
+ - **inputs**: Variables from FlowMessages to include as columns in the output file
27
+ - **outputs**: Variable containing the path where data was written (useful for passing to downstream steps)
28
+ - **batch_config**: Optional configuration for batch size. This defaults to max_int (i.e., processes all messages into one file). If you change it, you will get multiple files.
29
+
30
+ ## Complete Example
31
+ See the [LLM Processing Pipelines](../../Gallery/dataflow_pipelines.md) gallery example.
32
+
33
+
34
+
35
+ ## See Also
36
+
37
+ - [FileWriter Reference](../../components/FileWriter.md)
38
+ - [Read Data from Files](read_data_from_files.md)
39
+ - [Read SQL Databases](read_sql_databases.md)
40
+ - [LLM Processing Pipelines](../../Gallery/dataflow_pipelines.md)
@@ -0,0 +1,51 @@
1
+ # Call Large Language Models
2
+
3
+ Send text input to an LLM and receive a response using the `LLMInference` step with a system message and configurable model parameters like temperature and max_tokens.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ models:
9
+ - type: Model
10
+ id: nova_lite
11
+ provider: aws-bedrock
12
+ model_id: amazon.nova-lite-v1:0
13
+ inference_params:
14
+ temperature: 0.7
15
+ max_tokens: 500
16
+
17
+ steps:
18
+ - type: LLMInference
19
+ id: assistant
20
+ model: nova_lite
21
+ system_message: "You are a helpful assistant"
22
+ inputs: [text]
23
+ outputs: [response]
24
+ ```
25
+
26
+ ### Explanation
27
+
28
+ - **model**: Reference to a Model resource defining the LLM provider and model ID
29
+ - **inference_params**: Configuration for model behavior (temperature, max_tokens, top_p, etc.)
30
+ - **temperature**: Controls randomness (0.0 = deterministic, 1.0 = creative)
31
+ - **max_tokens**: Maximum number of tokens in the response
32
+ - **system_message**: Sets the assistant's persona and instructions for all requests
33
+ - **inputs**: Variables containing the user's text input to the LLM
34
+ - **outputs**: Variables where the LLM's response will be stored (must be type `text` or `ChatMessage`)
35
+
36
+ ## Complete Example
37
+
38
+ ```yaml
39
+ --8<-- "../examples/invoke_models/simple_llm_call.qtype.yaml"
40
+ ```
41
+
42
+ Run with:
43
+ ```bash
44
+ qtype run simple_llm_call.qtype.yaml --input '{"text": "What is the capital of France?"}'
45
+ ```
46
+
47
+ ## See Also
48
+
49
+ - [LLMInference Reference](../../components/LLMInference.md)
50
+ - [Model Reference](../../components/Model.md)
51
+ - [Tutorial: Build a Conversational Interface](../../Tutorials/conversational_interface.md)
@@ -0,0 +1,49 @@
1
+ # Create Embeddings
2
+
3
+ Generate vector embeddings from text using an embedding model, useful for semantic search, similarity comparisons, and RAG applications.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ models:
9
+ - type: EmbeddingModel
10
+ id: titan_embed
11
+ provider: aws-bedrock
12
+ model_id: amazon.titan-embed-text-v2:0
13
+ dimensions: 1024
14
+
15
+ flows:
16
+ - type: Flow
17
+ id: main
18
+ steps:
19
+ - type: InvokeEmbedding
20
+ id: embed_text
21
+ model: titan_embed
22
+ inputs: [text]
23
+ outputs: [embedding]
24
+ ```
25
+
26
+ ### Explanation
27
+
28
+ - **EmbeddingModel**: Defines an embedding model configuration with provider and dimensions
29
+ - **dimensions**: Size of the embedding vector (must match model output, e.g., 1024 for Titan v2)
30
+ - **InvokeEmbedding**: Step type that generates embeddings from input text
31
+ - **Embedding**: Output type containing the vector array and metadata
32
+
33
+ ## Complete Example
34
+
35
+ ```yaml
36
+ --8<-- "../examples/invoke_models/create_embeddings.qtype.yaml"
37
+ ```
38
+
39
+ Run with:
40
+ ```bash
41
+ qtype run examples/invoke_models/create_embeddings.qtype.yaml \
42
+ -i '{"text": "Your text here"}'
43
+ ```
44
+
45
+ ## See Also
46
+
47
+ - [InvokeEmbedding Reference](../../components/InvokeEmbedding.md)
48
+ - [EmbeddingModel Reference](../../components/EmbeddingModel.md)
49
+ - [Tutorial: Build a RAG System](../../Tutorials/building_rag_system.md)
@@ -0,0 +1,39 @@
1
+ # Reuse Prompts with Templates
2
+
3
+ Define reusable prompt templates with variable placeholders using the `PromptTemplate` step, enabling consistent prompt formatting and dynamic content substitution.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ steps:
9
+ - id: create_prompt
10
+ type: PromptTemplate
11
+ template: |
12
+ Analyze this product review in 1-2 sentences. Include:
13
+ - Overall sentiment (positive/negative/mixed)
14
+ - Key themes or points
15
+
16
+ Product: {product_name}
17
+ Rating: {rating}/5
18
+ Review: {review_text}
19
+ inputs:
20
+ - product_name
21
+ - rating
22
+ - review_text
23
+ outputs:
24
+ - analysis_prompt
25
+ ```
26
+
27
+ ### Explanation
28
+
29
+ - **type: PromptTemplate**: Step that formats strings with variable placeholders using Python's `str.format()` syntax
30
+ - **template**: String with `{variable_name}` placeholders that get replaced with actual values from inputs
31
+ - **inputs**: Variables whose values will be substituted into the template placeholders
32
+ - **outputs**: Single variable containing the formatted prompt string ready for LLM inference
33
+
34
+ ## See Also
35
+
36
+ - [PromptTemplate Reference](../../components/PromptTemplate.md)
37
+ - [How-To: Include Raw Text from Other Files](../../How%20To/Language%20Features/include_raw_text.md)
38
+ - [How-To: Invoke LLMs with System Messages](invoke_llms_with_system_messages.md)
39
+ - [Tutorial: Your First QType Application](../../Tutorials/your_first_qtype_application.md)
@@ -0,0 +1,45 @@
1
+ # Include QType YAML
2
+
3
+ Organize QType applications into reusable modules by including external YAML files using the `!include` directive, allowing you to share models, tools, authentication providers, and other resources across multiple applications.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ id: my_app
9
+
10
+ # Include shared resources from other files
11
+ references:
12
+ - !include common/auth.qtype.yaml
13
+ - !include common/models.qtype.yaml
14
+ - !include common/tools.qtype.yaml
15
+
16
+ flows:
17
+ - id: main_flow
18
+ steps:
19
+ - type: LLMInference
20
+ id: generate
21
+ model: shared_gpt4 # References model from included file
22
+ prompt: "Generate a summary"
23
+ ```
24
+
25
+ **common/models.qtype.yaml:**
26
+ ```yaml
27
+ - id: shared_gpt4
28
+ type: Model
29
+ provider: openai
30
+ model_id: gpt-4
31
+ auth: shared_openai_auth
32
+ ```
33
+
34
+ ### Explanation
35
+
36
+ - **!include**: YAML tag that loads and parses external YAML files, merging their content into the current specification
37
+ - **Relative paths**: File paths are resolved relative to the including YAML file's location
38
+ - **Nested includes**: Included files can include other files, creating a hierarchy of modular components
39
+ - **Remote includes**: Supports URLs (e.g., `!include https://example.com/config.yaml`) via fsspec
40
+
41
+ ## See Also
42
+
43
+ - [Reference Entities by ID](reference_entities_by_id.md)
44
+ - [Include Raw Text from Other Files](include_raw_text_from_other_files.md)
45
+ - [Application Reference](../../components/Application.md)
@@ -0,0 +1,47 @@
1
+ # Include Raw Text from Other Files
2
+
3
+ Load external text files into your YAML configuration using the `!include_raw` directive, useful for keeping prompts, templates, and long text content in separate files.
4
+
5
+ ### QType YAML
6
+
7
+ ```yaml
8
+ steps:
9
+ - id: generate_story
10
+ type: PromptTemplate
11
+ template: !include_raw story_prompt.txt
12
+ inputs:
13
+ - theme
14
+ - tone
15
+ outputs:
16
+ - story
17
+ ```
18
+
19
+ **story_prompt.txt:**
20
+ ```txt
21
+ --8<-- "../examples/language_features/story_prompt.txt"
22
+ ```
23
+
24
+ ### Explanation
25
+
26
+ - **!include_raw**: YAML tag that loads the contents of an external file as a raw string
27
+ - **Relative paths**: File paths are resolved relative to the YAML file's location
28
+ - **Template substitution**: The loaded text can contain variable placeholders (e.g., `{theme}`, `{tone}`) that are substituted at runtime
29
+ - **Use cases**: Prompt templates, system messages, documentation, or any text content you want to manage separately
30
+
31
+ ## Complete Example
32
+
33
+ ```yaml
34
+ --8<-- "../examples/language_features/include_raw.qtype.yaml"
35
+ ```
36
+
37
+
38
+
39
+ **Run it:**
40
+ ```bash
41
+ qtype run include_raw.qtype.yaml -i '{"theme":"a robot learning to paint","tone":"inspirational"}'
42
+ ```
43
+
44
+ ## See Also
45
+
46
+ - [PromptTemplate Reference](../../components/PromptTemplate.md)
47
+ - [Reference Entities by ID](../../How%20To/Language%20Features/reference_entities_by_id.md)