Metadata-Version: 2.4
Name: qtype
Version: 0.0.3
Summary: DSL for Generative AI Prototyping
Author-email: Lou Kratz <lou.kratz+qtype@bazaarvoice.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/bazaarvoice/qtype
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jsonschema>=4.24.0
Requires-Dist: pydantic>=2.11.5
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: openai>=1.93.0
Requires-Dist: fsspec>=2025.5.1
Requires-Dist: pydantic-yaml>=1.5.1
Provides-Extra: interpreter
Requires-Dist: arize-phoenix-otel>=0.12.1; extra == "interpreter"
Requires-Dist: boto3>=1.34.0; extra == "interpreter"
Requires-Dist: fastapi>=0.116.1; extra == "interpreter"
Requires-Dist: llama-index-embeddings-bedrock>=0.5.2; extra == "interpreter"
Requires-Dist: llama-index-embeddings-openai>=0.3.1; extra == "interpreter"
Requires-Dist: llama-index-llms-bedrock-converse>=0.7.4; extra == "interpreter"
Requires-Dist: llama-index-llms-bedrock>=0.3.8; extra == "interpreter"
Requires-Dist: llama-index>=0.12.45; extra == "interpreter"
Requires-Dist: openinference-instrumentation-llama-index>=4.3.1; extra == "interpreter"
Requires-Dist: psycopg2-binary>=2.9.10; extra == "interpreter"
Requires-Dist: uvicorn[standard]>=0.35.0; extra == "interpreter"
Dynamic: license-file

# 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:

```bash
pip install qtype[interpreter]
```

Create a file `hello_world.qtype.yaml` that executes a single chat question:
```yaml
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](https://bazaarvoice.github.io/qtype/) for more examples and guides.

## 🤝 Contributing

Contributions welcome! Please follow the instructions in the [contribution guide](https://bazaarvoice.github.io/qtype/contributing/).

## 📄 License

This project is licensed under the **MIT License**.  
See the [LICENSE](./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](https://github.com/bazaarvoice/qtype/actions/workflows/github_workflows_generate-schema.yml/badge.svg)](https://github.com/bazaarvoice/qtype/actions/workflows/github_workflows_generate-schema.yml) [![Publish to PyPI](https://github.com/bazaarvoice/qtype/actions/workflows/publish-pypi.yml/badge.svg)](https://github.com/bazaarvoice/qtype/actions/workflows/publish-pypi.yml)
