A Python package for TRIZ (Theory of Inventive Problem Solving) tools and techniques.
Project description
PyTRIZ
A Python library for applying TRIZ (Theory of Inventive Problem Solving) — look up parameters, principles, and contradiction matrix results, or use LLM-powered agents to analyze engineering trade-offs.
Installation
pip install pytriz
Requires Python 3.12+.
Quick start
from pytriz import TRIZStore
store = TRIZStore() # uses default embedding model, reads config from env
# Find TRIZ principles for a contradiction
principles = store.get_principles_from_matrix(
improving_parameters=[1, 3],
preserving_parameters=[17, 23],
)
# Search parameters and principles by description
params = store.search_parameters("improves durability", top_k=5)
principles = store.search_principles("segmentation", top_k=5)
TRIZStore builds the indexed corpus on instantiation — create it once and reuse it across your application. Semantic search uses a local embedding model by default, no API key needed.
LLM-powered analysis
import asyncio
from pytriz import TRIZStore
from pytriz import contradictions
store = TRIZStore()
result = asyncio.run(
contradictions.analyze_contradiction(
"Increasing blade thickness improves durability but increases weight.",
store=store,
)
)
print(result.contradiction)
print(result.improving_parameter)
print(result.preserving_parameter)
Set your LLM provider in a .env file:
DEFAULT_PROVIDER=openrouter # openai | anthropic | mistral | openrouter | ollama | together
DEFAULT_MODEL=qwen/qwen3.6-35b-a3b
OPENROUTER_API_KEY=your-key-here
Explicit configuration
For full control — useful when building FastAPI apps, MCP servers, or any long-running service:
from pytriz import TRIZStore, get_embedder, get_model, ModelSettings
store = TRIZStore(
embed_model=get_embedder(provider="ollama", model="nomic-embed-text", url="http://my-server:11434"),
)
llm = get_model(
provider="anthropic",
model_name="claude-sonnet-4-6",
settings=ModelSettings(temperature=0.2),
)
result = await contradictions.analyze_contradiction(
"Increasing blade thickness improves durability but increases weight.",
store=store,
llm=llm,
)
store and llm are independent — configure each separately and pass them where needed.
Embedding providers
PyTRIZ supports three embedding backends, configured via EMBEDDING_PROVIDER:
HuggingFace (default)
Downloads and runs the model locally using sentence-transformers. No API key needed for public models.
EMBEDDING_PROVIDER=huggingface
EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
For gated models (e.g. google/embeddinggemma-300m), set your HuggingFace token:
HF_TOKEN=your-token-here
EMBEDDING_MODEL=google/embeddinggemma-300m
Ollama
Runs embeddings locally via a running Ollama instance.
EMBEDDING_PROVIDER=ollama
EMBEDDING_MODEL=nomic-embed-text
OLLAMA_BASE_URL=http://localhost:11434 # optional, this is the default
OpenAI
EMBEDDING_PROVIDER=openai
EMBEDDING_MODEL=text-embedding-3-small
OPENAI_API_KEY=your-key-here
LLM providers
| Provider | DEFAULT_PROVIDER |
Required env var |
|---|---|---|
| OpenAI | openai |
OPENAI_API_KEY |
| Anthropic | anthropic |
ANTHROPIC_API_KEY |
| Mistral | mistral |
MISTRAL_API_KEY |
| OpenRouter | openrouter |
OPENROUTER_API_KEY |
| Together | together |
TOGETHER_API_KEY |
| Ollama | ollama |
— (uses OLLAMA_BASE_URL) |
Environment variables reference
| Variable | Default | Description |
|---|---|---|
DEFAULT_PROVIDER |
openrouter |
LLM provider |
DEFAULT_MODEL |
qwen/qwen3.6-35b-a3b |
LLM model name |
EMBEDDING_PROVIDER |
huggingface |
Embedding backend |
EMBEDDING_MODEL |
sentence-transformers/all-MiniLM-L6-v2 |
Embedding model name |
OLLAMA_BASE_URL |
http://localhost:11434 |
Ollama host (used for both LLM and embeddings) |
OPENAI_API_KEY |
— | OpenAI API key |
ANTHROPIC_API_KEY |
— | Anthropic API key |
MISTRAL_API_KEY |
— | Mistral API key |
OPENROUTER_API_KEY |
— | OpenRouter API key |
TOGETHER_API_KEY |
— | Together AI API key |
HF_TOKEN |
— | HuggingFace token (for gated models) |
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytriz-0.2.1.tar.gz.
File metadata
- Download URL: pytriz-0.2.1.tar.gz
- Upload date:
- Size: 28.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5958f233777cfd54c7ecc519b19e9032fbdf073f3fc92cd366df60cf43565c90
|
|
| MD5 |
894a750c37bd3553dd79167f2b470fdc
|
|
| BLAKE2b-256 |
abc2a69ed1f1f793c52f9c8e77186f825a0252ad0caf1fc5f1943d4d9b908a61
|
Provenance
The following attestation bundles were made for pytriz-0.2.1.tar.gz:
Publisher:
publish.yml on mmysior/pytriz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytriz-0.2.1.tar.gz -
Subject digest:
5958f233777cfd54c7ecc519b19e9032fbdf073f3fc92cd366df60cf43565c90 - Sigstore transparency entry: 2035375430
- Sigstore integration time:
-
Permalink:
mmysior/pytriz@d6ded9ddb53d53c12f585c6af327dcd3a75886d5 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/mmysior
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d6ded9ddb53d53c12f585c6af327dcd3a75886d5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pytriz-0.2.1-py3-none-any.whl.
File metadata
- Download URL: pytriz-0.2.1-py3-none-any.whl
- Upload date:
- Size: 34.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d0ec77229d45f48c957d2b7938ff9be185de26ef736c1452852d6f6fe276bb0
|
|
| MD5 |
27f5f59fb979dfca29b2b3ace37bf081
|
|
| BLAKE2b-256 |
0efc744371bd2cc775f91f9168ad855e27dddba02f054bdbdcb1a7f1a8d8c96a
|
Provenance
The following attestation bundles were made for pytriz-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on mmysior/pytriz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytriz-0.2.1-py3-none-any.whl -
Subject digest:
1d0ec77229d45f48c957d2b7938ff9be185de26ef736c1452852d6f6fe276bb0 - Sigstore transparency entry: 2035375673
- Sigstore integration time:
-
Permalink:
mmysior/pytriz@d6ded9ddb53d53c12f585c6af327dcd3a75886d5 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/mmysior
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d6ded9ddb53d53c12f585c6af327dcd3a75886d5 -
Trigger Event:
push
-
Statement type: