hryvinskyi / magento2-llm-systemone
Typed-question services for hryvinskyi/magento2-llm: the systemone protocol, as served by jev-ai.pro and compatible endpoints
Package info
github.com/hryvinskyi/magento2-llm-systemone
Type:magento2-module
pkg:composer/hryvinskyi/magento2-llm-systemone
Requires
- php: ^8.2
- hryvinskyi/magento2-llm: ^1.0
- magento/framework: *
- magento/module-config: *
- psr/log: ^1.1 || ^2.0 || ^3.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Typed-question services for hryvinskyi/magento2-llm: the systemone protocol, as served by jev-ai.pro and compatible endpoints.
What it does
A typed-question service answers questions about a text (yes/no, or one of a set of choices) with probabilities, which the AI module turns into decisions for the features that ask for them. This module speaks the systemone protocol for that ability only; it does not write texts.
- Jev (
jev): requests go tohttps://jev-ai.pro/api, modeljev-latest; enter the API key. - Custom typed-question endpoint (
systemone_custom): a service at an address you choose that answers the same protocol; set the endpoint, the model and the key.
Requirements and installation
PHP 8.2 or higher, hryvinskyi/magento2-llm, psr/log and the platform's Config module (what composer.json and etc/module.xml declare).
composer require hryvinskyi/magento2-llm-systemone bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:flush
Then choose the provider for decisions in Stores › Configuration › Hryvinskyi Extensions › AI Models › Decisions and enter its key in its group. The setup wizard offers writing providers only, so a decision provider is set on the configuration page.
Settings paths
Every field at the default scope:
- Jev:
hryvinskyi_llm/provider_jev/credential. - Custom typed-question endpoint:
hryvinskyi_llm/provider_systemone_custom/endpoint,model,credential. After the endpoint changes, the key is entered again.
The key is stored encrypted, sent only to the endpoint it was saved for, in the Authorization header as a bearer token, and never in the path or the body.
The wire
One request is POST <endpoint>/v1/systemone with {"state": …, "model": …, "questions": {id: question}}; the answer is {"answers": {id: answer}, "usage": {"input_tokens": n, "output_tokens": n}, "model": "…"}.
- Bounds, kept before anything is sent. A request carries at most 64 questions and stays under 240 000 bytes. A decision over either bound is split by questions, in their order, into several requests, each repeating the state. The state is never cut: a state estimated above 20 000 tokens, or one that alone would not fit, ends the decision as
failedwithstate_too_large, and a question that does not fit beside the state withquestion_too_large; nothing is sent. - Answers are read field by field. An answer that cannot be read is that question's unreadable answer and the others stand; an answer to a question that was not asked is ignored; a body without an
answersobject ends the decision asmalformedwithunreadable_body. Tokens are counted from any body that holds them, so a call the service billed is counted even when its answer cannot be used. - The model name shown in the admin and kept in the journal is the one the answer names when it is 1–128 characters of
[A-Za-z0-9._:-]and does not hold the key, else the one asked for. - The first part of a split decision that is not answered ends the decision with its outcome and reason, and the parts after it are not sent.
Connection test
The test is the cheapest real request: one yes/no question over a one-word state, sent with the connection's model and key exactly as a decision is. The protocol has no model list.
What it adds to the AI module
All in the global etc/di.xml: the protocol systemone in the decision protocols, its probe, the wire of each question kind, the providers jev and systemone_custom, and both credential paths marked sensitive.
Translations
The admin wording ships in en_US and 25 more locales: the official languages of the European Union, Norwegian Bokmål and Ukrainian. The translations are machine-made; have them read by a native speaker before a store relies on them.
Tests
- Unit:
vendor/bin/phpunit -c app/code/Hryvinskyi/LlmSystemOne/phpunit.xml.dist. - Integration: the platform's harness in
dev/tests/integration.