NN-фреймворк + AI-инструменты (search/brain/file) + Agent + CLI
Project description
eraCore
NN-фреймворк на NumPy + AI-инструменты + Agent + CLI.
Установка
pip install -e . # из исходников
pip install -e ".[all]" # + llama_cpp, pdf, docx, xlsx
После установки доступна команда era.
CLI — era
Интерактивный AI-агент в терминале (по духу: claude code / gemini cli).
# Интерактивный чат
era
# Одиночный вопрос
era "Что такое backpropagation?"
# Режим
era --mode coder "Пример Dense-слоя на Python"
era --mode expert "Объясни градиентный спуск"
# Вопрос про файл
era --file model.py "Что делает этот файл?"
era --file data.csv "Сколько строк и какие колонки?"
# С Ollama (нужен запущенный ollama)
era --ollama --model qwen2.5:3b "Привет"
era --ollama --model llama3.2 --port 11434
# OpenAI-совместимый endpoint (LM Studio, OpenAI, etc.)
era --llm-url http://localhost:1234/v1 --model mistral "Вопрос"
# Локальный GGUF через llama_cpp
era --gguf ./models/qwen-3b.gguf "Вопрос"
# Без стриминга
era --no-stream "Вопрос"
Команды внутри чата
| Команда | Описание |
|---|---|
/help |
Список команд |
/mode coder |
Сменить режим |
/modes |
Доступные режимы |
/clear |
Очистить контекст сессии |
/memory |
Статистика памяти и кэша |
/file path.py что делает? |
Спросить про файл |
/exit |
Выйти |
AI Tools
eraai.search
from eraCore.tools import search
results = search.run("Python asyncio") # одиночный поиск
results = search.multi(["запрос 1", "запрос 2"]) # параллельный
context = search.context("тема", max_chars=1500) # текст для LLM
eraai.brain
from eraCore.tools import brain
brain.remember("что такое relu", "max(0, x)")
answer = brain.recall("что такое relu?") # difflib, порог 0.82
brain.push("user", "Привет!")
brain.push("assistant", "Привет!")
ctx = brain.context_text(last_n=6)
print(brain.stats())
brain.forget("что такое relu")
brain.clear_knowledge()
brain.clear_context()
eraai.file
from eraCore.tools import file as efile
text = efile.read("report.txt")
data = efile.read_json("config.json")
rows = efile.read_csv("data.csv")
lines = efile.read_lines("log.txt")
efile.write("output.txt", "Hello!")
efile.write_json("result.json", {"ok": True})
efile.append("log.txt", "\nновая строка")
info = efile.info("file.py") # name, size_kb, type, lines
files = efile.list(".", pattern="*.py", recursive=True)
efile.delete("temp.txt")
Agent
import asyncio
from eraCore import Agent
from eraCore.config import AgentConfig
# Без LLM — поиск + кэш
agent = Agent()
# С Ollama
agent = Agent(config=AgentConfig(
llm_url="http://localhost:11434/v1",
llm_model="qwen2.5:3b",
))
# С локальным GGUF
agent = Agent(config=AgentConfig(llm_path="./models/qwen-3b.gguf"))
async def main():
# Вопрос
answer = await agent.ask("Что такое градиентный спуск?")
# Режим
answer = await agent.ask("Пример кода", mode="coder")
answer = await agent.ask("Глубокий анализ", mode="expert")
# Стриминг
async for chunk in await agent.ask("Привет", stream=True):
print(chunk, end="", flush=True)
# Файл
answer = await agent.ask_file("data.csv", "Что за данные?")
# Свой режим
async def translator(question: str, stream: bool = False) -> str:
return f"[перевод] {question}"
agent.add_mode("translate", translator)
# Подключить LLM после создания
agent.set_llm(url="http://localhost:11434/v1", model="qwen2.5:3b")
print(agent.stats())
asyncio.run(main())
LLM
from eraCore.llm import LLM
# Ollama / OpenAI-совместимый
llm = LLM(url="http://localhost:11434/v1", model="qwen2.5:3b")
# llama_cpp (GGUF)
llm = LLM(path="./models/qwen-3b.gguf")
# Mock (для тестов)
llm = LLM()
answer = llm.generate("Вопрос")
for chunk in llm.stream("Вопрос"): print(chunk, end="")
# Async
answer = await llm.agenerate("Вопрос")
async for chunk in llm.astream("Вопрос"): print(chunk, end="")
Neural Network
from eraCore import Model, Dense, ReLU, Softmax
import numpy as np
model = Model([
Dense(784, 256), ReLU(),
Dense(256, 128), ReLU(),
Dense(128, 10), Softmax(),
])
model.compile(optimizer="adam", loss="crossentropy", metrics=["accuracy"])
model.fit(x_train, y_train, epochs=10, batch_size=32)
loss, acc = model.evaluate(x_test, y_test)
preds = model.predict(x_test)
Слои: Dense, Conv2D, MaxPool2D, Flatten, Dropout
Активации: ReLU, Sigmoid, Tanh, Softmax, LeakyReLU, ELU
Оптимизаторы: Adam, SGD, RMSprop, Adagrad
Потери: CrossEntropy, MSE, BinaryCrossEntropy, MAE, HuberLoss
CI
python demo_ci.py
Лицензия
MIT
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 eracore-0.3.0.tar.gz.
File metadata
- Download URL: eracore-0.3.0.tar.gz
- Upload date:
- Size: 38.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47f9fec03483c700ad188f944248397efd4350b427707c3224f5eaa7bf181908
|
|
| MD5 |
e495b9478b657dc1cbdfd6df368c24e6
|
|
| BLAKE2b-256 |
8f24932e39f110c39329abba85eeb3026fcd13104803ae6e43c6f5bbd57d2f3e
|
File details
Details for the file eracore-0.3.0-py3-none-any.whl.
File metadata
- Download URL: eracore-0.3.0-py3-none-any.whl
- Upload date:
- Size: 41.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
788e213e2500e7cda308cff5e2e0f3115e6cd1a86715c0be5f8b956b41c39e3e
|
|
| MD5 |
7cba4d4c87ee7af1769ac0289de29ea2
|
|
| BLAKE2b-256 |
cfee7f53a2b7b5e73b5228a751056849ea611bd456f34e770a9a507bae3b5b34
|