Installation · CLI and MCP · Download sources (ZIP)
Laya sorts text requests into defined categories and returns confidence scores. Start with a small labeled sample to see which decisions can be automated.
Tool characteristics
The library answers questions with a limited answer set: choosing an option, assigning a numerical score or estimating a “yes” answer. For example, it can separate a bug report from a billing question. Your project defines the categories and what happens next.
A plain laya "text" invocation only selects a language model. To obtain answers, use --predict, a ready question set with --preset or your own questions with --questions. Successful model selection does not demonstrate classification quality.
Package installation and the first model download are separate stages. On the first computation, Laya downloads the selected model from Hugging Face; later runs use the local cache. Before downloading, the assistant checks free storage and available memory.
Prepare a trial
Ask Codex to find the project and one recurring choice currently made by a person. Sorting anonymized inquiries into a few clear categories suits a first trial. Keep attachments, account actions and automatic replies outside this trial.
- Describe categories and an example of each. Add a case for human review: too little data, mixed topics or no suitable category.
- Collect Russian examples with known answers. Split them into a tuning set and a separate test set. Identical or nearly identical messages must remain in the same set.
- Decide which error is more serious, such as missing an urgent inquiry or sending an ordinary one for manual review. Choose acceptable error levels per category.
- Find the existing project environment. A new environment needs Python 3.10 or newer and compatible dependencies; the assistant checks supported devices against documentation and your computer.
These commands create a separate environment on macOS or Linux and check the package import. Codex chooses suitable paths; on Windows it uses executables in Scripts.
python3 -m venv .venv
.venv/bin/python -m pip install laya
.venv/bin/python -I -c "import laya; print(laya.__version__)"
Get the first answer
The assistant first reads the questions in the triage preset. It is useful for learning the interface, but its categories may differ from yours. Explicitly select a multilingual model for the Russian example.
.venv/bin/laya "После обновления приложение закрывается при запуске" --model multilingual --preset triage --json
The example says: “After the update, the application closes at startup.” This call downloads the model and computes answers. Check the selected model, actual questions and answers in the result. For production routing, Codex prepares a custom question set from your labels, saving both input texts and expected categories.
--min-confidence marks low-confidence answers but retains the answer itself. Explicitly implement human handoff in your process: an uncertain answer must not trigger an action automatically.
Check quality
Ask the assistant to compare answers with held-out examples and show an error table: expected result, the model’s choice and the action it would trigger. Review short messages, typos, mixed languages, multiple topics and texts lacking needed information separately.
Model confidence can differ from accuracy on your data. Tune the threshold on the tuning set and calculate final results on the test set. Also show the share sent for human review: high accuracy achieved by making almost everything manual may not solve the task.
Long text, questions and choices must fit the model’s available context. Check the actual limit and input truncation. Measure first-download and repeat-request speed separately after checking quality. Methods and comparison tools are in the evaluation documentation.
Fix errors and stop
For import errors, first check which Python runs the command. For download failures, check Hugging Face access and the full error. Investigate memory shortages using the selected model and device; preloading every model increases memory use.
If neighboring categories are confused, clarify their boundaries and add tuning examples. Preserve the old test set. After fixing, repeat comparisons, including cases that worked before.
Stop the process to end a local trial. If Laya already processes inquiries, first switch that step to manual review and check the waiting queue. Keep the model cache for the next run if useful.
Result and next step
The trial produces categories, test examples, an error table, a selected human-handoff rule and measured processing time. That is enough to decide whether the tool helps your process.
Next, incorporate the verified choice into Your first workflow automation. Paste this into Codex to prepare the trial:
Find my project and recurring task for sorting text requests. Prepare a limited Laya trial: clear categories, anonymized examples with correct answers, and separate tuning and test sets. Check official documentation, the environment and computer resources. Use the existing installation if present; install the package and download the first model only under authorized conditions. Distinguish model selection from actual answer computation. Test Russian, ambiguous and long messages. Implement explicit human handoff for uncertain answers, compare errors by category, then measure speed. Save results and a stopping method; connect production processing after acceptance of the trial.
