qtype 0.1.11__py3-none-any.whl → 0.1.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qtype/` +0 -0
- qtype/application/__init__.py +0 -2
- qtype/application/converters/tools_from_api.py +67 -57
- qtype/application/converters/tools_from_module.py +66 -32
- qtype/base/types.py +6 -1
- qtype/commands/convert.py +3 -6
- qtype/commands/generate.py +97 -10
- qtype/commands/mcp.py +68 -0
- qtype/commands/run.py +116 -44
- qtype/commands/validate.py +4 -4
- qtype/docs/.pages +8 -0
- qtype/docs/Concepts/mental-model-and-philosophy.md +363 -0
- qtype/docs/Contributing/.pages +4 -0
- qtype/docs/Contributing/index.md +283 -0
- qtype/docs/Contributing/roadmap.md +81 -0
- qtype/docs/Decisions/ADR-001-Chat-vs-Completion-Endpoint-Features.md +56 -0
- qtype/docs/Gallery/dataflow_pipelines.md +81 -0
- qtype/docs/Gallery/dataflow_pipelines.mermaid +45 -0
- qtype/docs/Gallery/research_assistant.md +97 -0
- qtype/docs/Gallery/research_assistant.mermaid +42 -0
- qtype/docs/Gallery/simple_chatbot.md +38 -0
- qtype/docs/Gallery/simple_chatbot.mermaid +35 -0
- qtype/docs/How To/Authentication/configure_aws_authentication.md +60 -0
- qtype/docs/How To/Authentication/use_api_key_authentication.md +40 -0
- qtype/docs/How To/Command Line Usage/load_multiple_inputs_from_files.md +77 -0
- qtype/docs/How To/Command Line Usage/pass_inputs_on_the_cli.md +52 -0
- qtype/docs/How To/Command Line Usage/serve_with_auto_reload.md +27 -0
- qtype/docs/How To/Data Processing/adjust_concurrency.md +40 -0
- qtype/docs/How To/Data Processing/cache_step_results.md +71 -0
- qtype/docs/How To/Data Processing/decode_json_xml.md +24 -0
- qtype/docs/How To/Data Processing/explode_collections.md +40 -0
- qtype/docs/How To/Data Processing/gather_results.md +68 -0
- qtype/docs/How To/Data Processing/invoke_other_flows.md +71 -0
- qtype/docs/How To/Data Processing/load_data_from_athena.md +49 -0
- qtype/docs/How To/Data Processing/read_data_from_files.md +61 -0
- qtype/docs/How To/Data Processing/read_sql_databases.md +46 -0
- qtype/docs/How To/Data Processing/write_data_to_file.md +39 -0
- qtype/docs/How To/Invoke Models/call_large_language_models.md +51 -0
- qtype/docs/How To/Invoke Models/create_embeddings.md +49 -0
- qtype/docs/How To/Invoke Models/reuse_prompts_with_templates.md +38 -0
- qtype/docs/How To/Language Features/include_qtype_yaml.md +45 -0
- qtype/docs/How To/Language Features/include_raw_text_from_other_files.md +48 -0
- qtype/docs/How To/Language Features/reference_entities_by_id.md +51 -0
- qtype/docs/How To/Language Features/use_agent_skills.md +29 -0
- qtype/docs/How To/Language Features/use_environment_variables.md +48 -0
- qtype/docs/How To/Language Features/use_optional_variables.md +42 -0
- qtype/docs/How To/Language Features/use_qtype_mcp.md +59 -0
- qtype/docs/How To/Observability & Debugging/trace_calls_with_open_telemetry.md +49 -0
- qtype/docs/How To/Observability & Debugging/validate_qtype_yaml.md +36 -0
- qtype/docs/How To/Observability & Debugging/visualize_application_architecture.md +61 -0
- qtype/docs/How To/Observability & Debugging/visualize_example.mermaid +35 -0
- qtype/docs/How To/Qtype Server/flow_as_ui.png +0 -0
- qtype/docs/How To/Qtype Server/serve_flows_as_apis.md +40 -0
- qtype/docs/How To/Qtype Server/serve_flows_as_ui.md +41 -0
- qtype/docs/How To/Qtype Server/use_conversational_interfaces.md +56 -0
- qtype/docs/How To/Qtype Server/use_variables_with_ui_hints.md +48 -0
- qtype/docs/How To/Tools & Integration/bind_tool_inputs_and_outputs.md +47 -0
- qtype/docs/How To/Tools & Integration/create_tools_from_openapi_specifications.md +85 -0
- qtype/docs/How To/Tools & Integration/create_tools_from_python_modules.md +87 -0
- qtype/docs/Reference/cli.md +336 -0
- qtype/docs/Reference/plugins.md +99 -0
- qtype/docs/Reference/semantic-validation-rules.md +184 -0
- qtype/docs/Tutorials/.pages +1 -0
- qtype/docs/Tutorials/01-first-qtype-application.md +249 -0
- qtype/docs/Tutorials/02-conversational-chatbot.md +327 -0
- qtype/docs/Tutorials/03-structured-data.md +480 -0
- qtype/docs/Tutorials/04-tools-and-function-calling.md +476 -0
- qtype/docs/Tutorials/example_chat.png +0 -0
- qtype/docs/Tutorials/index.md +92 -0
- qtype/docs/components/APIKeyAuthProvider.md +7 -0
- qtype/docs/components/APITool.md +10 -0
- qtype/docs/components/AWSAuthProvider.md +13 -0
- qtype/docs/components/AWSSecretManager.md +5 -0
- qtype/docs/components/Agent.md +6 -0
- qtype/docs/components/Aggregate.md +7 -0
- qtype/docs/components/AggregateStats.md +7 -0
- qtype/docs/components/Application.md +22 -0
- qtype/docs/components/AuthorizationProvider.md +6 -0
- qtype/docs/components/AuthorizationProviderList.md +5 -0
- qtype/docs/components/BearerTokenAuthProvider.md +6 -0
- qtype/docs/components/BedrockReranker.md +8 -0
- qtype/docs/components/ChatContent.md +7 -0
- qtype/docs/components/ChatMessage.md +6 -0
- qtype/docs/components/Collect.md +6 -0
- qtype/docs/components/ConstantPath.md +5 -0
- qtype/docs/components/Construct.md +6 -0
- qtype/docs/components/CustomType.md +7 -0
- qtype/docs/components/Decoder.md +8 -0
- qtype/docs/components/DecoderFormat.md +8 -0
- qtype/docs/components/DocToTextConverter.md +7 -0
- qtype/docs/components/Document.md +7 -0
- qtype/docs/components/DocumentEmbedder.md +6 -0
- qtype/docs/components/DocumentIndex.md +7 -0
- qtype/docs/components/DocumentSearch.md +7 -0
- qtype/docs/components/DocumentSource.md +12 -0
- qtype/docs/components/DocumentSplitter.md +9 -0
- qtype/docs/components/Echo.md +8 -0
- qtype/docs/components/Embedding.md +7 -0
- qtype/docs/components/EmbeddingModel.md +6 -0
- qtype/docs/components/Explode.md +5 -0
- qtype/docs/components/FieldExtractor.md +21 -0
- qtype/docs/components/FileSource.md +6 -0
- qtype/docs/components/FileWriter.md +7 -0
- qtype/docs/components/Flow.md +14 -0
- qtype/docs/components/FlowInterface.md +7 -0
- qtype/docs/components/Index.md +8 -0
- qtype/docs/components/IndexUpsert.md +6 -0
- qtype/docs/components/InvokeEmbedding.md +7 -0
- qtype/docs/components/InvokeFlow.md +8 -0
- qtype/docs/components/InvokeTool.md +8 -0
- qtype/docs/components/LLMInference.md +9 -0
- qtype/docs/components/ListType.md +5 -0
- qtype/docs/components/Memory.md +8 -0
- qtype/docs/components/MessageRole.md +14 -0
- qtype/docs/components/Model.md +10 -0
- qtype/docs/components/ModelList.md +5 -0
- qtype/docs/components/OAuth2AuthProvider.md +9 -0
- qtype/docs/components/PrimitiveTypeEnum.md +20 -0
- qtype/docs/components/PromptTemplate.md +7 -0
- qtype/docs/components/PythonFunctionTool.md +7 -0
- qtype/docs/components/RAGChunk.md +7 -0
- qtype/docs/components/RAGDocument.md +10 -0
- qtype/docs/components/RAGSearchResult.md +8 -0
- qtype/docs/components/Reranker.md +5 -0
- qtype/docs/components/SQLSource.md +8 -0
- qtype/docs/components/Search.md +7 -0
- qtype/docs/components/SearchResult.md +7 -0
- qtype/docs/components/SecretManager.md +7 -0
- qtype/docs/components/SecretReference.md +7 -0
- qtype/docs/components/Source.md +5 -0
- qtype/docs/components/Step.md +8 -0
- qtype/docs/components/TelemetrySink.md +9 -0
- qtype/docs/components/Tool.md +9 -0
- qtype/docs/components/ToolList.md +5 -0
- qtype/docs/components/TypeList.md +5 -0
- qtype/docs/components/Variable.md +8 -0
- qtype/docs/components/VariableList.md +5 -0
- qtype/docs/components/VectorIndex.md +7 -0
- qtype/docs/components/VectorSearch.md +6 -0
- qtype/docs/components/VertexAuthProvider.md +9 -0
- qtype/docs/components/Writer.md +5 -0
- qtype/docs/example_ui.png +0 -0
- qtype/docs/index.md +81 -0
- qtype/docs/legacy_how_tos/.pages +6 -0
- qtype/docs/legacy_how_tos/Configuration/modular-yaml.md +366 -0
- qtype/docs/legacy_how_tos/Configuration/phoenix_projects.png +0 -0
- qtype/docs/legacy_how_tos/Configuration/phoenix_traces.png +0 -0
- qtype/docs/legacy_how_tos/Configuration/reference-by-id.md +251 -0
- qtype/docs/legacy_how_tos/Configuration/telemetry-setup.md +259 -0
- qtype/docs/legacy_how_tos/Data Types/custom-types.md +52 -0
- qtype/docs/legacy_how_tos/Data Types/domain-types.md +113 -0
- qtype/docs/legacy_how_tos/Debugging/visualize-apps.md +147 -0
- qtype/docs/legacy_how_tos/Tools/api-tools.md +29 -0
- qtype/docs/legacy_how_tos/Tools/python-tools.md +299 -0
- qtype/docs/skills/architect/SKILL.md +188 -0
- qtype/docs/skills/architect/references/cheatsheet.md +198 -0
- qtype/docs/skills/architect/references/patterns.md +29 -0
- qtype/docs/stylesheets/extra.css +27 -0
- qtype/dsl/custom_types.py +2 -1
- qtype/dsl/linker.py +23 -7
- qtype/dsl/loader.py +3 -3
- qtype/dsl/model.py +181 -67
- qtype/examples/authentication/aws_authentication.qtype.yaml +63 -0
- qtype/examples/conversational_ai/hello_world_chat.qtype.yaml +43 -0
- qtype/examples/conversational_ai/simple_chatbot.qtype.yaml +40 -0
- qtype/examples/data_processing/athena_query.qtype.yaml +56 -0
- qtype/examples/data_processing/batch_inputs.csv +5 -0
- qtype/examples/data_processing/batch_processing.qtype.yaml +54 -0
- qtype/examples/data_processing/cache_step_results.qtype.yaml +78 -0
- qtype/examples/data_processing/collect_results.qtype.yaml +55 -0
- qtype/examples/data_processing/create_sample_db.py +129 -0
- qtype/examples/data_processing/dataflow_pipelines.qtype.yaml +108 -0
- qtype/examples/data_processing/decode_json.qtype.yaml +23 -0
- qtype/examples/data_processing/explode_items.qtype.yaml +25 -0
- qtype/examples/data_processing/invoke_other_flows.qtype.yaml +98 -0
- qtype/examples/data_processing/read_file.qtype.yaml +60 -0
- qtype/examples/data_processing/reviews.db +0 -0
- qtype/examples/data_processing/sample_article.txt +1 -0
- qtype/examples/data_processing/sample_documents.jsonl +5 -0
- qtype/examples/invoke_models/create_embeddings.qtype.yaml +28 -0
- qtype/examples/invoke_models/simple_llm_call.qtype.yaml +32 -0
- qtype/examples/language_features/include_raw.qtype.yaml +27 -0
- qtype/examples/language_features/optional_variables.qtype.yaml +32 -0
- qtype/examples/language_features/story_prompt.txt +6 -0
- qtype/examples/language_features/ui_hints.qtype.yaml +52 -0
- qtype/examples/legacy/bedrock/data_analysis_with_telemetry.qtype.yaml +169 -0
- qtype/examples/legacy/bedrock/hello_world.qtype.yaml +39 -0
- qtype/examples/legacy/bedrock/hello_world_chat.qtype.yaml +37 -0
- qtype/examples/legacy/bedrock/hello_world_chat_with_telemetry.qtype.yaml +40 -0
- qtype/examples/legacy/bedrock/hello_world_chat_with_thinking.qtype.yaml +40 -0
- qtype/examples/legacy/bedrock/hello_world_completion.qtype.yaml +41 -0
- qtype/examples/legacy/bedrock/hello_world_completion_with_auth.qtype.yaml +44 -0
- qtype/examples/legacy/bedrock/simple_agent_chat.qtype.yaml +46 -0
- qtype/examples/legacy/chat_with_langfuse.qtype.yaml +50 -0
- qtype/examples/legacy/data/customers.csv +6 -0
- qtype/examples/legacy/data_processor.qtype.yaml +48 -0
- qtype/examples/legacy/echo/debug_example.qtype.yaml +59 -0
- qtype/examples/legacy/echo/prompt.qtype.yaml +22 -0
- qtype/examples/legacy/echo/readme.md +29 -0
- qtype/examples/legacy/echo/test.qtype.yaml +26 -0
- qtype/examples/legacy/echo/video.qtype.yaml +20 -0
- qtype/examples/legacy/field_extractor_example.qtype.yaml +137 -0
- qtype/examples/legacy/multi_flow_example.qtype.yaml +125 -0
- qtype/examples/legacy/openai/hello_world_chat.qtype.yaml +43 -0
- qtype/examples/legacy/openai/hello_world_chat_with_telemetry.qtype.yaml +46 -0
- qtype/examples/legacy/qtype_plugin_example.py +51 -0
- qtype/examples/legacy/rag.qtype.yaml +207 -0
- qtype/examples/legacy/sample_data.txt +43 -0
- qtype/examples/legacy/time_utilities.qtype.yaml +64 -0
- qtype/examples/legacy/vertex/README.md +11 -0
- qtype/examples/legacy/vertex/hello_world_chat.qtype.yaml +36 -0
- qtype/examples/legacy/vertex/hello_world_completion.qtype.yaml +40 -0
- qtype/examples/legacy/vertex/hello_world_completion_with_auth.qtype.yaml +45 -0
- qtype/examples/observability_debugging/trace_with_opentelemetry.qtype.yaml +40 -0
- qtype/examples/research_assistant/research_assistant.qtype.yaml +94 -0
- qtype/examples/research_assistant/tavily.oas.yaml +722 -0
- qtype/examples/research_assistant/tavily.qtype.yaml +216 -0
- qtype/examples/tutorials/01_hello_world.qtype.yaml +48 -0
- qtype/examples/tutorials/02_conversational_chat.qtype.yaml +37 -0
- qtype/examples/tutorials/03_structured_data.qtype.yaml +130 -0
- qtype/examples/tutorials/04_tools_and_function_calling.qtype.yaml +89 -0
- qtype/interpreter/api.py +4 -1
- qtype/interpreter/base/base_step_executor.py +3 -1
- qtype/interpreter/base/stream_emitter.py +19 -13
- qtype/interpreter/conversions.py +7 -3
- qtype/interpreter/converters.py +142 -26
- qtype/interpreter/executors/agent_executor.py +2 -3
- qtype/interpreter/executors/aggregate_executor.py +3 -4
- qtype/interpreter/executors/construct_executor.py +15 -15
- qtype/interpreter/executors/doc_to_text_executor.py +1 -3
- qtype/interpreter/executors/field_extractor_executor.py +13 -12
- qtype/interpreter/executors/file_source_executor.py +21 -34
- qtype/interpreter/executors/file_writer_executor.py +4 -4
- qtype/interpreter/executors/index_upsert_executor.py +1 -1
- qtype/interpreter/executors/invoke_embedding_executor.py +1 -4
- qtype/interpreter/executors/invoke_flow_executor.py +2 -2
- qtype/interpreter/executors/invoke_tool_executor.py +19 -18
- qtype/interpreter/executors/llm_inference_executor.py +16 -18
- qtype/interpreter/executors/prompt_template_executor.py +1 -3
- qtype/interpreter/executors/sql_source_executor.py +1 -1
- qtype/interpreter/resource_cache.py +3 -1
- qtype/interpreter/rich_progress.py +6 -3
- qtype/interpreter/stream/chat/converter.py +25 -17
- qtype/interpreter/stream/chat/ui_request_to_domain_type.py +2 -2
- qtype/interpreter/tools/function_tool_helper.py +11 -10
- qtype/interpreter/types.py +89 -4
- qtype/interpreter/typing.py +35 -38
- qtype/mcp/__init__.py +0 -0
- qtype/mcp/server.py +722 -0
- qtype/schema/qtype.schema.json +4016 -0
- qtype/semantic/checker.py +20 -1
- qtype/semantic/generate.py +6 -9
- qtype/semantic/model.py +26 -33
- qtype/semantic/resolver.py +7 -0
- qtype/semantic/visualize.py +45 -53
- {qtype-0.1.11.dist-info → qtype-0.1.13.dist-info}/METADATA +65 -44
- qtype-0.1.13.dist-info/RECORD +352 -0
- {qtype-0.1.11.dist-info → qtype-0.1.13.dist-info}/WHEEL +1 -2
- qtype/application/facade.py +0 -177
- qtype-0.1.11.dist-info/RECORD +0 -142
- qtype-0.1.11.dist-info/top_level.txt +0 -1
- {qtype-0.1.11.dist-info → qtype-0.1.13.dist-info}/entry_points.txt +0 -0
- {qtype-0.1.11.dist-info → qtype-0.1.13.dist-info}/licenses/LICENSE +0 -0
|
@@ -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?
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
id: 01_hello_world
|
|
2
|
+
description: My first QType application
|
|
3
|
+
|
|
4
|
+
auths:
|
|
5
|
+
- type: api_key
|
|
6
|
+
id: openai_auth
|
|
7
|
+
api_key: ${OPENAI_KEY}
|
|
8
|
+
host: https://api.openai.com
|
|
9
|
+
|
|
10
|
+
models:
|
|
11
|
+
- type: Model
|
|
12
|
+
id: gpt-4
|
|
13
|
+
provider: openai
|
|
14
|
+
model_id: gpt-4-turbo
|
|
15
|
+
auth: openai_auth
|
|
16
|
+
inference_params:
|
|
17
|
+
temperature: 0.7
|
|
18
|
+
|
|
19
|
+
flows:
|
|
20
|
+
- type: Flow
|
|
21
|
+
id: simple_example
|
|
22
|
+
variables:
|
|
23
|
+
- id: question
|
|
24
|
+
type: text
|
|
25
|
+
- id: formatted_prompt
|
|
26
|
+
type: text
|
|
27
|
+
- id: answer
|
|
28
|
+
type: text
|
|
29
|
+
inputs:
|
|
30
|
+
- question
|
|
31
|
+
outputs:
|
|
32
|
+
- answer
|
|
33
|
+
steps:
|
|
34
|
+
- id: format_prompt
|
|
35
|
+
type: PromptTemplate
|
|
36
|
+
template: "You are a helpful assistant. Answer the following question:\n{question}\n"
|
|
37
|
+
inputs:
|
|
38
|
+
- question
|
|
39
|
+
outputs:
|
|
40
|
+
- formatted_prompt
|
|
41
|
+
|
|
42
|
+
- id: llm_step
|
|
43
|
+
type: LLMInference
|
|
44
|
+
model: gpt-4
|
|
45
|
+
inputs:
|
|
46
|
+
- formatted_prompt
|
|
47
|
+
outputs:
|
|
48
|
+
- answer
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
id: 02_conversational_chat
|
|
2
|
+
description: A simple stateful chat flow with AWS Bedrock
|
|
3
|
+
models:
|
|
4
|
+
- type: Model
|
|
5
|
+
id: nova_lite
|
|
6
|
+
provider: aws-bedrock
|
|
7
|
+
model_id: amazon.nova-lite-v1:0
|
|
8
|
+
inference_params:
|
|
9
|
+
temperature: 0.7
|
|
10
|
+
max_tokens: 512
|
|
11
|
+
memories:
|
|
12
|
+
- id: chat_memory
|
|
13
|
+
token_limit: 10000
|
|
14
|
+
flows:
|
|
15
|
+
- type: Flow
|
|
16
|
+
id: simple_chat_example
|
|
17
|
+
interface:
|
|
18
|
+
type: Conversational
|
|
19
|
+
variables:
|
|
20
|
+
- id: user_message
|
|
21
|
+
type: ChatMessage
|
|
22
|
+
- id: response_message
|
|
23
|
+
type: ChatMessage
|
|
24
|
+
inputs:
|
|
25
|
+
- user_message
|
|
26
|
+
outputs:
|
|
27
|
+
- response_message
|
|
28
|
+
steps:
|
|
29
|
+
- id: llm_inference_step
|
|
30
|
+
type: LLMInference
|
|
31
|
+
model: nova_lite
|
|
32
|
+
system_message: "You are a helpful assistant."
|
|
33
|
+
memory: chat_memory
|
|
34
|
+
inputs:
|
|
35
|
+
- user_message
|
|
36
|
+
outputs:
|
|
37
|
+
- response_message
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Tutorial 3: Working with Types and Structured Data
|
|
2
|
+
#
|
|
3
|
+
# This tutorial demonstrates how to:
|
|
4
|
+
# 1. Define a CustomType for your domain
|
|
5
|
+
# 2. Extract fields from structured data using JSONPath (FieldExtractor)
|
|
6
|
+
# 3. Parse LLM output into structured format (Decoder)
|
|
7
|
+
# 4. Construct typed objects from extracted data (Construct)
|
|
8
|
+
#
|
|
9
|
+
# Scenario: Analyze a product review to extract structured sentiment
|
|
10
|
+
#
|
|
11
|
+
# Run with:
|
|
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
|
+
|
|
14
|
+
id: review_sentiment_analyzer
|
|
15
|
+
description: |
|
|
16
|
+
Analyzes a product review to extract structured sentiment insights.
|
|
17
|
+
Demonstrates custom types and structured data extraction.
|
|
18
|
+
|
|
19
|
+
# Define a custom type for sentiment analysis
|
|
20
|
+
types:
|
|
21
|
+
- id: ReviewSentiment
|
|
22
|
+
description: Structured sentiment analysis of a review
|
|
23
|
+
properties:
|
|
24
|
+
sentiment: text
|
|
25
|
+
confidence: float
|
|
26
|
+
key_points: list[text]
|
|
27
|
+
rating: int
|
|
28
|
+
|
|
29
|
+
models:
|
|
30
|
+
- type: Model
|
|
31
|
+
id: analyzer_model
|
|
32
|
+
provider: aws-bedrock
|
|
33
|
+
model_id: amazon.nova-lite-v1:0
|
|
34
|
+
inference_params:
|
|
35
|
+
temperature: 0.7
|
|
36
|
+
max_tokens: 512
|
|
37
|
+
|
|
38
|
+
flows:
|
|
39
|
+
- id: analyze_review
|
|
40
|
+
description: Analyzes a single review and extracts structured sentiment
|
|
41
|
+
inputs:
|
|
42
|
+
- review_text
|
|
43
|
+
outputs:
|
|
44
|
+
- result
|
|
45
|
+
|
|
46
|
+
variables:
|
|
47
|
+
- id: review_text
|
|
48
|
+
type: text
|
|
49
|
+
- id: raw_llm_response
|
|
50
|
+
type: text
|
|
51
|
+
- id: llm_response
|
|
52
|
+
type: text
|
|
53
|
+
- id: sentiment
|
|
54
|
+
type: text
|
|
55
|
+
- id: confidence
|
|
56
|
+
type: float
|
|
57
|
+
- id: key_points
|
|
58
|
+
type: list[text]
|
|
59
|
+
- id: rating
|
|
60
|
+
type: int
|
|
61
|
+
- id: result
|
|
62
|
+
type: ReviewSentiment
|
|
63
|
+
|
|
64
|
+
steps:
|
|
65
|
+
# Step 1: Create analysis prompt
|
|
66
|
+
- id: analysis_prompt
|
|
67
|
+
type: PromptTemplate
|
|
68
|
+
template: |
|
|
69
|
+
Analyze this product review and extract structured information.
|
|
70
|
+
|
|
71
|
+
Review: {{review_text}}
|
|
72
|
+
|
|
73
|
+
Respond with ONLY valid JSON, no other text or markdown. Use this exact structure:
|
|
74
|
+
{{
|
|
75
|
+
"sentiment": "positive|negative|neutral|mixed",
|
|
76
|
+
"confidence": 0.95,
|
|
77
|
+
"key_points": ["point 1", "point 2"],
|
|
78
|
+
"rating": 4
|
|
79
|
+
}}
|
|
80
|
+
|
|
81
|
+
Where:
|
|
82
|
+
- sentiment: overall sentiment (positive/negative/neutral/mixed)
|
|
83
|
+
- confidence: your confidence score (0.0-1.0)
|
|
84
|
+
- key_points: 2-3 main points from the review
|
|
85
|
+
- rating: estimated star rating 1-5 based on the tone
|
|
86
|
+
|
|
87
|
+
Return ONLY the JSON object, nothing else.
|
|
88
|
+
inputs:
|
|
89
|
+
- review_text
|
|
90
|
+
outputs:
|
|
91
|
+
- raw_llm_response
|
|
92
|
+
|
|
93
|
+
# Step 2: Run LLM inference
|
|
94
|
+
- id: analyze
|
|
95
|
+
type: LLMInference
|
|
96
|
+
model: analyzer_model
|
|
97
|
+
inputs:
|
|
98
|
+
- raw_llm_response
|
|
99
|
+
outputs:
|
|
100
|
+
- llm_response
|
|
101
|
+
|
|
102
|
+
# Step 3: Parse the JSON response and build the ReviewSentiment object
|
|
103
|
+
# Decoder converts the JSON string into structured data
|
|
104
|
+
- id: parse_and_build
|
|
105
|
+
type: Decoder
|
|
106
|
+
format: json
|
|
107
|
+
inputs:
|
|
108
|
+
- llm_response
|
|
109
|
+
outputs:
|
|
110
|
+
- sentiment
|
|
111
|
+
- confidence
|
|
112
|
+
- key_points
|
|
113
|
+
- rating
|
|
114
|
+
|
|
115
|
+
# Step 4: Construct a ReviewSentiment object
|
|
116
|
+
# Construct builds typed objects from the decoded fields
|
|
117
|
+
- id: build_result
|
|
118
|
+
type: Construct
|
|
119
|
+
field_bindings:
|
|
120
|
+
sentiment: sentiment
|
|
121
|
+
confidence: confidence
|
|
122
|
+
key_points: key_points
|
|
123
|
+
rating: rating
|
|
124
|
+
inputs:
|
|
125
|
+
- sentiment
|
|
126
|
+
- confidence
|
|
127
|
+
- key_points
|
|
128
|
+
- rating
|
|
129
|
+
outputs:
|
|
130
|
+
- result
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Tutorial 4: Adding Tools to Your Application
|
|
2
|
+
#
|
|
3
|
+
# This tutorial demonstrates how to:
|
|
4
|
+
# 1. Import pre-built tools from the commons library
|
|
5
|
+
# 2. Use InvokeTool to call Python functions
|
|
6
|
+
# 3. Chain multiple tools together with input/output bindings
|
|
7
|
+
#
|
|
8
|
+
# Scenario: Calculate a deadline by adding days to the current time
|
|
9
|
+
#
|
|
10
|
+
# Run with:
|
|
11
|
+
# qtype run -i '{"days_until_due": 3}' examples/tutorials/04_tools_and_function_calling.qtype.yaml
|
|
12
|
+
|
|
13
|
+
id: deadline_calculator
|
|
14
|
+
description: |
|
|
15
|
+
Calculates a deadline by adding days to the current timestamp.
|
|
16
|
+
Demonstrates tool imports, InvokeTool step, and tool chaining.
|
|
17
|
+
|
|
18
|
+
# Import pre-built tools from the commons library
|
|
19
|
+
references:
|
|
20
|
+
- !include ../../common/tools.qtype.yaml
|
|
21
|
+
|
|
22
|
+
flows:
|
|
23
|
+
- id: calculate_deadline
|
|
24
|
+
description: Calculate a formatted deadline from current time plus days
|
|
25
|
+
inputs:
|
|
26
|
+
- days_until_due
|
|
27
|
+
outputs:
|
|
28
|
+
- deadline_formatted
|
|
29
|
+
|
|
30
|
+
variables:
|
|
31
|
+
# Input
|
|
32
|
+
- id: days_until_due
|
|
33
|
+
type: int
|
|
34
|
+
|
|
35
|
+
# Tool outputs
|
|
36
|
+
- id: current_time
|
|
37
|
+
type: datetime
|
|
38
|
+
- id: deadline_time
|
|
39
|
+
type: datetime
|
|
40
|
+
- id: format_string
|
|
41
|
+
type: text
|
|
42
|
+
- id: deadline_formatted
|
|
43
|
+
type: text
|
|
44
|
+
|
|
45
|
+
steps:
|
|
46
|
+
# Step 1: Get current timestamp using a tool
|
|
47
|
+
# This tool takes no inputs and returns the current UTC time
|
|
48
|
+
- id: get_current_time
|
|
49
|
+
type: InvokeTool
|
|
50
|
+
tool: qtype.application.commons.tools.get_current_timestamp
|
|
51
|
+
input_bindings: {}
|
|
52
|
+
output_bindings:
|
|
53
|
+
get_current_timestamp_result: current_time
|
|
54
|
+
outputs:
|
|
55
|
+
- current_time
|
|
56
|
+
|
|
57
|
+
# Step 2: Create a format string constant
|
|
58
|
+
- id: create_format_string
|
|
59
|
+
type: PromptTemplate
|
|
60
|
+
template: "%B %d, %Y at %I:%M %p UTC"
|
|
61
|
+
inputs: []
|
|
62
|
+
outputs:
|
|
63
|
+
- format_string
|
|
64
|
+
|
|
65
|
+
# Step 3: Calculate deadline by adding days to current time
|
|
66
|
+
# input_bindings maps flow variables to tool parameters
|
|
67
|
+
- id: add_days
|
|
68
|
+
type: InvokeTool
|
|
69
|
+
tool: qtype.application.commons.tools.timedelta
|
|
70
|
+
input_bindings:
|
|
71
|
+
timestamp: current_time
|
|
72
|
+
days: days_until_due
|
|
73
|
+
output_bindings:
|
|
74
|
+
timedelta_result: deadline_time
|
|
75
|
+
outputs:
|
|
76
|
+
- deadline_time
|
|
77
|
+
|
|
78
|
+
# Step 4: Format deadline for human readability
|
|
79
|
+
# Shows chaining: output from previous tool becomes input to this one
|
|
80
|
+
- id: format_deadline
|
|
81
|
+
type: InvokeTool
|
|
82
|
+
tool: qtype.application.commons.tools.format_datetime
|
|
83
|
+
input_bindings:
|
|
84
|
+
timestamp: deadline_time
|
|
85
|
+
format_string: format_string
|
|
86
|
+
output_bindings:
|
|
87
|
+
format_datetime_result: deadline_formatted
|
|
88
|
+
outputs:
|
|
89
|
+
- deadline_formatted
|
qtype/interpreter/api.py
CHANGED
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import asyncio
|
|
4
4
|
from contextlib import asynccontextmanager
|
|
5
5
|
from pathlib import Path
|
|
6
|
+
from typing import Any
|
|
6
7
|
|
|
7
8
|
from fastapi import FastAPI
|
|
8
9
|
from fastapi.middleware.cors import CORSMiddleware
|
|
@@ -86,8 +87,10 @@ class APIExecutor:
|
|
|
86
87
|
if ui_enabled:
|
|
87
88
|
# Add CORS middleware only for localhost development
|
|
88
89
|
if self.host in ("localhost", "127.0.0.1", "0.0.0.0"):
|
|
90
|
+
from typing import cast
|
|
91
|
+
|
|
89
92
|
app.add_middleware(
|
|
90
|
-
CORSMiddleware,
|
|
93
|
+
cast(Any, CORSMiddleware),
|
|
91
94
|
allow_origins=["*"],
|
|
92
95
|
allow_credentials=True,
|
|
93
96
|
allow_methods=["*"],
|
|
@@ -355,7 +355,9 @@ class StepExecutor(ABC):
|
|
|
355
355
|
):
|
|
356
356
|
serialized = [to_cache_value(m, self.step) for m in buf]
|
|
357
357
|
self.cache.set(
|
|
358
|
-
key,
|
|
358
|
+
key,
|
|
359
|
+
serialized,
|
|
360
|
+
expire=self.step.cache_config.ttl, # type: ignore[union-attr]
|
|
359
361
|
) # type: ignore
|
|
360
362
|
|
|
361
363
|
async def _process_message_with_telemetry(
|
|
@@ -121,15 +121,15 @@ class ReasoningStreamContext:
|
|
|
121
121
|
"""
|
|
122
122
|
Async context manager for reasoning streaming.
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
ReasoningStreamEndEvent
|
|
126
|
-
reasoning
|
|
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
|
-
"""
|
|
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
|
|
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,
|
qtype/interpreter/conversions.py
CHANGED
|
@@ -331,7 +331,7 @@ def to_embedding_model(
|
|
|
331
331
|
OpenAIEmbedding,
|
|
332
332
|
)
|
|
333
333
|
|
|
334
|
-
api_key = None
|
|
334
|
+
api_key: str | None = None
|
|
335
335
|
if model.auth:
|
|
336
336
|
with auth(model.auth, secret_manager) as provider:
|
|
337
337
|
if not isinstance(provider, APIKeyAuthProvider):
|
|
@@ -343,7 +343,7 @@ def to_embedding_model(
|
|
|
343
343
|
api_key = provider.api_key # type: ignore[assignment]
|
|
344
344
|
|
|
345
345
|
openai_embedding: BaseEmbedding = OpenAIEmbedding(
|
|
346
|
-
api_key=api_key,
|
|
346
|
+
api_key=api_key, # type: ignore[arg-type]
|
|
347
347
|
model_name=model.model_id if model.model_id else model.id,
|
|
348
348
|
)
|
|
349
349
|
return openai_embedding
|
|
@@ -523,7 +523,11 @@ def from_chat_message(message: LlamaChatMessage) -> ChatMessage:
|
|
|
523
523
|
f"Unsupported content block type: {type(block)}"
|
|
524
524
|
)
|
|
525
525
|
|
|
526
|
-
|
|
526
|
+
# Convert llama_index MessageRole to our MessageRole
|
|
527
|
+
from qtype.dsl.domain_types import MessageRole as QTypeMessageRole
|
|
528
|
+
|
|
529
|
+
role = QTypeMessageRole(message.role.value)
|
|
530
|
+
return ChatMessage(role=role, blocks=blocks)
|
|
527
531
|
|
|
528
532
|
|
|
529
533
|
def to_text_splitter(splitter: DocumentSplitter) -> Any:
|