A symbolic coprocessor for LLMs that replaces probabilistic reasoning with verifiable, mathematical guarantees.
Project description
Logos: A Symbolic Coprocessor for LLMs
Logos is a symbolic coprocessor for Large Language Models (LLMs) that replaces probabilistic reasoning with verifiable, mathematical guarantees using the Z3 solver. It acts as a truth guarantor for your most critical AI tasks.
Key Features
- Algebraic Solver: Dynamically parse and solve algebraic equations with integer and real numbers.
- Boolean Logic Solver: Solve classic boolean satisfiability (SAT) problems.
- Rule Engine: Validate data against a user-defined set of rules loaded from an external JSON file.
Installation
Install the official package from PyPI:
pip install logos-solver
Quick Start Examples
Example 1: Algebraic Solver
Create a file example_algebra.py:
from logos.client import Client
logos_client = Client(llm_provider="openai", api_key="DUMMY_API_KEY")
prompt = "Реши уравнение 3*x - y == 5, где x > 0 и y > 0."
response = logos_client.run(prompt)
print(response)
Output:
Решение найдено: x = 2, y = 1. [Проверено Логос: Решение удовлетворяет всем условиям.]
Example 2: Boolean Logic Solver
Create a file example_boolean.py:
from logos.client import Client
logos_client = Client(llm_provider="openai", api_key="DUMMY_API_KEY")
prompt = "Если Алиса идет на вечеринку, то Боб не идет. Если Клара не идет, то Алиса идет. Клара точно не пойдет. Кто в итоге пойдет на вечеринку?"
response = logos_client.run(prompt)
print(response)
Output:
Решение найдено: Алиса = True, Боб = False, Клара = False. [Проверено Логос: Вывод логически корректен.]
Example 3: Rule Engine
First, create a rules.json file:
{
"description": "Compliance rules for transactions",
"rules": [
"amount < 10000",
"risk_score <= 0.85"
]
}
Now, create example_rules.py:
from logos.client import Client
logos_client = Client(llm_provider="openai", api_key="DUMMY_API_KEY")
# This transaction is valid
valid_prompt = "Проверь транзакцию с amount=9500 risk_score=0.7 по набору правил 'rules.json'"
print(f"Valid case: {logos_client.run(valid_prompt)}")
# This transaction is invalid
invalid_prompt = "Проверь транзакцию с amount=12000 risk_score=0.5 по набору правил 'rules.json'"
print(f"Invalid case: {logos_client.run(invalid_prompt)}")
Output:
Valid case: Проверка пройдена. Все 2 правила из 'rules.json' выполнены. [Проверено Логос: Соответствие подтверждено.]
Invalid case: Проверка провалена. Данные нарушают одно или несколько правил из 'rules.json'. [Проверено Логос: Обнаружено несоответствие.]
Project details
Release history Release notifications | RSS feed
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 logos_solver-0.1.0.tar.gz.
File metadata
- Download URL: logos_solver-0.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c72ca8335810161745e35a46db3c463956183baf3d1da1864e38f0d437b92a23
|
|
| MD5 |
42ab8764eb2710fbc9b12deff51b55ee
|
|
| BLAKE2b-256 |
74ce88f355b7aec598481ec9c5e8b1f61762cbb1848ccf9903b0e843a6ea2887
|
File details
Details for the file logos_solver-0.1.0-py3-none-any.whl.
File metadata
- Download URL: logos_solver-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a3013787f88cd673263f083f6a6b2b82e04b428d0ae14d17c5b496840b8b606
|
|
| MD5 |
3b75c283ee02adcc3b9a15a55863e75d
|
|
| BLAKE2b-256 |
b7c043f107cae913532ab612c552399992ba49fc178837b91523fc0649e4e553
|