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
@@ -1,289 +0,0 @@
1
- auths:
2
- - id: tavily-api_bearerauth_token
3
- token: ${TAVILY-API_BEARER}
4
- type: bearer_token
5
- description: Tools created from API specification tavily.oas.yaml
6
- flows: []
7
- id: tavily-api
8
- indexes: []
9
- memories: []
10
- models: []
11
- references: []
12
- tools:
13
- - auth: tavily-api_bearerauth_token
14
- description: 'Perform a web search with various filtering and customization options.
15
- Returns search results with content, URLs, scores, and optional answers. '
16
- endpoint: https://api.tavily.com/search
17
- headers: {}
18
- id: search
19
- inputs:
20
- auto_parameters:
21
- optional: true
22
- type: boolean
23
- country:
24
- optional: true
25
- type: text
26
- days:
27
- optional: true
28
- type: int
29
- end_date:
30
- optional: true
31
- type: text
32
- exclude_domains:
33
- optional: true
34
- type:
35
- element_type: text
36
- include_answer:
37
- optional: true
38
- type: text
39
- include_domains:
40
- optional: true
41
- type:
42
- element_type: text
43
- include_favicon:
44
- optional: true
45
- type: boolean
46
- include_images:
47
- optional: true
48
- type: boolean
49
- include_raw_content:
50
- optional: true
51
- type: text
52
- max_results:
53
- optional: true
54
- type: int
55
- query:
56
- optional: false
57
- type: text
58
- search_depth:
59
- optional: true
60
- type: text
61
- start_date:
62
- optional: true
63
- type: text
64
- time_range:
65
- optional: true
66
- type: text
67
- topic:
68
- optional: true
69
- type: text
70
- method: POST
71
- name: Search the web
72
- outputs:
73
- answer:
74
- optional: true
75
- type: text
76
- follow_up_questions:
77
- optional: true
78
- type:
79
- element_type: text
80
- images:
81
- optional: true
82
- type:
83
- element_type: schema_4844015520
84
- query:
85
- optional: true
86
- type: text
87
- response_time:
88
- optional: true
89
- type: float
90
- results:
91
- optional: true
92
- type:
93
- element_type: schema_4844016144
94
- parameters: {}
95
- type: APITool
96
- - auth: tavily-api_bearerauth_token
97
- description: 'Extract and process content from one or more URLs with various formatting
98
- options. Returns extracted content in text or markdown format. '
99
- endpoint: https://api.tavily.com/extract
100
- headers: {}
101
- id: extract
102
- inputs:
103
- extract_depth:
104
- optional: true
105
- type: text
106
- format:
107
- optional: true
108
- type: text
109
- include_favicon:
110
- optional: true
111
- type: boolean
112
- include_images:
113
- optional: true
114
- type: boolean
115
- urls:
116
- optional: false
117
- type:
118
- element_type: text
119
- method: POST
120
- name: Extract content from URLs
121
- outputs:
122
- failed_results:
123
- optional: true
124
- type:
125
- element_type: schema_4844027472
126
- results:
127
- optional: true
128
- type:
129
- element_type: schema_4844024880
130
- parameters: {}
131
- type: APITool
132
- - auth: tavily-api_bearerauth_token
133
- description: 'Crawl a website starting from a given URL with depth and breadth controls.
134
- Extract content from discovered pages with various filtering options. '
135
- endpoint: https://api.tavily.com/crawl
136
- headers: {}
137
- id: crawl
138
- inputs:
139
- allow_external:
140
- optional: true
141
- type: boolean
142
- exclude_domains:
143
- optional: true
144
- type:
145
- element_type: text
146
- exclude_paths:
147
- optional: true
148
- type:
149
- element_type: text
150
- extract_depth:
151
- optional: true
152
- type: text
153
- format:
154
- optional: true
155
- type: text
156
- include_favicon:
157
- optional: true
158
- type: boolean
159
- include_images:
160
- optional: true
161
- type: boolean
162
- instructions:
163
- optional: true
164
- type: text
165
- limit:
166
- optional: true
167
- type: int
168
- max_breadth:
169
- optional: true
170
- type: int
171
- max_depth:
172
- optional: true
173
- type: int
174
- select_domains:
175
- optional: true
176
- type:
177
- element_type: text
178
- select_paths:
179
- optional: true
180
- type:
181
- element_type: text
182
- url:
183
- optional: false
184
- type: text
185
- method: POST
186
- name: Crawl websites
187
- outputs:
188
- results:
189
- optional: true
190
- type:
191
- element_type: schema_4844408352
192
- parameters: {}
193
- type: APITool
194
- - auth: tavily-api_bearerauth_token
195
- description: "Map the structure and links of a website starting from a given URL.
196
- Discover the website's architecture and page hierarchy. "
197
- endpoint: https://api.tavily.com/map
198
- headers: {}
199
- id: map
200
- inputs:
201
- allow_external:
202
- optional: true
203
- type: boolean
204
- exclude_domains:
205
- optional: true
206
- type:
207
- element_type: text
208
- exclude_paths:
209
- optional: true
210
- type:
211
- element_type: text
212
- include_images:
213
- optional: true
214
- type: boolean
215
- instructions:
216
- optional: true
217
- type: text
218
- limit:
219
- optional: true
220
- type: int
221
- max_breadth:
222
- optional: true
223
- type: int
224
- max_depth:
225
- optional: true
226
- type: int
227
- select_domains:
228
- optional: true
229
- type:
230
- element_type: text
231
- select_paths:
232
- optional: true
233
- type:
234
- element_type: text
235
- url:
236
- optional: false
237
- type: text
238
- method: POST
239
- name: Map website structure
240
- outputs:
241
- results:
242
- optional: true
243
- type:
244
- element_type: schema_4844415936
245
- parameters: {}
246
- type: APITool
247
- types:
248
- - description: Generated from OpenAPI schema
249
- id: schema_4844015520
250
- properties:
251
- alt_text: text?
252
- title: text?
253
- url: text?
254
- - description: Generated from OpenAPI schema
255
- id: schema_4844016144
256
- properties:
257
- content: text?
258
- favicon: text?
259
- raw_content: text?
260
- score: float?
261
- title: text?
262
- url: text?
263
- - description: Generated from OpenAPI schema
264
- id: schema_4844024880
265
- properties:
266
- content: text?
267
- favicon: text?
268
- title: text?
269
- url: text?
270
- - description: Generated from OpenAPI schema
271
- id: schema_4844027472
272
- properties:
273
- error: text?
274
- url: text?
275
- - description: Generated from OpenAPI schema
276
- id: schema_4844408352
277
- properties:
278
- content: text?
279
- favicon: text?
280
- links: list[text]?
281
- title: text?
282
- url: text?
283
- - description: Generated from OpenAPI schema
284
- id: schema_4844415936
285
- properties:
286
- depth: int?
287
- links: list[text]?
288
- title: text?
289
- url: text?
@@ -1,177 +0,0 @@
1
- """Main facade for qtype operations."""
2
-
3
- from __future__ import annotations
4
-
5
- import logging
6
- from pathlib import Path
7
- from typing import Any
8
-
9
- from qtype.base.types import PathLike
10
- from qtype.semantic.model import Application as SemanticApplication
11
- from qtype.semantic.model import DocumentType as SemanticDocumentType
12
-
13
- # Note: There should be _zero_ imports here at the top that import qtype.interpreter.
14
- # That's the whole point of this facade - to avoid importing optional
15
- # dependencies unless these methods are called.
16
-
17
- logger = logging.getLogger(__name__)
18
-
19
-
20
- class QTypeFacade:
21
- """
22
- Simplified interface for qtype operations.
23
-
24
- This facade provides lazy-loading wrappers for operations that require
25
- optional dependencies (interpreter package), allowing base qtype to work
26
- without those dependencies installed.
27
- """
28
-
29
- def telemetry(self, spec: SemanticDocumentType) -> None:
30
- from qtype.interpreter.telemetry import register
31
-
32
- if isinstance(spec, SemanticApplication) and spec.telemetry:
33
- logger.info(
34
- f"Telemetry enabled with endpoint: {spec.telemetry.endpoint}"
35
- )
36
- # Register telemetry if needed
37
- register(spec.telemetry, self.secret_manager(spec), spec.id)
38
-
39
- def secret_manager(self, spec: SemanticDocumentType):
40
- """
41
- Create a secret manager based on the specification.
42
-
43
- Args:
44
- spec: SemanticDocumentType specification
45
-
46
- Returns:
47
- Secret manager instance
48
- """
49
- from qtype.interpreter.base.secrets import create_secret_manager
50
-
51
- if isinstance(spec, SemanticApplication):
52
- return create_secret_manager(spec.secret_manager)
53
- else:
54
- raise ValueError(
55
- "Can't create secret manager for non-Application spec"
56
- )
57
-
58
- async def execute_workflow(
59
- self,
60
- path: PathLike,
61
- inputs: dict | Any,
62
- flow_name: str | None = None,
63
- **kwargs: Any,
64
- ) -> Any:
65
- """
66
- Execute a complete workflow from document to results.
67
-
68
- Args:
69
- path: Path to the QType specification file
70
- inputs: Dictionary of input values or DataFrame for batch
71
- flow_name: Optional name of flow to execute
72
- **kwargs: Additional dependencies for execution
73
-
74
- Returns:
75
- DataFrame with results (one row per input)
76
- """
77
- import pandas as pd
78
- from opentelemetry import trace
79
-
80
- from qtype.interpreter.base.executor_context import ExecutorContext
81
- from qtype.interpreter.converters import (
82
- dataframe_to_flow_messages,
83
- flow_messages_to_dataframe,
84
- )
85
- from qtype.interpreter.flow import run_flow
86
- from qtype.interpreter.types import Session
87
- from qtype.semantic.loader import load
88
-
89
- # Load the semantic application
90
- semantic_model, type_registry = load(Path(path))
91
- assert isinstance(semantic_model, SemanticApplication)
92
- self.telemetry(semantic_model)
93
-
94
- # Find the flow to execute
95
- if flow_name:
96
- target_flow = None
97
- for flow in semantic_model.flows:
98
- if flow.id == flow_name:
99
- target_flow = flow
100
- break
101
- if target_flow is None:
102
- raise ValueError(f"Flow '{flow_name}' not found")
103
- else:
104
- if semantic_model.flows:
105
- target_flow = semantic_model.flows[0]
106
- else:
107
- raise ValueError("No flows found in application")
108
-
109
- logger.info(f"Executing flow {target_flow.id} from {path}")
110
-
111
- # Convert inputs to DataFrame (normalize single dict to 1-row DataFrame)
112
-
113
- if isinstance(inputs, dict):
114
- input_df = pd.DataFrame([inputs])
115
- elif isinstance(inputs, pd.DataFrame):
116
- input_df = inputs
117
- else:
118
- raise ValueError(
119
- f"Inputs must be dict or DataFrame, got {type(inputs)}"
120
- )
121
-
122
- # Create session
123
- session = Session(
124
- session_id=kwargs.pop("session_id", "default"),
125
- conversation_history=kwargs.pop("conversation_history", []),
126
- )
127
-
128
- # Convert DataFrame to FlowMessages
129
- initial_messages = dataframe_to_flow_messages(input_df, session)
130
-
131
- # Execute the flow
132
- secret_manager = self.secret_manager(semantic_model)
133
-
134
- context = ExecutorContext(
135
- secret_manager=secret_manager,
136
- tracer=trace.get_tracer(__name__),
137
- )
138
- results = await run_flow(
139
- target_flow,
140
- initial_messages,
141
- context=context,
142
- **kwargs,
143
- )
144
-
145
- # Convert results back to DataFrame
146
- results_df = flow_messages_to_dataframe(results, target_flow)
147
-
148
- return results_df
149
-
150
- def generate_aws_bedrock_models(self) -> list[dict[str, Any]]:
151
- """
152
- Generate AWS Bedrock model definitions.
153
-
154
- Returns:
155
- List of model definitions for AWS Bedrock models.
156
-
157
- Raises:
158
- ImportError: If boto3 is not installed.
159
- Exception: If AWS API call fails.
160
- """
161
- import boto3 # type: ignore[import-untyped]
162
-
163
- logger.info("Discovering AWS Bedrock models...")
164
- client = boto3.client("bedrock")
165
- models = client.list_foundation_models()
166
-
167
- model_definitions = []
168
- for model_summary in models.get("modelSummaries", []):
169
- model_definitions.append(
170
- {
171
- "id": model_summary["modelId"],
172
- "provider": "aws-bedrock",
173
- }
174
- )
175
-
176
- logger.info(f"Discovered {len(model_definitions)} AWS Bedrock models")
177
- return model_definitions