qtype 0.1.12__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 (252) 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/commands/generate.py +90 -7
  6. qtype/commands/run.py +116 -44
  7. qtype/docs/.pages +8 -0
  8. {docs → qtype/docs}/Concepts/mental-model-and-philosophy.md +1 -1
  9. qtype/docs/Contributing/.pages +4 -0
  10. {docs → qtype/docs}/Contributing/index.md +8 -1
  11. {docs → qtype/docs}/Gallery/dataflow_pipelines.md +3 -2
  12. {docs → qtype/docs}/Gallery/research_assistant.md +3 -4
  13. {docs → qtype/docs}/Gallery/simple_chatbot.md +3 -1
  14. {docs → qtype/docs}/How To/Authentication/configure_aws_authentication.md +2 -2
  15. {docs → qtype/docs}/How To/Authentication/use_api_key_authentication.md +2 -2
  16. {docs → qtype/docs}/How To/Command Line Usage/load_multiple_inputs_from_files.md +24 -9
  17. {docs → qtype/docs}/How To/Command Line Usage/pass_inputs_on_the_cli.md +3 -3
  18. {docs → qtype/docs}/How To/Command Line Usage/serve_with_auto_reload.md +3 -2
  19. {docs → qtype/docs}/How To/Data Processing/adjust_concurrency.md +3 -4
  20. {docs → qtype/docs}/How To/Data Processing/cache_step_results.md +2 -2
  21. {docs → qtype/docs}/How To/Data Processing/decode_json_xml.md +1 -1
  22. {docs → qtype/docs}/How To/Data Processing/explode_collections.md +2 -2
  23. {docs → qtype/docs}/How To/Data Processing/gather_results.md +4 -4
  24. qtype/docs/How To/Data Processing/invoke_other_flows.md +71 -0
  25. qtype/docs/How To/Data Processing/load_data_from_athena.md +49 -0
  26. qtype/docs/How To/Data Processing/read_data_from_files.md +61 -0
  27. {docs → qtype/docs}/How To/Data Processing/read_sql_databases.md +2 -3
  28. {docs → qtype/docs}/How To/Data Processing/write_data_to_file.md +1 -2
  29. {docs → qtype/docs}/How To/Invoke Models/call_large_language_models.md +1 -1
  30. {docs → qtype/docs}/How To/Invoke Models/create_embeddings.md +1 -1
  31. {docs → qtype/docs}/How To/Invoke Models/reuse_prompts_with_templates.md +2 -3
  32. {docs → qtype/docs}/How To/Language Features/include_raw_text_from_other_files.md +2 -1
  33. {docs → qtype/docs}/How To/Language Features/reference_entities_by_id.md +2 -2
  34. qtype/docs/How To/Language Features/use_agent_skills.md +29 -0
  35. {docs → qtype/docs}/How To/Language Features/use_environment_variables.md +2 -1
  36. qtype/docs/How To/Language Features/use_optional_variables.md +42 -0
  37. {docs → qtype/docs}/How To/Language Features/use_qtype_mcp.md +4 -4
  38. {docs → qtype/docs}/How To/Observability & Debugging/trace_calls_with_open_telemetry.md +1 -1
  39. {docs → qtype/docs}/How To/Observability & Debugging/validate_qtype_yaml.md +3 -2
  40. {docs → qtype/docs}/How To/Observability & Debugging/visualize_application_architecture.md +1 -1
  41. {docs → qtype/docs}/How To/Qtype Server/serve_flows_as_apis.md +3 -3
  42. {docs → qtype/docs}/How To/Qtype Server/serve_flows_as_ui.md +2 -3
  43. {docs → qtype/docs}/How To/Qtype Server/use_conversational_interfaces.md +1 -4
  44. {docs → qtype/docs}/How To/Qtype Server/use_variables_with_ui_hints.md +3 -2
  45. {docs → qtype/docs}/How To/Tools & Integration/bind_tool_inputs_and_outputs.md +1 -2
  46. {docs → qtype/docs}/How To/Tools & Integration/create_tools_from_openapi_specifications.md +10 -14
  47. {docs → qtype/docs}/How To/Tools & Integration/create_tools_from_python_modules.md +5 -8
  48. {docs → qtype/docs}/Reference/cli.md +13 -15
  49. {docs → qtype/docs}/Reference/plugins.md +4 -0
  50. {docs → qtype/docs}/Reference/semantic-validation-rules.md +6 -1
  51. qtype/docs/Tutorials/.pages +1 -0
  52. {docs → qtype/docs}/Tutorials/01-first-qtype-application.md +3 -2
  53. {docs → qtype/docs}/Tutorials/02-conversational-chatbot.md +3 -3
  54. {docs → qtype/docs}/Tutorials/03-structured-data.md +9 -10
  55. {docs → qtype/docs}/Tutorials/04-tools-and-function-calling.md +12 -19
  56. {docs → qtype/docs}/components/APITool.md +1 -1
  57. qtype/docs/components/Aggregate.md +7 -0
  58. qtype/docs/components/Collect.md +6 -0
  59. qtype/docs/components/Construct.md +6 -0
  60. {docs → qtype/docs}/components/DocumentEmbedder.md +0 -1
  61. {docs → qtype/docs}/components/DocumentSplitter.md +0 -1
  62. qtype/docs/components/Explode.md +5 -0
  63. {docs → qtype/docs}/components/FieldExtractor.md +2 -1
  64. qtype/docs/components/InvokeFlow.md +8 -0
  65. qtype/docs/components/InvokeTool.md +8 -0
  66. {docs → qtype/docs}/components/PrimitiveTypeEnum.md +0 -1
  67. {docs → qtype/docs}/components/Source.md +0 -1
  68. {docs → qtype/docs}/components/Step.md +0 -1
  69. {docs → qtype/docs}/components/Tool.md +2 -2
  70. {docs → qtype/docs}/components/Variable.md +2 -0
  71. qtype/docs/legacy_how_tos/.pages +6 -0
  72. qtype/docs/skills/architect/SKILL.md +188 -0
  73. qtype/docs/skills/architect/references/cheatsheet.md +198 -0
  74. qtype/docs/skills/architect/references/patterns.md +29 -0
  75. qtype/docs/stylesheets/extra.css +27 -0
  76. qtype/dsl/linker.py +8 -0
  77. qtype/dsl/model.py +177 -84
  78. qtype/examples/data_processing/athena_query.qtype.yaml +56 -0
  79. qtype/examples/data_processing/batch_inputs.csv +5 -0
  80. qtype/examples/data_processing/create_sample_db.py +129 -0
  81. qtype/examples/data_processing/invoke_other_flows.qtype.yaml +98 -0
  82. qtype/examples/data_processing/reviews.db +0 -0
  83. qtype/examples/data_processing/sample_article.txt +1 -0
  84. qtype/examples/data_processing/sample_documents.jsonl +5 -0
  85. qtype/examples/language_features/optional_variables.qtype.yaml +32 -0
  86. qtype/examples/language_features/story_prompt.txt +6 -0
  87. qtype/examples/legacy/data/customers.csv +6 -0
  88. qtype/examples/legacy/echo/readme.md +29 -0
  89. qtype/examples/legacy/qtype_plugin_example.py +51 -0
  90. qtype/examples/legacy/sample_data.txt +43 -0
  91. qtype/examples/legacy/vertex/README.md +11 -0
  92. qtype/examples/research_assistant/tavily.qtype.yaml +216 -0
  93. {examples → qtype/examples}/tutorials/03_structured_data.qtype.yaml +2 -2
  94. {examples → qtype/examples}/tutorials/04_tools_and_function_calling.qtype.yaml +5 -5
  95. qtype/interpreter/base/stream_emitter.py +19 -13
  96. qtype/interpreter/converters.py +142 -26
  97. qtype/interpreter/executors/agent_executor.py +2 -3
  98. qtype/interpreter/executors/aggregate_executor.py +3 -4
  99. qtype/interpreter/executors/construct_executor.py +15 -15
  100. qtype/interpreter/executors/doc_to_text_executor.py +1 -3
  101. qtype/interpreter/executors/field_extractor_executor.py +13 -12
  102. qtype/interpreter/executors/file_source_executor.py +18 -31
  103. qtype/interpreter/executors/invoke_embedding_executor.py +1 -4
  104. qtype/interpreter/executors/invoke_flow_executor.py +2 -2
  105. qtype/interpreter/executors/invoke_tool_executor.py +19 -18
  106. qtype/interpreter/executors/llm_inference_executor.py +16 -18
  107. qtype/interpreter/executors/prompt_template_executor.py +1 -3
  108. qtype/interpreter/tools/function_tool_helper.py +11 -10
  109. qtype/interpreter/types.py +89 -4
  110. qtype/interpreter/typing.py +31 -32
  111. qtype/mcp/server.py +312 -57
  112. {schema → qtype/schema}/qtype.schema.json +77 -79
  113. qtype/semantic/checker.py +19 -0
  114. qtype/semantic/generate.py +3 -6
  115. qtype/semantic/model.py +26 -33
  116. qtype/semantic/resolver.py +7 -0
  117. qtype/semantic/visualize.py +8 -3
  118. {qtype-0.1.12.dist-info → qtype-0.1.13.dist-info}/METADATA +47 -46
  119. qtype-0.1.13.dist-info/RECORD +352 -0
  120. {qtype-0.1.12.dist-info → qtype-0.1.13.dist-info}/WHEEL +1 -2
  121. docs/How To/Data Processing/read_data_from_files.md +0 -35
  122. docs/components/Aggregate.md +0 -8
  123. docs/components/InvokeFlow.md +0 -8
  124. docs/components/InvokeTool.md +0 -8
  125. docs/components/ToolParameter.md +0 -6
  126. examples/research_assistant/tavily.qtype.yaml +0 -289
  127. qtype/application/facade.py +0 -177
  128. qtype-0.1.12.dist-info/RECORD +0 -325
  129. qtype-0.1.12.dist-info/top_level.txt +0 -1
  130. {docs → qtype/docs}/Contributing/roadmap.md +0 -0
  131. {docs → qtype/docs}/Decisions/ADR-001-Chat-vs-Completion-Endpoint-Features.md +0 -0
  132. {docs → qtype/docs}/Gallery/dataflow_pipelines.mermaid +0 -0
  133. {docs → qtype/docs}/Gallery/research_assistant.mermaid +0 -0
  134. {docs → qtype/docs}/Gallery/simple_chatbot.mermaid +0 -0
  135. {docs → qtype/docs}/How To/Language Features/include_qtype_yaml.md +0 -0
  136. {docs → qtype/docs}/How To/Observability & Debugging/visualize_example.mermaid +0 -0
  137. {docs → qtype/docs}/How To/Qtype Server/flow_as_ui.png +0 -0
  138. {docs → qtype/docs}/Tutorials/example_chat.png +0 -0
  139. {docs → qtype/docs}/Tutorials/index.md +0 -0
  140. {docs → qtype/docs}/components/APIKeyAuthProvider.md +0 -0
  141. {docs → qtype/docs}/components/AWSAuthProvider.md +0 -0
  142. {docs → qtype/docs}/components/AWSSecretManager.md +0 -0
  143. {docs → qtype/docs}/components/Agent.md +0 -0
  144. {docs → qtype/docs}/components/AggregateStats.md +0 -0
  145. {docs → qtype/docs}/components/Application.md +0 -0
  146. {docs → qtype/docs}/components/AuthorizationProvider.md +0 -0
  147. {docs → qtype/docs}/components/AuthorizationProviderList.md +0 -0
  148. {docs → qtype/docs}/components/BearerTokenAuthProvider.md +0 -0
  149. {docs → qtype/docs}/components/BedrockReranker.md +0 -0
  150. {docs → qtype/docs}/components/ChatContent.md +0 -0
  151. {docs → qtype/docs}/components/ChatMessage.md +0 -0
  152. {docs → qtype/docs}/components/ConstantPath.md +0 -0
  153. {docs → qtype/docs}/components/CustomType.md +0 -0
  154. {docs → qtype/docs}/components/Decoder.md +0 -0
  155. {docs → qtype/docs}/components/DecoderFormat.md +0 -0
  156. {docs → qtype/docs}/components/DocToTextConverter.md +0 -0
  157. {docs → qtype/docs}/components/Document.md +0 -0
  158. {docs → qtype/docs}/components/DocumentIndex.md +0 -0
  159. {docs → qtype/docs}/components/DocumentSearch.md +0 -0
  160. {docs → qtype/docs}/components/DocumentSource.md +0 -0
  161. {docs → qtype/docs}/components/Echo.md +0 -0
  162. {docs → qtype/docs}/components/Embedding.md +0 -0
  163. {docs → qtype/docs}/components/EmbeddingModel.md +0 -0
  164. {docs → qtype/docs}/components/FileSource.md +0 -0
  165. {docs → qtype/docs}/components/FileWriter.md +0 -0
  166. {docs → qtype/docs}/components/Flow.md +0 -0
  167. {docs → qtype/docs}/components/FlowInterface.md +0 -0
  168. {docs → qtype/docs}/components/Index.md +0 -0
  169. {docs → qtype/docs}/components/IndexUpsert.md +0 -0
  170. {docs → qtype/docs}/components/InvokeEmbedding.md +0 -0
  171. {docs → qtype/docs}/components/LLMInference.md +0 -0
  172. {docs → qtype/docs}/components/ListType.md +0 -0
  173. {docs → qtype/docs}/components/Memory.md +0 -0
  174. {docs → qtype/docs}/components/MessageRole.md +0 -0
  175. {docs → qtype/docs}/components/Model.md +0 -0
  176. {docs → qtype/docs}/components/ModelList.md +0 -0
  177. {docs → qtype/docs}/components/OAuth2AuthProvider.md +0 -0
  178. {docs → qtype/docs}/components/PromptTemplate.md +0 -0
  179. {docs → qtype/docs}/components/PythonFunctionTool.md +0 -0
  180. {docs → qtype/docs}/components/RAGChunk.md +0 -0
  181. {docs → qtype/docs}/components/RAGDocument.md +0 -0
  182. {docs → qtype/docs}/components/RAGSearchResult.md +0 -0
  183. {docs → qtype/docs}/components/Reranker.md +0 -0
  184. {docs → qtype/docs}/components/SQLSource.md +0 -0
  185. {docs → qtype/docs}/components/Search.md +0 -0
  186. {docs → qtype/docs}/components/SearchResult.md +0 -0
  187. {docs → qtype/docs}/components/SecretManager.md +0 -0
  188. {docs → qtype/docs}/components/SecretReference.md +0 -0
  189. {docs → qtype/docs}/components/TelemetrySink.md +0 -0
  190. {docs → qtype/docs}/components/ToolList.md +0 -0
  191. {docs → qtype/docs}/components/TypeList.md +0 -0
  192. {docs → qtype/docs}/components/VariableList.md +0 -0
  193. {docs → qtype/docs}/components/VectorIndex.md +0 -0
  194. {docs → qtype/docs}/components/VectorSearch.md +0 -0
  195. {docs → qtype/docs}/components/VertexAuthProvider.md +0 -0
  196. {docs → qtype/docs}/components/Writer.md +0 -0
  197. {docs → qtype/docs}/example_ui.png +0 -0
  198. {docs → qtype/docs}/index.md +0 -0
  199. {docs → qtype/docs}/legacy_how_tos/Configuration/modular-yaml.md +0 -0
  200. {docs → qtype/docs}/legacy_how_tos/Configuration/phoenix_projects.png +0 -0
  201. {docs → qtype/docs}/legacy_how_tos/Configuration/phoenix_traces.png +0 -0
  202. {docs → qtype/docs}/legacy_how_tos/Configuration/reference-by-id.md +0 -0
  203. {docs → qtype/docs}/legacy_how_tos/Configuration/telemetry-setup.md +0 -0
  204. {docs → qtype/docs}/legacy_how_tos/Data Types/custom-types.md +0 -0
  205. {docs → qtype/docs}/legacy_how_tos/Data Types/domain-types.md +0 -0
  206. {docs → qtype/docs}/legacy_how_tos/Debugging/visualize-apps.md +0 -0
  207. {docs → qtype/docs}/legacy_how_tos/Tools/api-tools.md +0 -0
  208. {docs → qtype/docs}/legacy_how_tos/Tools/python-tools.md +0 -0
  209. {examples → qtype/examples}/authentication/aws_authentication.qtype.yaml +0 -0
  210. {examples → qtype/examples}/conversational_ai/hello_world_chat.qtype.yaml +0 -0
  211. {examples → qtype/examples}/conversational_ai/simple_chatbot.qtype.yaml +0 -0
  212. {examples → qtype/examples}/data_processing/batch_processing.qtype.yaml +0 -0
  213. {examples → qtype/examples}/data_processing/cache_step_results.qtype.yaml +0 -0
  214. {examples → qtype/examples}/data_processing/collect_results.qtype.yaml +0 -0
  215. {examples → qtype/examples}/data_processing/dataflow_pipelines.qtype.yaml +0 -0
  216. {examples → qtype/examples}/data_processing/decode_json.qtype.yaml +0 -0
  217. {examples → qtype/examples}/data_processing/explode_items.qtype.yaml +0 -0
  218. {examples → qtype/examples}/data_processing/read_file.qtype.yaml +0 -0
  219. {examples → qtype/examples}/invoke_models/create_embeddings.qtype.yaml +0 -0
  220. {examples → qtype/examples}/invoke_models/simple_llm_call.qtype.yaml +0 -0
  221. {examples → qtype/examples}/language_features/include_raw.qtype.yaml +0 -0
  222. {examples → qtype/examples}/language_features/ui_hints.qtype.yaml +0 -0
  223. {examples → qtype/examples}/legacy/bedrock/data_analysis_with_telemetry.qtype.yaml +0 -0
  224. {examples → qtype/examples}/legacy/bedrock/hello_world.qtype.yaml +0 -0
  225. {examples → qtype/examples}/legacy/bedrock/hello_world_chat.qtype.yaml +0 -0
  226. {examples → qtype/examples}/legacy/bedrock/hello_world_chat_with_telemetry.qtype.yaml +0 -0
  227. {examples → qtype/examples}/legacy/bedrock/hello_world_chat_with_thinking.qtype.yaml +0 -0
  228. {examples → qtype/examples}/legacy/bedrock/hello_world_completion.qtype.yaml +0 -0
  229. {examples → qtype/examples}/legacy/bedrock/hello_world_completion_with_auth.qtype.yaml +0 -0
  230. {examples → qtype/examples}/legacy/bedrock/simple_agent_chat.qtype.yaml +0 -0
  231. {examples → qtype/examples}/legacy/chat_with_langfuse.qtype.yaml +0 -0
  232. {examples → qtype/examples}/legacy/data_processor.qtype.yaml +0 -0
  233. {examples → qtype/examples}/legacy/echo/debug_example.qtype.yaml +0 -0
  234. {examples → qtype/examples}/legacy/echo/prompt.qtype.yaml +0 -0
  235. {examples → qtype/examples}/legacy/echo/test.qtype.yaml +0 -0
  236. {examples → qtype/examples}/legacy/echo/video.qtype.yaml +0 -0
  237. {examples → qtype/examples}/legacy/field_extractor_example.qtype.yaml +0 -0
  238. {examples → qtype/examples}/legacy/multi_flow_example.qtype.yaml +0 -0
  239. {examples → qtype/examples}/legacy/openai/hello_world_chat.qtype.yaml +0 -0
  240. {examples → qtype/examples}/legacy/openai/hello_world_chat_with_telemetry.qtype.yaml +0 -0
  241. {examples → qtype/examples}/legacy/rag.qtype.yaml +0 -0
  242. {examples → qtype/examples}/legacy/time_utilities.qtype.yaml +0 -0
  243. {examples → qtype/examples}/legacy/vertex/hello_world_chat.qtype.yaml +0 -0
  244. {examples → qtype/examples}/legacy/vertex/hello_world_completion.qtype.yaml +0 -0
  245. {examples → qtype/examples}/legacy/vertex/hello_world_completion_with_auth.qtype.yaml +0 -0
  246. {examples → qtype/examples}/observability_debugging/trace_with_opentelemetry.qtype.yaml +0 -0
  247. {examples → qtype/examples}/research_assistant/research_assistant.qtype.yaml +0 -0
  248. {examples → qtype/examples}/research_assistant/tavily.oas.yaml +0 -0
  249. {examples → qtype/examples}/tutorials/01_hello_world.qtype.yaml +0 -0
  250. {examples → qtype/examples}/tutorials/02_conversational_chat.qtype.yaml +0 -0
  251. {qtype-0.1.12.dist-info → qtype-0.1.13.dist-info}/entry_points.txt +0 -0
  252. {qtype-0.1.12.dist-info → qtype-0.1.13.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1 @@
1
+ Artificial intelligence is revolutionizing healthcare by enabling faster diagnoses and personalized treatment plans. Machine learning algorithms can analyze medical images with incredible accuracy, helping doctors detect diseases earlier. This technology is improving patient outcomes and reducing healthcare costs.
@@ -0,0 +1,5 @@
1
+ {"document": "The new quantum computing breakthrough could revolutionize AI processing speeds."}
2
+ {"document": "Federal Reserve announces interest rate changes to combat inflation."}
3
+ {"document": "New clinical trial shows promising results for cancer treatment."}
4
+ {"document": "University expands online learning programs for remote students."}
5
+ {"document": "Cryptocurrency markets experience volatility amid regulatory concerns."}
@@ -0,0 +1,32 @@
1
+ id: optional_variables_demo
2
+ description: Demonstrates optional variables that can handle missing data gracefully
3
+
4
+ flows:
5
+ - id: extract_optional_field
6
+ variables:
7
+ - id: user_profile
8
+ type: text
9
+ - id: email
10
+ type: text?
11
+
12
+ inputs:
13
+ - user_profile
14
+ outputs:
15
+ - email
16
+
17
+ steps:
18
+ # Try to extract email - may not exist, will return None if missing
19
+ - type: FieldExtractor
20
+ id: extract_email
21
+ inputs:
22
+ - user_profile
23
+ outputs:
24
+ - email
25
+ json_path: $.email
26
+
27
+ - type: Echo
28
+ id: show_result
29
+ inputs:
30
+ - email
31
+ outputs:
32
+ - email
@@ -0,0 +1,6 @@
1
+ You are a creative storyteller. Write a short, engaging story based on the following theme:
2
+
3
+ Theme: {theme}
4
+ Tone: {tone}
5
+
6
+ Create a story that is 3-4 paragraphs long. Make it captivating and appropriate for the specified tone.
@@ -0,0 +1,6 @@
1
+ name,region,purchases
2
+ Alice,West,5
3
+ Bob,East,3
4
+ Charlie,West,7
5
+ Diana,North,2
6
+ Eve,East,4
@@ -0,0 +1,29 @@
1
+ # Echo Examples
2
+
3
+ These examples are intended to be for testing purposes or early stage development. Output will be a replicate of the input.
4
+
5
+ **Primitive types**
6
+ ```
7
+ class PrimitiveTypeEnum(str, Enum):
8
+ """Represents the type of data a user or system input can accept within the DSL."""
9
+
10
+ audio = "audio"
11
+ boolean = "boolean"
12
+ bytes = "bytes"
13
+ citation_document = "citation_document"
14
+ citation_url = "citation_url"
15
+ date = "date"
16
+ datetime = "datetime"
17
+ int = "int"
18
+ file = "file"
19
+ float = "float"
20
+ image = "image"
21
+ text = "text"
22
+ time = "time"
23
+ video = "video"
24
+ thinking = "thinking"
25
+ ```
26
+ To test out a primitive type:
27
+
28
+ - Duplicate `examples/echo/video.qtype.yaml`
29
+ - Replace all mentions of video with the primitive type you wish to test
@@ -0,0 +1,51 @@
1
+ """
2
+ Example QType CLI plugin.
3
+
4
+ This demonstrates how to create a third-party plugin for the QType CLI.
5
+ To use this as a plugin, you would:
6
+
7
+ 1. Put this code in a separate package
8
+ 2. Add an entry point in pyproject.toml:
9
+ [project.entry-points."qtype.commands"]
10
+ example = "your_package.qtype_example:parser"
11
+ 3. Install the package
12
+ """
13
+
14
+ import argparse
15
+
16
+
17
+ def parser(subparsers: argparse._SubParsersAction) -> None:
18
+ """Register the 'example' subcommand.
19
+
20
+ Args:
21
+ subparsers: The subparsers object to add the command to.
22
+ """
23
+ example_parser = subparsers.add_parser(
24
+ "example", help="Example plugin command for QType CLI"
25
+ )
26
+ example_parser.add_argument(
27
+ "--message",
28
+ default="Hello from QType plugin!",
29
+ help="Message to display (default: Hello from QType plugin!)",
30
+ )
31
+ example_parser.add_argument(
32
+ "--count",
33
+ type=int,
34
+ default=1,
35
+ help="Number of times to display the message (default: 1)",
36
+ )
37
+ # Set the function to call when this command is invoked
38
+ example_parser.set_defaults(func=example_command)
39
+
40
+
41
+ def example_command(args: argparse.Namespace) -> None:
42
+ """Handle the 'example' subcommand.
43
+
44
+ Args:
45
+ args: Command-line arguments containing message and count.
46
+ """
47
+ for i in range(args.count):
48
+ print(f"{i + 1}: {args.message}")
49
+
50
+ print("\nThis command was loaded as a plugin!")
51
+ print("Plugin authors can extend QType CLI functionality this way.")
@@ -0,0 +1,43 @@
1
+ Sales Data Q1 2024
2
+ ==================
3
+
4
+ Summary Statistics:
5
+ - Total Records: 1,472 transactions
6
+ - Date Range: January 1 - March 31, 2024
7
+ - Products: A, B, C, D
8
+ - Regions: North, South, East, West
9
+
10
+ Top Performing Products:
11
+ 1. Product A: $1,245,890 total sales (avg $847/transaction)
12
+ 2. Product C: $1,123,450 total sales (avg $763/transaction)
13
+ 3. Product B: $987,230 total sales (avg $671/transaction)
14
+ 4. Product D: $856,340 total sales (avg $582/transaction)
15
+
16
+ Regional Breakdown:
17
+ - North Region: $1,089,450 (26.3% of total)
18
+ - South Region: $1,045,230 (25.2% of total)
19
+ - East Region: $1,012,890 (24.4% of total)
20
+ - West Region: $1,001,340 (24.1% of total)
21
+
22
+ Key Trends:
23
+ - Product A shows consistent growth throughout Q1 (+15% month-over-month)
24
+ - West region had strongest growth rate despite lower absolute numbers
25
+ - Discount rates ranged from 0% to 20%, with 10% being most common
26
+ - Average transaction size increased 8% from Jan to March
27
+ - Customer count per transaction averaging 25 customers
28
+
29
+ Notable Patterns:
30
+ - Weekday sales 23% higher than weekend sales
31
+ - Product D underperforming in South region specifically
32
+ - Strong correlation between discount rate and quantity sold
33
+ - North region showing premium pricing power (higher avg transaction)
34
+
35
+ Concerns:
36
+ - Product D sales declining 5% month-over-month
37
+ - South region discount rates higher than other regions
38
+ - Customer acquisition costs need monitoring
39
+
40
+ Opportunities:
41
+ - West region expansion showing strong ROI
42
+ - Product A momentum could be leveraged for upselling
43
+ - Cross-regional best practices could improve South region performance
@@ -0,0 +1,11 @@
1
+ To use a Vertex example, set the following environment variables manually:
2
+ ```
3
+ export GOOGLE_CLOUD_PROJECT=
4
+ export GOOGLE_CLOUD_LOCATION=
5
+ export GOOGLE_APPLICATION_CREDENTIALS=
6
+ ```
7
+
8
+ Using gcloud CLI:
9
+ How to setup [Gemini CLI Authentication Setup](https://github.com/google-gemini/gemini-cli/blob/main/docs/get-started/authentication.md)
10
+
11
+ `profile_name`: Replace default with relevant GCP project name in `.config/gcloud/configurations/your-project-configuration-file`
@@ -0,0 +1,216 @@
1
+ auths:
2
+ - id: tavily-api_bearerauth_token
3
+ token: ${TAVILY-API_BEARER}
4
+ type: bearer_token
5
+ description: Tools created from API specification
6
+ examples/research_assistant/tavily.oas.yaml
7
+ flows: []
8
+ id: tavily-api
9
+ indexes: []
10
+ memories: []
11
+ models: []
12
+ references: []
13
+ tools:
14
+ - auth: tavily-api_bearerauth_token
15
+ description: 'Perform a web search with various filtering and customization options.
16
+ Returns search results with content, URLs, scores, and optional answers. '
17
+ endpoint: https://api.tavily.com/search
18
+ headers: {}
19
+ id: search
20
+ inputs:
21
+ - id: query
22
+ type: text
23
+ - id: search_depth
24
+ type: text?
25
+ - id: topic
26
+ type: text?
27
+ - id: time_range
28
+ type: text?
29
+ - id: start_date
30
+ type: text?
31
+ - id: end_date
32
+ type: text?
33
+ - id: days
34
+ type: int?
35
+ - id: max_results
36
+ type: int?
37
+ - id: include_domains
38
+ type: list[text]?
39
+ - id: exclude_domains
40
+ type: list[text]?
41
+ - id: include_answer
42
+ type: text?
43
+ - id: include_raw_content
44
+ type: text?
45
+ - id: include_images
46
+ type: boolean?
47
+ - id: country
48
+ type: text?
49
+ - id: auto_parameters
50
+ type: boolean?
51
+ - id: include_favicon
52
+ type: boolean?
53
+ method: POST
54
+ name: Search the web
55
+ outputs:
56
+ - id: query
57
+ type: text?
58
+ - id: follow_up_questions
59
+ type: list[text]?
60
+ - id: answer
61
+ type: text?
62
+ - id: images
63
+ type: list[schema_4849029360]?
64
+ - id: results
65
+ type: list[schema_4849029792]?
66
+ - id: response_time
67
+ type: float?
68
+ parameters: []
69
+ type: APITool
70
+ - auth: tavily-api_bearerauth_token
71
+ description: 'Extract and process content from one or more URLs with various formatting
72
+ options. Returns extracted content in text or markdown format. '
73
+ endpoint: https://api.tavily.com/extract
74
+ headers: {}
75
+ id: extract
76
+ inputs:
77
+ - id: urls
78
+ type: list[text]
79
+ - id: include_images
80
+ type: boolean?
81
+ - id: extract_depth
82
+ type: text?
83
+ - id: format
84
+ type: text?
85
+ - id: include_favicon
86
+ type: boolean?
87
+ method: POST
88
+ name: Extract content from URLs
89
+ outputs:
90
+ - id: results
91
+ type: list[schema_4849038576]?
92
+ - id: failed_results
93
+ type: list[schema_4849041168]?
94
+ parameters: []
95
+ type: APITool
96
+ - auth: tavily-api_bearerauth_token
97
+ description: 'Crawl a website starting from a given URL with depth and breadth controls.
98
+ Extract content from discovered pages with various filtering options. '
99
+ endpoint: https://api.tavily.com/crawl
100
+ headers: {}
101
+ id: crawl
102
+ inputs:
103
+ - id: url
104
+ type: text
105
+ - id: max_depth
106
+ type: int?
107
+ - id: max_breadth
108
+ type: int?
109
+ - id: limit
110
+ type: int?
111
+ - id: instructions
112
+ type: text?
113
+ - id: select_paths
114
+ type: list[text]?
115
+ - id: select_domains
116
+ type: list[text]?
117
+ - id: exclude_paths
118
+ type: list[text]?
119
+ - id: exclude_domains
120
+ type: list[text]?
121
+ - id: allow_external
122
+ type: boolean?
123
+ - id: include_images
124
+ type: boolean?
125
+ - id: extract_depth
126
+ type: text?
127
+ - id: format
128
+ type: text?
129
+ - id: include_favicon
130
+ type: boolean?
131
+ method: POST
132
+ name: Crawl websites
133
+ outputs:
134
+ - id: results
135
+ type: list[schema_4849520304]?
136
+ parameters: []
137
+ type: APITool
138
+ - auth: tavily-api_bearerauth_token
139
+ description: "Map the structure and links of a website starting from a given URL.
140
+ Discover the website's architecture and page hierarchy. "
141
+ endpoint: https://api.tavily.com/map
142
+ headers: {}
143
+ id: map
144
+ inputs:
145
+ - id: url
146
+ type: text
147
+ - id: max_depth
148
+ type: int?
149
+ - id: max_breadth
150
+ type: int?
151
+ - id: limit
152
+ type: int?
153
+ - id: instructions
154
+ type: text?
155
+ - id: select_paths
156
+ type: list[text]?
157
+ - id: select_domains
158
+ type: list[text]?
159
+ - id: exclude_paths
160
+ type: list[text]?
161
+ - id: exclude_domains
162
+ type: list[text]?
163
+ - id: allow_external
164
+ type: boolean?
165
+ - id: include_images
166
+ type: boolean?
167
+ method: POST
168
+ name: Map website structure
169
+ outputs:
170
+ - id: results
171
+ type: list[schema_4849527888]?
172
+ parameters: []
173
+ type: APITool
174
+ types:
175
+ - description: Generated from OpenAPI schema
176
+ id: schema_4849029360
177
+ properties:
178
+ alt_text: text?
179
+ title: text?
180
+ url: text?
181
+ - description: Generated from OpenAPI schema
182
+ id: schema_4849029792
183
+ properties:
184
+ content: text?
185
+ favicon: text?
186
+ raw_content: text?
187
+ score: float?
188
+ title: text?
189
+ url: text?
190
+ - description: Generated from OpenAPI schema
191
+ id: schema_4849038576
192
+ properties:
193
+ content: text?
194
+ favicon: text?
195
+ title: text?
196
+ url: text?
197
+ - description: Generated from OpenAPI schema
198
+ id: schema_4849041168
199
+ properties:
200
+ error: text?
201
+ url: text?
202
+ - description: Generated from OpenAPI schema
203
+ id: schema_4849520304
204
+ properties:
205
+ content: text?
206
+ favicon: text?
207
+ links: list[text]?
208
+ title: text?
209
+ url: text?
210
+ - description: Generated from OpenAPI schema
211
+ id: schema_4849527888
212
+ properties:
213
+ depth: int?
214
+ links: list[text]?
215
+ title: text?
216
+ url: text?
@@ -9,7 +9,7 @@
9
9
  # Scenario: Analyze a product review to extract structured sentiment
10
10
  #
11
11
  # Run with:
12
- # uv run run -i '{"review_text":"These headphones are amazing! Great sound quality and super comfortable. Battery lasts all day."}' examples/tutorials/03_structured_data.qtype.yaml
12
+ # qtype run -i '{"review_text":"These headphones are amazing! Great sound quality and super comfortable. Battery lasts all day."}' examples/tutorials/03_structured_data.qtype.yaml
13
13
 
14
14
  id: review_sentiment_analyzer
15
15
  description: |
@@ -116,7 +116,7 @@ flows:
116
116
  # Construct builds typed objects from the decoded fields
117
117
  - id: build_result
118
118
  type: Construct
119
- field_mapping:
119
+ field_bindings:
120
120
  sentiment: sentiment
121
121
  confidence: confidence
122
122
  key_points: key_points
@@ -8,7 +8,7 @@
8
8
  # Scenario: Calculate a deadline by adding days to the current time
9
9
  #
10
10
  # Run with:
11
- # uv run qtype run -i '{"days_until_due": 3}' examples/tutorials/04_tools_and_function_calling.qtype.yaml
11
+ # qtype run -i '{"days_until_due": 3}' examples/tutorials/04_tools_and_function_calling.qtype.yaml
12
12
 
13
13
  id: deadline_calculator
14
14
  description: |
@@ -17,7 +17,7 @@ description: |
17
17
 
18
18
  # Import pre-built tools from the commons library
19
19
  references:
20
- - !include https://raw.githubusercontent.com/bazaarvoice/qtype/refs/tags/v0.1.11/common/tools.qtype.yaml
20
+ - !include ../../common/tools.qtype.yaml
21
21
 
22
22
  flows:
23
23
  - id: calculate_deadline
@@ -50,7 +50,7 @@ flows:
50
50
  tool: qtype.application.commons.tools.get_current_timestamp
51
51
  input_bindings: {}
52
52
  output_bindings:
53
- result: current_time
53
+ get_current_timestamp_result: current_time
54
54
  outputs:
55
55
  - current_time
56
56
 
@@ -71,7 +71,7 @@ flows:
71
71
  timestamp: current_time
72
72
  days: days_until_due
73
73
  output_bindings:
74
- result: deadline_time
74
+ timedelta_result: deadline_time
75
75
  outputs:
76
76
  - deadline_time
77
77
 
@@ -84,6 +84,6 @@ flows:
84
84
  timestamp: deadline_time
85
85
  format_string: format_string
86
86
  output_bindings:
87
- result: deadline_formatted
87
+ format_datetime_result: deadline_formatted
88
88
  outputs:
89
89
  - deadline_formatted
@@ -121,15 +121,15 @@ class ReasoningStreamContext:
121
121
  """
122
122
  Async context manager for reasoning streaming.
123
123
 
124
- Automatically emits ReasoningStreamStartEvent on entry and
125
- ReasoningStreamEndEvent on exit. Provides delta() method for emitting
126
- reasoning chunks.
124
+ Only emits ReasoningStreamStartEvent on the first delta() call, and only
125
+ emits ReasoningStreamEndEvent if start was sent. This prevents empty
126
+ reasoning streams when models don't provide reasoning data.
127
127
 
128
128
  Example:
129
129
  ```python
130
130
  async with emitter.reasoning_stream("agent-reasoning") as streamer:
131
131
  async for chunk in agent.stream_reasoning():
132
- await streamer.delta(chunk.text)
132
+ await streamer.delta(chunk.text) # Start event on first call
133
133
  ```
134
134
  """
135
135
 
@@ -142,15 +142,10 @@ class ReasoningStreamContext:
142
142
  self.step = step
143
143
  self.stream_id = stream_id
144
144
  self.on_stream_event = on_stream_event
145
+ self._started = False
145
146
 
146
147
  async def __aenter__(self) -> ReasoningStreamContext:
147
- """Emit ReasoningStreamStartEvent when entering context."""
148
- if self.on_stream_event:
149
- await self.on_stream_event(
150
- ReasoningStreamStartEvent(
151
- step=self.step, stream_id=self.stream_id
152
- )
153
- )
148
+ """Enter context without emitting start event."""
154
149
  return self
155
150
 
156
151
  async def __aexit__(
@@ -159,8 +154,8 @@ class ReasoningStreamContext:
159
154
  exc_val: BaseException | None,
160
155
  exc_tb: Any,
161
156
  ) -> bool:
162
- """Emit ReasoningStreamEndEvent when exiting context."""
163
- if self.on_stream_event:
157
+ """Emit ReasoningStreamEndEvent only if stream was started."""
158
+ if self._started and self.on_stream_event:
164
159
  await self.on_stream_event(
165
160
  ReasoningStreamEndEvent(
166
161
  step=self.step, stream_id=self.stream_id
@@ -172,10 +167,21 @@ class ReasoningStreamContext:
172
167
  """
173
168
  Emit a reasoning delta chunk.
174
169
 
170
+ Sends ReasoningStreamStartEvent on first call, then delta events.
171
+
175
172
  Args:
176
173
  text: The incremental reasoning content to append to the stream
177
174
  """
178
175
  if self.on_stream_event:
176
+ # Emit start event on first delta
177
+ if not self._started:
178
+ await self.on_stream_event(
179
+ ReasoningStreamStartEvent(
180
+ step=self.step, stream_id=self.stream_id
181
+ )
182
+ )
183
+ self._started = True
184
+
179
185
  await self.on_stream_event(
180
186
  ReasoningStreamDeltaEvent(
181
187
  step=self.step,