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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. qtype/` +0 -0
  2. qtype/application/__init__.py +0 -2
  3. qtype/application/converters/tools_from_api.py +28 -22
  4. qtype/application/converters/tools_from_module.py +66 -32
  5. qtype/base/__init__.py +8 -2
  6. qtype/base/logging.py +0 -17
  7. qtype/base/resources.py +193 -0
  8. qtype/cli.py +5 -9
  9. qtype/commands/generate.py +95 -7
  10. qtype/commands/run.py +153 -54
  11. qtype/docs/.pages +8 -0
  12. {docs → qtype/docs}/Concepts/mental-model-and-philosophy.md +1 -1
  13. qtype/docs/Contributing/.pages +4 -0
  14. {docs → qtype/docs}/Contributing/index.md +8 -1
  15. {docs → qtype/docs}/Gallery/dataflow_pipelines.md +18 -4
  16. qtype/docs/Gallery/recipe_chatbot.md +103 -0
  17. qtype/docs/Gallery/recipe_chatbot.mermaid +62 -0
  18. qtype/docs/Gallery/recipe_chatbot.png +0 -0
  19. {docs → qtype/docs}/Gallery/research_assistant.md +4 -5
  20. {docs → qtype/docs}/Gallery/simple_chatbot.md +3 -1
  21. {docs → qtype/docs}/How To/Authentication/configure_aws_authentication.md +2 -2
  22. {docs → qtype/docs}/How To/Authentication/use_api_key_authentication.md +2 -2
  23. {docs → qtype/docs}/How To/Command Line Usage/load_multiple_inputs_from_files.md +24 -9
  24. {docs → qtype/docs}/How To/Command Line Usage/pass_inputs_on_the_cli.md +7 -4
  25. {docs → qtype/docs}/How To/Command Line Usage/serve_with_auto_reload.md +3 -2
  26. {docs → qtype/docs}/How To/Data Processing/adjust_concurrency.md +3 -4
  27. {docs → qtype/docs}/How To/Data Processing/cache_step_results.md +2 -2
  28. {docs → qtype/docs}/How To/Data Processing/decode_json_xml.md +1 -1
  29. {docs → qtype/docs}/How To/Data Processing/explode_collections.md +2 -2
  30. {docs → qtype/docs}/How To/Data Processing/gather_results.md +4 -4
  31. qtype/docs/How To/Data Processing/invoke_other_flows.md +71 -0
  32. qtype/docs/How To/Data Processing/load_data_from_athena.md +49 -0
  33. qtype/docs/How To/Data Processing/load_documents.md +74 -0
  34. qtype/docs/How To/Data Processing/read_data_from_files.md +61 -0
  35. {docs → qtype/docs}/How To/Data Processing/read_sql_databases.md +4 -3
  36. {docs → qtype/docs}/How To/Data Processing/write_data_to_file.md +1 -2
  37. {docs → qtype/docs}/How To/Invoke Models/call_large_language_models.md +1 -1
  38. {docs → qtype/docs}/How To/Invoke Models/create_embeddings.md +1 -1
  39. {docs → qtype/docs}/How To/Invoke Models/reuse_prompts_with_templates.md +2 -3
  40. {docs → qtype/docs}/How To/Language Features/include_raw_text_from_other_files.md +2 -1
  41. {docs → qtype/docs}/How To/Language Features/reference_entities_by_id.md +2 -2
  42. qtype/docs/How To/Language Features/use_agent_skills.md +29 -0
  43. {docs → qtype/docs}/How To/Language Features/use_environment_variables.md +2 -1
  44. qtype/docs/How To/Language Features/use_optional_variables.md +42 -0
  45. {docs → qtype/docs}/How To/Language Features/use_qtype_mcp.md +4 -4
  46. {docs → qtype/docs}/How To/Observability & Debugging/trace_calls_with_open_telemetry.md +1 -1
  47. {docs → qtype/docs}/How To/Observability & Debugging/validate_qtype_yaml.md +3 -2
  48. {docs → qtype/docs}/How To/Observability & Debugging/visualize_application_architecture.md +1 -1
  49. {docs → qtype/docs}/How To/Qtype Server/serve_flows_as_apis.md +3 -3
  50. {docs → qtype/docs}/How To/Qtype Server/serve_flows_as_ui.md +2 -3
  51. {docs → qtype/docs}/How To/Qtype Server/use_conversational_interfaces.md +1 -4
  52. {docs → qtype/docs}/How To/Qtype Server/use_variables_with_ui_hints.md +3 -2
  53. {docs → qtype/docs}/How To/Tools & Integration/bind_tool_inputs_and_outputs.md +1 -2
  54. {docs → qtype/docs}/How To/Tools & Integration/create_tools_from_openapi_specifications.md +10 -14
  55. {docs → qtype/docs}/How To/Tools & Integration/create_tools_from_python_modules.md +5 -8
  56. {docs → qtype/docs}/Reference/cli.md +16 -17
  57. qtype/docs/Tutorials/.pages +1 -0
  58. {docs → qtype/docs}/Tutorials/01-first-qtype-application.md +4 -3
  59. {docs → qtype/docs}/Tutorials/02-conversational-chatbot.md +3 -3
  60. {docs → qtype/docs}/Tutorials/03-structured-data.md +10 -11
  61. {docs → qtype/docs}/Tutorials/04-tools-and-function-calling.md +13 -20
  62. {docs → qtype/docs}/components/APITool.md +1 -1
  63. qtype/docs/components/Aggregate.md +7 -0
  64. qtype/docs/components/Collect.md +6 -0
  65. qtype/docs/components/Construct.md +6 -0
  66. {docs → qtype/docs}/components/DocumentEmbedder.md +0 -1
  67. {docs → qtype/docs}/components/DocumentSplitter.md +0 -1
  68. qtype/docs/components/Explode.md +5 -0
  69. {docs → qtype/docs}/components/FieldExtractor.md +2 -1
  70. qtype/docs/components/InvokeFlow.md +8 -0
  71. qtype/docs/components/InvokeTool.md +8 -0
  72. {docs → qtype/docs}/components/PrimitiveTypeEnum.md +0 -1
  73. {docs → qtype/docs}/components/Source.md +0 -1
  74. {docs → qtype/docs}/components/Step.md +0 -1
  75. {docs → qtype/docs}/components/Tool.md +2 -2
  76. {docs → qtype/docs}/components/Variable.md +2 -0
  77. qtype/docs/legacy_how_tos/.pages +6 -0
  78. qtype/docs/skills/architect/SKILL.md +188 -0
  79. qtype/docs/skills/architect/references/cheatsheet.md +198 -0
  80. qtype/docs/skills/architect/references/patterns.md +29 -0
  81. qtype/docs/stylesheets/extra.css +27 -0
  82. qtype/dsl/linker.py +8 -0
  83. qtype/dsl/model.py +177 -84
  84. qtype/examples/conversational_ai/simple_chatbot_with_auth.qtype.yaml +48 -0
  85. qtype/examples/data_processing/athena_query.qtype.yaml +56 -0
  86. qtype/examples/data_processing/batch_inputs.csv +5 -0
  87. qtype/examples/data_processing/create_sample_db.py +129 -0
  88. qtype/examples/data_processing/invoke_other_flows.qtype.yaml +98 -0
  89. qtype/examples/data_processing/load_documents.qtype.yaml +31 -0
  90. qtype/examples/data_processing/reviews.db +0 -0
  91. qtype/examples/data_processing/sample_article.txt +1 -0
  92. qtype/examples/data_processing/sample_documents.jsonl +5 -0
  93. qtype/examples/invoke_models/invoke_embedding_aws.qtype.yaml +45 -0
  94. qtype/examples/language_features/optional_variables.qtype.yaml +32 -0
  95. qtype/examples/language_features/story_prompt.txt +6 -0
  96. qtype/examples/legacy/data/customers.csv +6 -0
  97. qtype/examples/legacy/echo/readme.md +29 -0
  98. qtype/examples/legacy/qtype_plugin_example.py +51 -0
  99. qtype/examples/legacy/sample_data.txt +43 -0
  100. qtype/examples/legacy/vertex/README.md +11 -0
  101. qtype/examples/rag/recipe_chatbot.qtype.yaml +216 -0
  102. qtype/examples/research_assistant/tavily.qtype.yaml +216 -0
  103. {examples → qtype/examples}/tutorials/03_structured_data.qtype.yaml +2 -2
  104. {examples → qtype/examples}/tutorials/04_tools_and_function_calling.qtype.yaml +5 -5
  105. qtype/interpreter/auth/aws.py +94 -17
  106. qtype/interpreter/auth/generic.py +11 -12
  107. qtype/interpreter/base/secrets.py +4 -2
  108. qtype/interpreter/base/stream_emitter.py +19 -13
  109. qtype/interpreter/conversions.py +15 -14
  110. qtype/interpreter/converters.py +142 -26
  111. qtype/interpreter/executors/agent_executor.py +2 -3
  112. qtype/interpreter/executors/aggregate_executor.py +3 -4
  113. qtype/interpreter/executors/bedrock_reranker_executor.py +17 -28
  114. qtype/interpreter/executors/construct_executor.py +15 -15
  115. qtype/interpreter/executors/doc_to_text_executor.py +1 -3
  116. qtype/interpreter/executors/document_embedder_executor.py +1 -12
  117. qtype/interpreter/executors/field_extractor_executor.py +13 -12
  118. qtype/interpreter/executors/file_source_executor.py +18 -31
  119. qtype/interpreter/executors/invoke_embedding_executor.py +24 -37
  120. qtype/interpreter/executors/invoke_flow_executor.py +2 -2
  121. qtype/interpreter/executors/invoke_tool_executor.py +19 -18
  122. qtype/interpreter/executors/llm_inference_executor.py +18 -18
  123. qtype/interpreter/executors/prompt_template_executor.py +1 -3
  124. qtype/interpreter/executors/sql_source_executor.py +6 -2
  125. qtype/interpreter/flow.py +11 -1
  126. qtype/interpreter/tools/function_tool_helper.py +11 -10
  127. qtype/interpreter/types.py +89 -4
  128. qtype/interpreter/typing.py +31 -32
  129. qtype/mcp/server.py +194 -86
  130. {schema → qtype/schema}/qtype.schema.json +77 -79
  131. qtype/semantic/checker.py +19 -0
  132. qtype/semantic/generate.py +3 -6
  133. qtype/semantic/model.py +26 -33
  134. qtype/semantic/resolver.py +7 -0
  135. qtype/semantic/visualize.py +18 -6
  136. {qtype-0.1.12.dist-info → qtype-0.1.14.dist-info}/METADATA +47 -46
  137. qtype-0.1.14.dist-info/RECORD +361 -0
  138. {qtype-0.1.12.dist-info → qtype-0.1.14.dist-info}/WHEEL +1 -2
  139. docs/How To/Data Processing/read_data_from_files.md +0 -35
  140. docs/components/Aggregate.md +0 -8
  141. docs/components/InvokeFlow.md +0 -8
  142. docs/components/InvokeTool.md +0 -8
  143. docs/components/ToolParameter.md +0 -6
  144. examples/research_assistant/tavily.qtype.yaml +0 -289
  145. qtype/application/facade.py +0 -177
  146. qtype-0.1.12.dist-info/RECORD +0 -325
  147. qtype-0.1.12.dist-info/top_level.txt +0 -1
  148. {docs → qtype/docs}/Contributing/roadmap.md +0 -0
  149. {docs → qtype/docs}/Decisions/ADR-001-Chat-vs-Completion-Endpoint-Features.md +0 -0
  150. {docs → qtype/docs}/Gallery/dataflow_pipelines.mermaid +0 -0
  151. {docs → qtype/docs}/Gallery/research_assistant.mermaid +0 -0
  152. {docs → qtype/docs}/Gallery/simple_chatbot.mermaid +0 -0
  153. {docs → qtype/docs}/How To/Language Features/include_qtype_yaml.md +0 -0
  154. {docs → qtype/docs}/How To/Observability & Debugging/visualize_example.mermaid +0 -0
  155. {docs → qtype/docs}/How To/Qtype Server/flow_as_ui.png +0 -0
  156. {docs → qtype/docs}/Reference/plugins.md +0 -0
  157. {docs → qtype/docs}/Reference/semantic-validation-rules.md +0 -0
  158. {docs → qtype/docs}/Tutorials/example_chat.png +0 -0
  159. {docs → qtype/docs}/Tutorials/index.md +0 -0
  160. {docs → qtype/docs}/components/APIKeyAuthProvider.md +0 -0
  161. {docs → qtype/docs}/components/AWSAuthProvider.md +0 -0
  162. {docs → qtype/docs}/components/AWSSecretManager.md +0 -0
  163. {docs → qtype/docs}/components/Agent.md +0 -0
  164. {docs → qtype/docs}/components/AggregateStats.md +0 -0
  165. {docs → qtype/docs}/components/Application.md +0 -0
  166. {docs → qtype/docs}/components/AuthorizationProvider.md +0 -0
  167. {docs → qtype/docs}/components/AuthorizationProviderList.md +0 -0
  168. {docs → qtype/docs}/components/BearerTokenAuthProvider.md +0 -0
  169. {docs → qtype/docs}/components/BedrockReranker.md +0 -0
  170. {docs → qtype/docs}/components/ChatContent.md +0 -0
  171. {docs → qtype/docs}/components/ChatMessage.md +0 -0
  172. {docs → qtype/docs}/components/ConstantPath.md +0 -0
  173. {docs → qtype/docs}/components/CustomType.md +0 -0
  174. {docs → qtype/docs}/components/Decoder.md +0 -0
  175. {docs → qtype/docs}/components/DecoderFormat.md +0 -0
  176. {docs → qtype/docs}/components/DocToTextConverter.md +0 -0
  177. {docs → qtype/docs}/components/Document.md +0 -0
  178. {docs → qtype/docs}/components/DocumentIndex.md +0 -0
  179. {docs → qtype/docs}/components/DocumentSearch.md +0 -0
  180. {docs → qtype/docs}/components/DocumentSource.md +0 -0
  181. {docs → qtype/docs}/components/Echo.md +0 -0
  182. {docs → qtype/docs}/components/Embedding.md +0 -0
  183. {docs → qtype/docs}/components/EmbeddingModel.md +0 -0
  184. {docs → qtype/docs}/components/FileSource.md +0 -0
  185. {docs → qtype/docs}/components/FileWriter.md +0 -0
  186. {docs → qtype/docs}/components/Flow.md +0 -0
  187. {docs → qtype/docs}/components/FlowInterface.md +0 -0
  188. {docs → qtype/docs}/components/Index.md +0 -0
  189. {docs → qtype/docs}/components/IndexUpsert.md +0 -0
  190. {docs → qtype/docs}/components/InvokeEmbedding.md +0 -0
  191. {docs → qtype/docs}/components/LLMInference.md +0 -0
  192. {docs → qtype/docs}/components/ListType.md +0 -0
  193. {docs → qtype/docs}/components/Memory.md +0 -0
  194. {docs → qtype/docs}/components/MessageRole.md +0 -0
  195. {docs → qtype/docs}/components/Model.md +0 -0
  196. {docs → qtype/docs}/components/ModelList.md +0 -0
  197. {docs → qtype/docs}/components/OAuth2AuthProvider.md +0 -0
  198. {docs → qtype/docs}/components/PromptTemplate.md +0 -0
  199. {docs → qtype/docs}/components/PythonFunctionTool.md +0 -0
  200. {docs → qtype/docs}/components/RAGChunk.md +0 -0
  201. {docs → qtype/docs}/components/RAGDocument.md +0 -0
  202. {docs → qtype/docs}/components/RAGSearchResult.md +0 -0
  203. {docs → qtype/docs}/components/Reranker.md +0 -0
  204. {docs → qtype/docs}/components/SQLSource.md +0 -0
  205. {docs → qtype/docs}/components/Search.md +0 -0
  206. {docs → qtype/docs}/components/SearchResult.md +0 -0
  207. {docs → qtype/docs}/components/SecretManager.md +0 -0
  208. {docs → qtype/docs}/components/SecretReference.md +0 -0
  209. {docs → qtype/docs}/components/TelemetrySink.md +0 -0
  210. {docs → qtype/docs}/components/ToolList.md +0 -0
  211. {docs → qtype/docs}/components/TypeList.md +0 -0
  212. {docs → qtype/docs}/components/VariableList.md +0 -0
  213. {docs → qtype/docs}/components/VectorIndex.md +0 -0
  214. {docs → qtype/docs}/components/VectorSearch.md +0 -0
  215. {docs → qtype/docs}/components/VertexAuthProvider.md +0 -0
  216. {docs → qtype/docs}/components/Writer.md +0 -0
  217. {docs → qtype/docs}/example_ui.png +0 -0
  218. {docs → qtype/docs}/index.md +0 -0
  219. {docs → qtype/docs}/legacy_how_tos/Configuration/modular-yaml.md +0 -0
  220. {docs → qtype/docs}/legacy_how_tos/Configuration/phoenix_projects.png +0 -0
  221. {docs → qtype/docs}/legacy_how_tos/Configuration/phoenix_traces.png +0 -0
  222. {docs → qtype/docs}/legacy_how_tos/Configuration/reference-by-id.md +0 -0
  223. {docs → qtype/docs}/legacy_how_tos/Configuration/telemetry-setup.md +0 -0
  224. {docs → qtype/docs}/legacy_how_tos/Data Types/custom-types.md +0 -0
  225. {docs → qtype/docs}/legacy_how_tos/Data Types/domain-types.md +0 -0
  226. {docs → qtype/docs}/legacy_how_tos/Debugging/visualize-apps.md +0 -0
  227. {docs → qtype/docs}/legacy_how_tos/Tools/api-tools.md +0 -0
  228. {docs → qtype/docs}/legacy_how_tos/Tools/python-tools.md +0 -0
  229. {examples → qtype/examples}/authentication/aws_authentication.qtype.yaml +0 -0
  230. {examples → qtype/examples}/conversational_ai/hello_world_chat.qtype.yaml +0 -0
  231. {examples → qtype/examples}/conversational_ai/simple_chatbot.qtype.yaml +0 -0
  232. {examples → qtype/examples}/data_processing/batch_processing.qtype.yaml +0 -0
  233. {examples → qtype/examples}/data_processing/cache_step_results.qtype.yaml +0 -0
  234. {examples → qtype/examples}/data_processing/collect_results.qtype.yaml +0 -0
  235. {examples → qtype/examples}/data_processing/dataflow_pipelines.qtype.yaml +0 -0
  236. {examples → qtype/examples}/data_processing/decode_json.qtype.yaml +0 -0
  237. {examples → qtype/examples}/data_processing/explode_items.qtype.yaml +0 -0
  238. {examples → qtype/examples}/data_processing/read_file.qtype.yaml +0 -0
  239. {examples → qtype/examples}/invoke_models/create_embeddings.qtype.yaml +0 -0
  240. {examples → qtype/examples}/invoke_models/simple_llm_call.qtype.yaml +0 -0
  241. {examples → qtype/examples}/language_features/include_raw.qtype.yaml +0 -0
  242. {examples → qtype/examples}/language_features/ui_hints.qtype.yaml +0 -0
  243. {examples → qtype/examples}/legacy/bedrock/data_analysis_with_telemetry.qtype.yaml +0 -0
  244. {examples → qtype/examples}/legacy/bedrock/hello_world.qtype.yaml +0 -0
  245. {examples → qtype/examples}/legacy/bedrock/hello_world_chat.qtype.yaml +0 -0
  246. {examples → qtype/examples}/legacy/bedrock/hello_world_chat_with_telemetry.qtype.yaml +0 -0
  247. {examples → qtype/examples}/legacy/bedrock/hello_world_chat_with_thinking.qtype.yaml +0 -0
  248. {examples → qtype/examples}/legacy/bedrock/hello_world_completion.qtype.yaml +0 -0
  249. {examples → qtype/examples}/legacy/bedrock/hello_world_completion_with_auth.qtype.yaml +0 -0
  250. {examples → qtype/examples}/legacy/bedrock/simple_agent_chat.qtype.yaml +0 -0
  251. {examples → qtype/examples}/legacy/chat_with_langfuse.qtype.yaml +0 -0
  252. {examples → qtype/examples}/legacy/data_processor.qtype.yaml +0 -0
  253. {examples → qtype/examples}/legacy/echo/debug_example.qtype.yaml +0 -0
  254. {examples → qtype/examples}/legacy/echo/prompt.qtype.yaml +0 -0
  255. {examples → qtype/examples}/legacy/echo/test.qtype.yaml +0 -0
  256. {examples → qtype/examples}/legacy/echo/video.qtype.yaml +0 -0
  257. {examples → qtype/examples}/legacy/field_extractor_example.qtype.yaml +0 -0
  258. {examples → qtype/examples}/legacy/multi_flow_example.qtype.yaml +0 -0
  259. {examples → qtype/examples}/legacy/openai/hello_world_chat.qtype.yaml +0 -0
  260. {examples → qtype/examples}/legacy/openai/hello_world_chat_with_telemetry.qtype.yaml +0 -0
  261. {examples → qtype/examples}/legacy/rag.qtype.yaml +0 -0
  262. {examples → qtype/examples}/legacy/time_utilities.qtype.yaml +0 -0
  263. {examples → qtype/examples}/legacy/vertex/hello_world_chat.qtype.yaml +0 -0
  264. {examples → qtype/examples}/legacy/vertex/hello_world_completion.qtype.yaml +0 -0
  265. {examples → qtype/examples}/legacy/vertex/hello_world_completion_with_auth.qtype.yaml +0 -0
  266. {examples → qtype/examples}/observability_debugging/trace_with_opentelemetry.qtype.yaml +0 -0
  267. {examples → qtype/examples}/research_assistant/research_assistant.qtype.yaml +0 -0
  268. {examples → qtype/examples}/research_assistant/tavily.oas.yaml +0 -0
  269. {examples → qtype/examples}/tutorials/01_hello_world.qtype.yaml +0 -0
  270. {examples → qtype/examples}/tutorials/02_conversational_chat.qtype.yaml +0 -0
  271. {qtype-0.1.12.dist-info → qtype-0.1.14.dist-info}/entry_points.txt +0 -0
  272. {qtype-0.1.12.dist-info → qtype-0.1.14.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,98 @@
1
+ id: text_analysis_pipeline
2
+ description: Demonstrates invoking reusable flows for text analysis
3
+
4
+ models:
5
+ - type: Model
6
+ id: nova_lite
7
+ provider: aws-bedrock
8
+ model_id: amazon.nova-lite-v1:0
9
+
10
+ flows:
11
+ # Reusable flow for text summarization
12
+ - type: Flow
13
+ id: summarize_text
14
+ description: Summarizes input text
15
+ variables:
16
+ - id: input_text
17
+ type: text
18
+ - id: output_summary
19
+ type: text
20
+ inputs:
21
+ - input_text
22
+ outputs:
23
+ - output_summary
24
+ steps:
25
+ - type: LLMInference
26
+ id: summarize_step
27
+ model: nova_lite
28
+ system_message: "You provide concise summaries."
29
+ inputs: [input_text]
30
+ outputs: [output_summary]
31
+
32
+ # Reusable flow for sentiment analysis
33
+ - type: Flow
34
+ id: analyze_sentiment
35
+ description: Analyzes sentiment of text
36
+ variables:
37
+ - id: input_for_sentiment
38
+ type: text
39
+ - id: output_sentiment
40
+ type: text
41
+ inputs:
42
+ - input_for_sentiment
43
+ outputs:
44
+ - output_sentiment
45
+ steps:
46
+ - type: LLMInference
47
+ id: sentiment_step
48
+ model: nova_lite
49
+ system_message: "Analyze sentiment. Respond with only: positive, negative, or neutral."
50
+ inputs: [input_for_sentiment]
51
+ outputs: [output_sentiment]
52
+
53
+ # Main processing flow
54
+ - type: Flow
55
+ id: main
56
+ description: Orchestrates text analysis using multiple flows
57
+ variables:
58
+ - id: article_text
59
+ type: text
60
+ - id: summary
61
+ type: text
62
+ - id: sentiment
63
+ type: text
64
+ - id: report
65
+ type: text
66
+ inputs:
67
+ - article_text
68
+ outputs:
69
+ - report
70
+ steps:
71
+ # Invoke summarization flow
72
+ - type: InvokeFlow
73
+ id: get_summary
74
+ flow: summarize_text
75
+ input_bindings:
76
+ input_text: article_text
77
+ output_bindings:
78
+ output_summary: summary
79
+
80
+ # Invoke sentiment analysis flow
81
+ - type: InvokeFlow
82
+ id: get_sentiment
83
+ flow: analyze_sentiment
84
+ input_bindings:
85
+ input_for_sentiment: article_text
86
+ output_bindings:
87
+ output_sentiment: sentiment
88
+
89
+ # Combine results into a report
90
+ - type: PromptTemplate
91
+ id: create_report
92
+ template: |
93
+ Analysis Report
94
+ ---------------
95
+ Sentiment: {sentiment}
96
+ Summary: {summary}
97
+ inputs: [summary, sentiment]
98
+ outputs: [report]
@@ -0,0 +1,31 @@
1
+ # Load all markdown files from docs directory using DocumentSource
2
+ #
3
+ # This example demonstrates using DocumentSource with SimpleDirectoryReader
4
+ # to load documents from a local directory with file filtering.
5
+
6
+ id: load_documents_example
7
+ description: Load markdown files from docs directory
8
+
9
+ flows:
10
+ - type: Flow
11
+ id: load_md_files
12
+ description: Load all markdown files from docs directory
13
+
14
+ variables:
15
+ - id: document
16
+ type: RAGDocument
17
+
18
+ inputs: []
19
+ outputs:
20
+ - document
21
+
22
+ steps:
23
+ - type: DocumentSource
24
+ id: md_docs
25
+ reader_module: llama_index.core.SimpleDirectoryReader
26
+ args:
27
+ input_dir: docs
28
+ required_exts: [".md"]
29
+ recursive: true
30
+ outputs:
31
+ - document
@@ -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,45 @@
1
+ id: invoke_embedding_test
2
+ description: Test InvokeEmbedding step with AWS Bedrock embeddings
3
+
4
+ # AWS Authentication for Bedrock
5
+ auths:
6
+ - type: aws
7
+ id: aws_auth
8
+ profile_name: ${AWS_PROFILE}
9
+
10
+ models:
11
+ # Embedding model using AWS Bedrock
12
+ - type: EmbeddingModel
13
+ id: titan_embed
14
+ provider: aws-bedrock
15
+ model_id: amazon.titan-embed-text-v2:0
16
+ dimensions: 1024
17
+ auth: aws_auth
18
+
19
+ flows:
20
+ - type: Flow
21
+ id: test_invoke_embedding
22
+ description: Generate embeddings for text using AWS Bedrock
23
+
24
+ variables:
25
+ - id: input_text
26
+ type: text
27
+ ui:
28
+ widget: textarea
29
+ - id: embedding
30
+ type: Embedding
31
+
32
+ inputs:
33
+ - input_text
34
+
35
+ outputs:
36
+ - embedding
37
+
38
+ steps:
39
+ - id: generate_embedding
40
+ type: InvokeEmbedding
41
+ model: titan_embed
42
+ inputs:
43
+ - input_text
44
+ outputs:
45
+ - embedding
@@ -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
+ id: recipe_rag_chatbot
2
+ description: |
3
+ RAG chatbot for the Chowdown recipe collection from GitHub.
4
+
5
+ This application provides two flows:
6
+
7
+ 1. recipe_chat: Conversational chatbot that answers questions about recipes
8
+ - Uses RAG to find relevant recipes based on user questions
9
+ - Maintains conversation history with memory
10
+ - Provides cooking advice, recipe recommendations, and ingredient information
11
+
12
+ 2. recipe_ingestion: Ingests recipe markdown files into vector database
13
+ - Clones/fetches recipes from GitHub (clarklab/chowdown)
14
+ - Splits recipe documents into searchable chunks
15
+ - Generates embeddings using AWS Bedrock Titan
16
+ - Stores in Qdrant vector database for fast similarity search
17
+
18
+ Prerequisites:
19
+ - AWS credentials configured (AWS_PROFILE environment variable)
20
+ - Qdrant running locally on port 6333 (or update args for Qdrant Cloud)
21
+ - Clone the recipe repo: git clone https://github.com/clarklab/chowdown.git
22
+
23
+ To ingest recipes:
24
+ qtype run recipe_chatbot.qtype.yaml --flow recipe_ingestion
25
+
26
+ To start chatbot:
27
+ qtype serve recipe_chatbot.qtype.yaml --flow recipe_chat
28
+
29
+ # AWS Authentication for Bedrock
30
+ auths:
31
+ - type: aws
32
+ id: aws_auth
33
+ profile_name: ${AWS_PROFILE}
34
+
35
+ # Models
36
+ models:
37
+ # Embedding model for vectorizing recipes and queries
38
+ - type: EmbeddingModel
39
+ id: titan_embed
40
+ provider: aws-bedrock
41
+ model_id: amazon.titan-embed-text-v2:0
42
+ dimensions: 1024
43
+ auth: aws_auth
44
+
45
+ # Chat model for conversational responses
46
+ - type: Model
47
+ id: claude_sonnet
48
+ provider: aws-bedrock
49
+ model_id: us.anthropic.claude-3-5-sonnet-20241022-v2:0
50
+ inference_params:
51
+ temperature: 0.7
52
+ max_tokens: 4096
53
+ auth: aws_auth
54
+
55
+ # Vector index for recipe embeddings
56
+ indexes:
57
+ - type: VectorIndex
58
+ module: llama_index.vector_stores.qdrant.QdrantVectorStore
59
+ id: recipe_index
60
+ name: chowdown_recipes
61
+ embedding_model: titan_embed
62
+ args:
63
+ collection_name: chowdown_recipes
64
+ url: http://localhost:6333
65
+ api_key: "" # Empty for local Qdrant
66
+
67
+ # Memory for maintaining conversation context
68
+ memories:
69
+ - id: recipe_chat_memory
70
+ token_limit: 10000
71
+ chat_history_token_ratio: 0.7
72
+
73
+ # Flows
74
+ flows:
75
+ # Conversational chatbot flow
76
+ - type: Flow
77
+ id: recipe_chat
78
+ description: Chat with the recipe collection using RAG
79
+
80
+ interface:
81
+ type: Conversational
82
+
83
+ variables:
84
+ - id: user_message
85
+ type: ChatMessage
86
+ - id: user_question
87
+ type: text
88
+ - id: search_results
89
+ type: list[RAGSearchResult]
90
+ - id: context_prompt
91
+ type: text
92
+ - id: assistant_response
93
+ type: ChatMessage
94
+
95
+ inputs:
96
+ - user_message
97
+
98
+ outputs:
99
+ - assistant_response
100
+
101
+ steps:
102
+ # Extract text from user's chat message
103
+ - id: extract_question
104
+ type: FieldExtractor
105
+ json_path: "$.blocks[?(@.type == 'text')].content"
106
+ inputs:
107
+ - user_message
108
+ outputs:
109
+ - user_question
110
+
111
+ # Search recipe vector index for relevant recipes
112
+ - id: search_recipes
113
+ type: VectorSearch
114
+ index: recipe_index
115
+ default_top_k: 5
116
+ inputs:
117
+ - user_question
118
+ outputs:
119
+ - search_results
120
+
121
+ # Build prompt with recipe context
122
+ - id: build_context_prompt
123
+ type: PromptTemplate
124
+ template: |
125
+ You are a helpful cooking assistant with access to a collection of recipes from Chowdown.
126
+
127
+ Here are the most relevant recipes based on the user's question:
128
+
129
+ {search_results}
130
+
131
+ User question: {user_question}
132
+
133
+ Please provide a helpful answer based on the recipes above. If you're suggesting a recipe,
134
+ include key ingredients and brief cooking instructions. If the recipes don't contain
135
+ relevant information, politely say so and offer general cooking advice if appropriate.
136
+ inputs:
137
+ - search_results
138
+ - user_question
139
+ outputs:
140
+ - context_prompt
141
+
142
+ # Generate conversational response using LLM with memory
143
+ - id: generate_response
144
+ type: LLMInference
145
+ model: claude_sonnet
146
+ memory: recipe_chat_memory
147
+ system_message: |
148
+ You are a friendly and knowledgeable cooking assistant. You help users find recipes,
149
+ answer questions about ingredients, suggest substitutions, and provide cooking tips.
150
+ Base your answers on the provided recipe context, but feel free to add general
151
+ cooking knowledge when helpful. Be conversational and enthusiastic about food!
152
+ inputs:
153
+ - context_prompt
154
+ outputs:
155
+ - assistant_response
156
+
157
+ # Recipe ingestion flow
158
+ - type: Flow
159
+ id: recipe_ingestion
160
+ description: Load recipes from local GitHub clone, chunk, embed, and index
161
+
162
+ variables:
163
+ - id: recipe_document
164
+ type: RAGDocument
165
+ - id: recipe_chunk
166
+ type: RAGChunk
167
+ - id: embedded_chunk
168
+ type: RAGChunk
169
+
170
+ outputs:
171
+ - embedded_chunk
172
+
173
+ steps:
174
+ # Load recipe markdown files from local clone
175
+ - id: load_recipes
176
+ type: DocumentSource
177
+ reader_module: llama_index.core.SimpleDirectoryReader
178
+ args:
179
+ input_dir: "./chowdown/_recipes"
180
+ recursive: false
181
+ required_exts: [".md"]
182
+ outputs:
183
+ - recipe_document
184
+
185
+ # Split recipes into chunks for better retrieval
186
+ - id: split_recipes
187
+ type: DocumentSplitter
188
+ splitter_name: "SentenceSplitter"
189
+ chunk_size: 512
190
+ chunk_overlap: 50
191
+ inputs:
192
+ - recipe_document
193
+ outputs:
194
+ - recipe_chunk
195
+
196
+ # Generate embeddings for each chunk
197
+ - id: embed_chunks
198
+ type: DocumentEmbedder
199
+ model: titan_embed
200
+ concurrency_config:
201
+ num_workers: 5
202
+ inputs:
203
+ - recipe_chunk
204
+ outputs:
205
+ - embedded_chunk
206
+
207
+ # Store embedded chunks in Qdrant
208
+ - id: index_recipes
209
+ type: IndexUpsert
210
+ index: recipe_index
211
+ batch_config:
212
+ batch_size: 25
213
+ inputs:
214
+ - embedded_chunk
215
+ outputs:
216
+ - embedded_chunk