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,49 @@
|
|
|
1
|
+
# Create Embeddings
|
|
2
|
+
|
|
3
|
+
Generate vector embeddings from text using an embedding model, useful for semantic search, similarity comparisons, and RAG applications.
|
|
4
|
+
|
|
5
|
+
### QType YAML
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
models:
|
|
9
|
+
- type: EmbeddingModel
|
|
10
|
+
id: titan_embed
|
|
11
|
+
provider: aws-bedrock
|
|
12
|
+
model_id: amazon.titan-embed-text-v2:0
|
|
13
|
+
dimensions: 1024
|
|
14
|
+
|
|
15
|
+
flows:
|
|
16
|
+
- type: Flow
|
|
17
|
+
id: main
|
|
18
|
+
steps:
|
|
19
|
+
- type: InvokeEmbedding
|
|
20
|
+
id: embed_text
|
|
21
|
+
model: titan_embed
|
|
22
|
+
inputs: [text]
|
|
23
|
+
outputs: [embedding]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Explanation
|
|
27
|
+
|
|
28
|
+
- **EmbeddingModel**: Defines an embedding model configuration with provider and dimensions
|
|
29
|
+
- **dimensions**: Size of the embedding vector (must match model output, e.g., 1024 for Titan v2)
|
|
30
|
+
- **InvokeEmbedding**: Step type that generates embeddings from input text
|
|
31
|
+
- **Embedding**: Output type containing the vector array and metadata
|
|
32
|
+
|
|
33
|
+
## Complete Example
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
--8<-- "../examples/invoke_models/create_embeddings.qtype.yaml"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Run with:
|
|
40
|
+
```bash
|
|
41
|
+
qtype run examples/invoke_models/create_embeddings.qtype.yaml \
|
|
42
|
+
-i '{"text": "Your text here"}'
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## See Also
|
|
46
|
+
|
|
47
|
+
- [InvokeEmbedding Reference](../../components/InvokeEmbedding.md)
|
|
48
|
+
- [EmbeddingModel Reference](../../components/EmbeddingModel.md)
|
|
49
|
+
- [Embedding Reference](../../components/Embedding.md)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Reuse Prompts with Templates
|
|
2
|
+
|
|
3
|
+
Define reusable prompt templates with variable placeholders using the `PromptTemplate` step, enabling consistent prompt formatting and dynamic content substitution.
|
|
4
|
+
|
|
5
|
+
### QType YAML
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
steps:
|
|
9
|
+
- id: create_prompt
|
|
10
|
+
type: PromptTemplate
|
|
11
|
+
template: |
|
|
12
|
+
Analyze this product review in 1-2 sentences. Include:
|
|
13
|
+
- Overall sentiment (positive/negative/mixed)
|
|
14
|
+
- Key themes or points
|
|
15
|
+
|
|
16
|
+
Product: {product_name}
|
|
17
|
+
Rating: {rating}/5
|
|
18
|
+
Review: {review_text}
|
|
19
|
+
inputs:
|
|
20
|
+
- product_name
|
|
21
|
+
- rating
|
|
22
|
+
- review_text
|
|
23
|
+
outputs:
|
|
24
|
+
- analysis_prompt
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Explanation
|
|
28
|
+
|
|
29
|
+
- **type: PromptTemplate**: Step that formats strings with variable placeholders using Python's `str.format()` syntax
|
|
30
|
+
- **template**: String with `{variable_name}` placeholders that get replaced with actual values from inputs
|
|
31
|
+
- **inputs**: Variables whose values will be substituted into the template placeholders
|
|
32
|
+
- **outputs**: Single variable containing the formatted prompt string ready for LLM inference
|
|
33
|
+
|
|
34
|
+
## See Also
|
|
35
|
+
|
|
36
|
+
- [PromptTemplate Reference](../../components/PromptTemplate.md)
|
|
37
|
+
- [Include Raw Text from Other Files](../Language%20Features/include_raw_text_from_other_files.md)
|
|
38
|
+
- [Call Large Language Models](call_large_language_models.md)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Include QType YAML
|
|
2
|
+
|
|
3
|
+
Organize QType applications into reusable modules by including external YAML files using the `!include` directive, allowing you to share models, tools, authentication providers, and other resources across multiple applications.
|
|
4
|
+
|
|
5
|
+
### QType YAML
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
id: my_app
|
|
9
|
+
|
|
10
|
+
# Include shared resources from other files
|
|
11
|
+
references:
|
|
12
|
+
- !include common/auth.qtype.yaml
|
|
13
|
+
- !include common/models.qtype.yaml
|
|
14
|
+
- !include common/tools.qtype.yaml
|
|
15
|
+
|
|
16
|
+
flows:
|
|
17
|
+
- id: main_flow
|
|
18
|
+
steps:
|
|
19
|
+
- type: LLMInference
|
|
20
|
+
id: generate
|
|
21
|
+
model: shared_gpt4 # References model from included file
|
|
22
|
+
prompt: "Generate a summary"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**common/models.qtype.yaml:**
|
|
26
|
+
```yaml
|
|
27
|
+
- id: shared_gpt4
|
|
28
|
+
type: Model
|
|
29
|
+
provider: openai
|
|
30
|
+
model_id: gpt-4
|
|
31
|
+
auth: shared_openai_auth
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Explanation
|
|
35
|
+
|
|
36
|
+
- **!include**: YAML tag that loads and parses external YAML files, merging their content into the current specification
|
|
37
|
+
- **Relative paths**: File paths are resolved relative to the including YAML file's location
|
|
38
|
+
- **Nested includes**: Included files can include other files, creating a hierarchy of modular components
|
|
39
|
+
- **Remote includes**: Supports URLs (e.g., `!include https://example.com/config.yaml`) via fsspec
|
|
40
|
+
|
|
41
|
+
## See Also
|
|
42
|
+
|
|
43
|
+
- [Reference Entities by ID](reference_entities_by_id.md)
|
|
44
|
+
- [Include Raw Text from Other Files](include_raw_text_from_other_files.md)
|
|
45
|
+
- [Application Reference](../../components/Application.md)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Include Raw Text from Other Files
|
|
2
|
+
|
|
3
|
+
Load external text files into your YAML configuration using the `!include_raw` directive, useful for keeping prompts, templates, and long text content in separate files.
|
|
4
|
+
|
|
5
|
+
### QType YAML
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
steps:
|
|
9
|
+
- id: generate_story
|
|
10
|
+
type: PromptTemplate
|
|
11
|
+
template: !include_raw story_prompt.txt
|
|
12
|
+
inputs:
|
|
13
|
+
- theme
|
|
14
|
+
- tone
|
|
15
|
+
outputs:
|
|
16
|
+
- story
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**story_prompt.txt:**
|
|
20
|
+
```txt
|
|
21
|
+
--8<-- "../examples/language_features/story_prompt.txt"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Explanation
|
|
25
|
+
|
|
26
|
+
- **!include_raw**: YAML tag that loads the contents of an external file as a raw string
|
|
27
|
+
- **Relative paths**: File paths are resolved relative to the YAML file's location
|
|
28
|
+
- **Template substitution**: The loaded text can contain variable placeholders (e.g., `{theme}`, `{tone}`) that are substituted at runtime
|
|
29
|
+
- **Use cases**: Prompt templates, system messages, documentation, or any text content you want to manage separately
|
|
30
|
+
|
|
31
|
+
## Complete Example
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
--8<-- "../examples/language_features/include_raw.qtype.yaml"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
**Run it:**
|
|
40
|
+
```bash
|
|
41
|
+
qtype run include_raw.qtype.yaml -i '{"theme":"a robot learning to paint","tone":"inspirational"}'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## See Also
|
|
45
|
+
|
|
46
|
+
- [PromptTemplate Reference](../../components/PromptTemplate.md)
|
|
47
|
+
- [Include QType YAML](include_qtype_yaml.md)
|
|
48
|
+
- [Reuse Prompts with Templates](../Invoke%20Models/reuse_prompts_with_templates.md)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Reference Entities by ID
|
|
2
|
+
|
|
3
|
+
Use QType's "define once, reference by ID" pattern to eliminate duplication and improve maintainability by assigning unique IDs to components and referencing them throughout your application.
|
|
4
|
+
|
|
5
|
+
### QType YAML
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
# Define components with unique IDs
|
|
9
|
+
auths:
|
|
10
|
+
- type: api_key
|
|
11
|
+
id: openai_auth
|
|
12
|
+
api_key: ${OPENAI_KEY}
|
|
13
|
+
|
|
14
|
+
models:
|
|
15
|
+
- type: Model
|
|
16
|
+
id: gpt4
|
|
17
|
+
provider: openai
|
|
18
|
+
model_id: gpt-4o
|
|
19
|
+
auth: openai_auth # Reference auth by ID
|
|
20
|
+
|
|
21
|
+
memories:
|
|
22
|
+
- id: conversation_memory
|
|
23
|
+
token_limit: 10000
|
|
24
|
+
|
|
25
|
+
flows:
|
|
26
|
+
- type: Flow
|
|
27
|
+
id: chat_flow
|
|
28
|
+
steps:
|
|
29
|
+
- type: LLMInference
|
|
30
|
+
model: gpt4 # Reference model by ID
|
|
31
|
+
memory: conversation_memory # Reference memory by ID
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Explanation
|
|
35
|
+
|
|
36
|
+
- **`id` field**: Assigns a unique identifier to any component (models, auths, tools, variables, etc.)
|
|
37
|
+
- **Reference by string**: Use the ID string wherever the component is needed
|
|
38
|
+
- **Automatic resolution**: QType's linker automatically resolves ID references to actual objects during validation
|
|
39
|
+
- **Reusability**: The same component can be referenced multiple times throughout the application
|
|
40
|
+
|
|
41
|
+
## Complete Example
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
!include ../../examples/conversational_ai/simple_chatbot.qtype.yaml
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## See Also
|
|
48
|
+
|
|
49
|
+
- [Include QType YAML](include_qtype_yaml.md)
|
|
50
|
+
- [Tutorial: Your First QType Application](../../Tutorials/01-first-qtype-application.md)
|
|
51
|
+
- [Application Reference](../../components/Application.md)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Use QType Agent Skills
|
|
2
|
+
|
|
3
|
+
Enhance GitHub Copilot or Claude Code with domain-specific QType expertise by loading pre-built agent skills that help you architect your vision faster.
|
|
4
|
+
|
|
5
|
+
**Requires:** Active `qtype-mcp` MCP server
|
|
6
|
+
|
|
7
|
+
### Generate Skills
|
|
8
|
+
|
|
9
|
+
Simply:
|
|
10
|
+
```
|
|
11
|
+
qtype generate skills
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
and the skills will be written `.claude` for you.
|
|
15
|
+
|
|
16
|
+
## Available QType Skills
|
|
17
|
+
|
|
18
|
+
### QType Architect
|
|
19
|
+
|
|
20
|
+
Expert assistant for designing and building AI applications using QType's declarative YAML language.
|
|
21
|
+
|
|
22
|
+
**Capabilities:**
|
|
23
|
+
- Designs flows from requirements to implementation
|
|
24
|
+
- Generates architecture visualizations in VSCode
|
|
25
|
+
|
|
26
|
+
## See Also
|
|
27
|
+
|
|
28
|
+
- [Use QType MCP](use_qtype_mcp.md)
|
|
29
|
+
- [Invoke Other Flows](../Data%20Processing/invoke_other_flows.md)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Use Environment Variables
|
|
2
|
+
|
|
3
|
+
Keep sensitive credentials and environment-specific configuration out of your YAML files by using environment variable substitution with `${VAR_NAME}` syntax.
|
|
4
|
+
|
|
5
|
+
### QType YAML
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
auths:
|
|
9
|
+
- type: api_key
|
|
10
|
+
id: openai_auth
|
|
11
|
+
api_key: ${OPENAI_KEY} # Required variable
|
|
12
|
+
host: https://api.openai.com
|
|
13
|
+
|
|
14
|
+
models:
|
|
15
|
+
- type: Model
|
|
16
|
+
id: gpt4
|
|
17
|
+
provider: openai
|
|
18
|
+
model_id: ${MODEL_NAME:-gpt-4} # Optional with default
|
|
19
|
+
auth: openai_auth
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Explanation
|
|
23
|
+
|
|
24
|
+
- **`${VAR_NAME}`**: Substitutes the value of environment variable `VAR_NAME`; raises error if not set
|
|
25
|
+
- **`${VAR_NAME:-default}`**: Substitutes the value of `VAR_NAME` or uses `default` if not set
|
|
26
|
+
- **Environment variable resolution**: Happens during YAML loading, before validation and execution
|
|
27
|
+
- **Works everywhere**: Can be used in any string value throughout the YAML specification
|
|
28
|
+
|
|
29
|
+
## Setting Environment Variables
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Export before running
|
|
33
|
+
export OPENAI_KEY="sk-..."
|
|
34
|
+
qtype run app.qtype.yaml
|
|
35
|
+
|
|
36
|
+
# Or set inline
|
|
37
|
+
OPENAI_KEY="sk-..." uv run qtype run app.qtype.yaml
|
|
38
|
+
|
|
39
|
+
# Or in a .env file (automatically loaded via the loader)
|
|
40
|
+
echo 'OPENAI_KEY="sk-..."' >> .env
|
|
41
|
+
qtype run app.qtype.yaml
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## See Also
|
|
45
|
+
|
|
46
|
+
- [Use API Key Authentication](../Authentication/use_api_key_authentication.md)
|
|
47
|
+
- [Configure AWS Authentication](../Authentication/configure_aws_authentication.md)
|
|
48
|
+
- [Tutorial: Your First QType Application](../../Tutorials/01-first-qtype-application.md)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Use Optional Variables
|
|
2
|
+
|
|
3
|
+
Mark variables as optional to handle cases where data may be missing or unset, allowing your flow to continue gracefully instead of failing.
|
|
4
|
+
|
|
5
|
+
### QType YAML
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
variables:
|
|
9
|
+
- id: email
|
|
10
|
+
type: text? # Optional text variable
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Explanation
|
|
14
|
+
|
|
15
|
+
- **`?` suffix**: Shorthand syntax to mark a variable as optional
|
|
16
|
+
- **Optional variables**: Can be `None` or set to a value
|
|
17
|
+
- **FieldExtractor**: Returns `None` for optional output variables when JSONPath finds no matches, instead of raising an error. If you make the variable non-optional, it will raise an error.
|
|
18
|
+
|
|
19
|
+
## Complete Example
|
|
20
|
+
|
|
21
|
+
```yaml
|
|
22
|
+
--8<-- "../examples/language_features/optional_variables.qtype.yaml"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Run it:**
|
|
26
|
+
```bash
|
|
27
|
+
# When email field exists
|
|
28
|
+
qtype run examples/language_features/optional_variables.qtype.yaml -i '{"user_profile": {"email":"hello@domain.com"}}'
|
|
29
|
+
# Results:
|
|
30
|
+
# email: hello@domain.com
|
|
31
|
+
|
|
32
|
+
# When email field is missing
|
|
33
|
+
qtype run examples/language_features/optional_variables.qtype.yaml -i '{"user_profile": "just text"}'
|
|
34
|
+
# Results:
|
|
35
|
+
# email: None
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## See Also
|
|
39
|
+
|
|
40
|
+
- [Variable Reference](../../components/Variable.md)
|
|
41
|
+
- [FieldExtractor Reference](../../components/FieldExtractor.md)
|
|
42
|
+
- [Tutorial: Structured Data](../../Tutorials/03-structured-data.md)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Use QType MCP
|
|
2
|
+
|
|
3
|
+
QType's Model Context Protocol (MCP) server enables AI assistants like GitHub Copilot to lookup schemas and documentation, validate and visualize qtype files, and convert python modules or apis to tools directly from your AI workflow.
|
|
4
|
+
|
|
5
|
+
## Command Line Usage
|
|
6
|
+
|
|
7
|
+
Start the MCP server manually for debugging or other tools:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Stdio transport (for VS Code, Claude Desktop, etc.)
|
|
11
|
+
qtype mcp --transport stdio
|
|
12
|
+
|
|
13
|
+
# HTTP/SSE transport (for web-based tools)
|
|
14
|
+
qtype mcp --transport sse --host 0.0.0.0 --port 8000
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Transport Options
|
|
18
|
+
|
|
19
|
+
- **stdio**: Standard input/output (default, for desktop tools)
|
|
20
|
+
- **sse**: Server-Sent Events over HTTP
|
|
21
|
+
- **streamable-http**: HTTP streaming protocol
|
|
22
|
+
|
|
23
|
+
## Available MCP Tools
|
|
24
|
+
|
|
25
|
+
The QType MCP server provides these capabilities to AI assistants:
|
|
26
|
+
|
|
27
|
+
- **convert_api_to_tools**: Convert OpenAPI specs to QType tool definitions
|
|
28
|
+
- **convert_python_to_tools**: Convert Python modules to QType tools
|
|
29
|
+
- **get_component_schema**: Retrieve JSON Schema for any QType component
|
|
30
|
+
- **get_documentation**: Fetch specific documentation files
|
|
31
|
+
- **list_components**: List all available QType component types
|
|
32
|
+
- **list_documentation**: Browse available documentation
|
|
33
|
+
- **validate_qtype_yaml**: Validate QType YAML syntax and semantics
|
|
34
|
+
- **visualize_qtype_architecture**: Generate Mermaid diagrams from QType apps
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## VS Code Configuration
|
|
38
|
+
|
|
39
|
+
Add the QType MCP server to your workspace's `.vscode/mcp.json`:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"servers": {
|
|
44
|
+
"qtype-mcp": {
|
|
45
|
+
"type": "stdio",
|
|
46
|
+
"command": "qtype",
|
|
47
|
+
"cwd": "${workspaceFolder}",
|
|
48
|
+
"args": ["mcp", "--transport", "stdio"]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## See Also
|
|
56
|
+
|
|
57
|
+
- [Use QType Agent Skills](use_agent_skills.md)
|
|
58
|
+
- [Validate QType YAML](../Observability%20%26%20Debugging/validate_qtype_yaml.md)
|
|
59
|
+
- [Visualize Application Architecture](../Observability%20%26%20Debugging/visualize_application_architecture.md)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Trace Calls with OpenTelemetry
|
|
2
|
+
|
|
3
|
+
Enable distributed tracing for your QType applications using OpenTelemetry to monitor LLM calls, execution times, and data flow through Phoenix or other observability platforms.
|
|
4
|
+
|
|
5
|
+
### QType YAML
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
telemetry:
|
|
9
|
+
id: phoenix_trace
|
|
10
|
+
provider: Phoenix
|
|
11
|
+
endpoint: http://localhost:6006/v1/traces
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Explanation
|
|
15
|
+
|
|
16
|
+
- **telemetry**: Top-level application configuration for observability
|
|
17
|
+
- **id**: Unique identifier for the telemetry sink
|
|
18
|
+
- **provider**: Telemetry backend (`Phoenix` or `Langfuse`)
|
|
19
|
+
- **endpoint**: URL where OpenTelemetry traces are sent
|
|
20
|
+
|
|
21
|
+
### Starting Phoenix
|
|
22
|
+
|
|
23
|
+
Before running your application, start the Phoenix server:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python3 -m phoenix.server.main serve
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Phoenix will start on `http://localhost:6006` where you can view traces and spans in real-time.
|
|
30
|
+
|
|
31
|
+
## Complete Example
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
--8<-- "../examples/observability_debugging/trace_with_opentelemetry.qtype.yaml"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Run the example:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
qtype run examples/observability_debugging/trace_with_opentelemetry.qtype.yaml --text "I love this product!"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then open `http://localhost:6006` in your browser to see the traced execution.
|
|
44
|
+
|
|
45
|
+
## See Also
|
|
46
|
+
|
|
47
|
+
- [Application Reference](../../components/Application.md)
|
|
48
|
+
- [Validate QType YAML](validate_qtype_yaml.md)
|
|
49
|
+
- [CLI Reference](../../Reference/cli.md)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Validate QType YAML
|
|
2
|
+
|
|
3
|
+
Check your QType YAML files for syntax errors, schema violations, reference issues, and semantic problems before running them.
|
|
4
|
+
|
|
5
|
+
### Command Line
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Basic validation
|
|
9
|
+
qtype validate path/to/app.qtype.yaml
|
|
10
|
+
|
|
11
|
+
# Validate and print the parsed document
|
|
12
|
+
qtype validate path/to/app.qtype.yaml --print
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Validation Checks
|
|
16
|
+
|
|
17
|
+
- **YAML Syntax**: Verifies valid YAML structure and syntax
|
|
18
|
+
- **Schema Validation**: Ensures all fields match the QType schema (Pydantic validation)
|
|
19
|
+
- **Reference Resolution**: Checks that all ID references (models, steps, variables) exist
|
|
20
|
+
- **Duplicate Detection**: Identifies duplicate component IDs
|
|
21
|
+
- **Semantic Validation**: Validates flow logic, type compatibility, and business rules
|
|
22
|
+
|
|
23
|
+
### Options
|
|
24
|
+
|
|
25
|
+
- **`--print` / `-p`**: Print the validated document with resolved references and defaults applied
|
|
26
|
+
|
|
27
|
+
### Exit Codes
|
|
28
|
+
|
|
29
|
+
- **0**: Validation successful
|
|
30
|
+
- **1**: Validation failed (error details printed to stderr)
|
|
31
|
+
|
|
32
|
+
## See Also
|
|
33
|
+
|
|
34
|
+
- [CLI Reference](../../Reference/cli.md)
|
|
35
|
+
- [Semantic Validation Rules](../../Reference/semantic-validation-rules.md)
|
|
36
|
+
- [Visualize Application Architecture](visualize_application_architecture.md)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Visualize Application Architecture
|
|
2
|
+
|
|
3
|
+
Generate interactive diagrams showing your application's flows, steps, and data dependencies to understand structure and debug issues.
|
|
4
|
+
|
|
5
|
+
## Example Visualization
|
|
6
|
+
|
|
7
|
+
Here's what a visualization looks like for a conversational chatbot application:
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
--8<-- "How To/Observability & Debugging/visualize_example.mermaid"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This diagram shows:
|
|
14
|
+
|
|
15
|
+
- **Flow structure**: The conversational flow with its interface and steps
|
|
16
|
+
- **Data flow**: How variables (user_message, context, response) flow between steps
|
|
17
|
+
- **Shared resources**: The LLM model and memory used by the application
|
|
18
|
+
- **Step types**: Different icons for templates (📄), LLM inference (✨), and other components
|
|
19
|
+
|
|
20
|
+
## Command Line
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Generate and open diagram in browser
|
|
24
|
+
qtype visualize path/to/app.qtype.yaml
|
|
25
|
+
|
|
26
|
+
# Save Mermaid diagram to file
|
|
27
|
+
qtype visualize path/to/app.qtype.yaml --output diagram.mmd
|
|
28
|
+
|
|
29
|
+
# Save without opening browser
|
|
30
|
+
qtype visualize path/to/app.qtype.yaml --output diagram.mmd --no-display
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Prerequisites
|
|
34
|
+
|
|
35
|
+
Visualization requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli) to be installed:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install -g @mermaid-js/mermaid-cli
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## How It Works
|
|
42
|
+
|
|
43
|
+
- **Generates Mermaid diagram**: Creates a flowchart showing flows, steps, and variable connections
|
|
44
|
+
- **Converts to SVG**: Uses `mmdc` to render the diagram as a scalable vector graphic
|
|
45
|
+
- **Opens in browser**: Displays the interactive diagram automatically (unless `--no-display` is set)
|
|
46
|
+
|
|
47
|
+
## Options
|
|
48
|
+
|
|
49
|
+
- **`--output` / `-o`**: Save the Mermaid diagram source to a file (`.mmd` format)
|
|
50
|
+
- **`--no-display` / `-nd`**: Skip opening the diagram in browser (useful for CI/CD)
|
|
51
|
+
|
|
52
|
+
## Exit Codes
|
|
53
|
+
|
|
54
|
+
- **0**: Visualization successful
|
|
55
|
+
- **1**: Visualization failed (invalid YAML or missing mmdc)
|
|
56
|
+
|
|
57
|
+
## See Also
|
|
58
|
+
|
|
59
|
+
- [Validate QType YAML](validate_qtype_yaml.md)
|
|
60
|
+
- [CLI Reference](../../Reference/cli.md)
|
|
61
|
+
- [Flow Reference](../../components/Flow.md)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
flowchart TD
|
|
2
|
+
subgraph APP ["📱 simple_chatbot"]
|
|
3
|
+
direction TB
|
|
4
|
+
|
|
5
|
+
subgraph FLOW_0 ["🔄 chat_flow"]
|
|
6
|
+
direction LR
|
|
7
|
+
FLOW_0_START@{shape: circle, label: "▶️ Start"}
|
|
8
|
+
FLOW_0_S0@{shape: rounded, label: "✨ generate_response"}
|
|
9
|
+
FLOW_0_START -->|user_message| FLOW_0_S0
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
subgraph RESOURCES ["🔧 Shared Resources"]
|
|
13
|
+
direction LR
|
|
14
|
+
MODEL_NOVA_LITE@{shape: rounded, label: "✨ nova_lite (aws-bedrock)" }
|
|
15
|
+
MEM_CONVERSATION_MEMORY@{shape: win-pane, label: "🧠 conversation_memory (10KT)"}
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
FLOW_0_S0 -.->|uses| MODEL_NOVA_LITE
|
|
21
|
+
FLOW_0_S0 -.->|stores| MEM_CONVERSATION_MEMORY
|
|
22
|
+
|
|
23
|
+
%% Styling
|
|
24
|
+
classDef appBox fill:none,stroke:#495057,stroke-width:3px
|
|
25
|
+
classDef flowBox fill:#e1f5fe,stroke:#0277bd,stroke-width:2px
|
|
26
|
+
classDef llmNode fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
|
|
27
|
+
classDef modelNode fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px
|
|
28
|
+
classDef authNode fill:#fff3e0,stroke:#ef6c00,stroke-width:2px
|
|
29
|
+
classDef telemetryNode fill:#fce4ec,stroke:#c2185b,stroke-width:2px
|
|
30
|
+
classDef resourceBox fill:#f5f5f5,stroke:#616161,stroke-width:1px
|
|
31
|
+
|
|
32
|
+
class APP appBox
|
|
33
|
+
class FLOW_0 flowBox
|
|
34
|
+
class RESOURCES resourceBox
|
|
35
|
+
class TELEMETRY telemetryNode
|
|
Binary file
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Serve Flows as APIs
|
|
2
|
+
|
|
3
|
+
Expose your QType flows as HTTP REST endpoints with automatically generated OpenAPI documentation using the `qtype serve` command.
|
|
4
|
+
|
|
5
|
+
### Command
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
qtype serve <file.qtype.yaml> [--host HOST] [--port PORT] [--reload]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Explanation
|
|
12
|
+
|
|
13
|
+
- **Swagger UI**: Interactive API documentation available at `http://localhost:8000/docs`
|
|
14
|
+
- **ReDoc**: Alternative API documentation at `http://localhost:8000/redoc`
|
|
15
|
+
- **REST Endpoints**: Each flow is available at `POST /invoke/{flow_id}`
|
|
16
|
+
- **Streaming Endpoints**: Flows with UI interfaces get `POST /stream/{flow_id}` for Server-Sent Events
|
|
17
|
+
- **Interactive UI**: Web interface at `http://localhost:8000/ui` (redirects from root)
|
|
18
|
+
- **--reload**: Auto-reload on file changes during development
|
|
19
|
+
- **--host/--port**: Override default host (localhost) and port (8000)
|
|
20
|
+
|
|
21
|
+
### Example
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
qtype serve examples/tutorials/01_hello_world.qtype.yaml
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then visit `http://localhost:8000/docs` to explore and test your API endpoints.
|
|
28
|
+
|
|
29
|
+
### Available Endpoints
|
|
30
|
+
|
|
31
|
+
- **`GET /flows`**: List all flows with metadata (inputs, outputs, interface type)
|
|
32
|
+
- **`POST /flows/{flow_id}`**: Execute a specific flow (e.g., `POST /flows/simple_example`)
|
|
33
|
+
|
|
34
|
+
Each flow endpoint accepts JSON input matching the flow's input schema and returns structured results with `outputs` and `errors` arrays.
|
|
35
|
+
|
|
36
|
+
## See Also
|
|
37
|
+
|
|
38
|
+
- [Serve Flows as UI](serve_flows_as_ui.md)
|
|
39
|
+
- [CLI Reference](../../Reference/cli.md)
|
|
40
|
+
- [Serve with Auto-Reload](../Command%20Line%20Usage/serve_with_auto_reload.md)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Serve Flows as UI
|
|
2
|
+
|
|
3
|
+
Expose your QType flows through an interactive web interface using the `qtype serve` command.
|
|
4
|
+
|
|
5
|
+
### Command
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
qtype serve <file.qtype.yaml> [--host HOST] [--port PORT] [--reload]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Explanation
|
|
12
|
+
|
|
13
|
+
- **Interactive UI**: Web interface at `http://localhost:8000/ui` (redirects from root `/`)
|
|
14
|
+
- **Complete Flows**: Display as forms with input fields and output display
|
|
15
|
+
- **Conversational Flows**: Display as chat interfaces with message history
|
|
16
|
+
- **Auto-generated**: UI is automatically created based on flow inputs/outputs
|
|
17
|
+
- **--reload**: Auto-reload on file changes during development
|
|
18
|
+
- **--host/--port**: Override default host (localhost) and port (8000)
|
|
19
|
+
|
|
20
|
+
### Example
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
qtype serve examples/tutorials/01_hello_world.qtype.yaml
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then visit `http://localhost:8000/ui` to interact with your flow through the web interface.
|
|
27
|
+
|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
The UI automatically generates:
|
|
31
|
+
|
|
32
|
+
- Input fields based on variable types
|
|
33
|
+
- Submit button to execute the flow
|
|
34
|
+
- Output display for results
|
|
35
|
+
- Error messages if execution fails
|
|
36
|
+
|
|
37
|
+
## See Also
|
|
38
|
+
|
|
39
|
+
- [Serve Flows as APIs](serve_flows_as_apis.md)
|
|
40
|
+
- [Use Conversational Interfaces](use_conversational_interfaces.md)
|
|
41
|
+
- [Tutorial: Conversational Chatbot](../../Tutorials/02-conversational-chatbot.md)
|