Skip to main content

DSL for Generative AI Prototyping

Project description

QType

QType is a domain-specific language (DSL) for rapid prototyping of AI applications.
It is designed to help developers define modular, composable AI systems using a structured YAML-based specification. QType supports models, prompts, tools, retrievers, and flow orchestration, and is extensible for code generation or live interpretation.


🚀 Quick Start

Install QType:

pip install qtype[interpreter]

Create a file hello_world.qtype.yaml that executes a single chat question:

id: hello_world
flows:
  - id: simple_qa_flow
    steps:
      - id: llm_inference_step
        model: 
          id: gpt-4o
          provider: openai
          auth: 
            id: openai_auth
            type: api_key
            api_key: ${OPENAI_KEY}
        system_message: |
          You are a helpful assistant.
        inputs:
          - id: prompt
            type: text
        outputs:
          - id: response_message
            type: text

Put your openai api key into your .env file:

echo "OPENAI_KEY=sk...." >> .env

Validate that the file matches the spec:

qtype validate hello_world.qtype.yaml

You should see:

INFO: ✅ Schema validation successful.
INFO: ✅ Model validation successful.
INFO: ✅ Language validation successful
INFO: ✅ Semantic validation successful

Finally,execute the flow.

qtype run flow '{"prompt":"What is the airspeed of a laden swallow?"}' hello_world.qtype.yaml 

You should see (something similar to):

INFO: Executing flow: simple_qa_flow

The airspeed of a laden swallow is a humorous reference from the movie "Monty Python and the Holy Grail." In the film, the question is posed as "What is the airspeed velocity of an unladen swallow?" The joke revolves around the absurdity and specificity of the question, and it doesn't have a straightforward answer. However, if you're curious about the real-life airspeed of a swallow, the European Swallow (Hirundo rustica) typically flies at around 11 meters per second, or 24 miles per hour, when unladen. The concept of a "laden" swallow is part of the humor, as it would depend on what the swallow is carrying and is not a standard measurement.

See the full docs for more examples and guides.

🤝 Contributing

Contributions welcome! Please follow the instructions in the contribution guide.

📄 License

This project is licensed under the MIT License.
See the LICENSE file for details.


🧠 Philosophy

QType is built around modularity, traceability, and rapid iteration. It aims to empower developers to quickly scaffold ideas into usable AI applications without sacrificing maintainability or control.

Stay tuned for upcoming features like:

  • Integrated OpenTelemetry tracing
  • Validation via LLM-as-a-judge
  • UI hinting via input display types
  • Flow state switching and conditional routing

Happy hacking with QType! 🛠️

Generate JSON Schema Publish to PyPI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qtype-0.0.5.tar.gz (60.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qtype-0.0.5-py3-none-any.whl (61.9 kB view details)

Uploaded Python 3

File details

Details for the file qtype-0.0.5.tar.gz.

File metadata

  • Download URL: qtype-0.0.5.tar.gz
  • Upload date:
  • Size: 60.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for qtype-0.0.5.tar.gz
Algorithm Hash digest
SHA256 28948e4924788c56f6d36e967cdcbb0f5470cfdd016dbcbd4e4461418dfa3b95
MD5 e7ac09a52fd60c32ecdece63ba5d4b90
BLAKE2b-256 c0fe3475ba4bbcd3bf1168302d0de8cd89e86bb73d5c5b49abe9c49d22eb4a22

See more details on using hashes here.

Provenance

The following attestation bundles were made for qtype-0.0.5.tar.gz:

Publisher: publish-pypi.yml on bazaarvoice/qtype

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qtype-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: qtype-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 61.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for qtype-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 efe87c4361897f4fde16863a1b29fb22df82a27c82d436f94294fd7a1738eac9
MD5 1de9899a47850fbef7505a6e2faaedc7
BLAKE2b-256 125bfabd9ff6a4fde766ed16b584ae4d783000808da0d38fe29728d6e4e348e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for qtype-0.0.5-py3-none-any.whl:

Publisher: publish-pypi.yml on bazaarvoice/qtype

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page