Skip to main content

本地大语言模型对话的持久记忆与回溯系统

Project description

JiXing

Local AI Model Assistant with Long-term Memory System.

A unified tool to run local AI models (Ollama, Moxing) with complete logging of all interactions for later retrieval.

Features

  • Multi-Provider Support: Run models from Ollama and Moxing with unified interface
  • Complete Logging: Records all prompts, responses, timestamps, system info, and performance metrics
  • Long-term Memory: SQLite-based storage for searching through all past interactions
  • Web Interface: Optional Flask-based web UI for browsing sessions and searching messages
  • CLI Interface: Full-featured command-line tool with subcommands
  • Python API: Programmatic access via ToolResult pattern
  • OpenAI Function Calling: Integrate with OpenAI agents via function tool definitions

Requirements

  • Python 3.10+
  • Ollama (optional, for Ollama model support)
  • Moxing (optional, for GGUF model support)
  • Flask (optional, for web interface)

Installation

pip install -e .

Quick Start

CLI Usage

Run an Ollama model:

jixing ollama run gemma3:1b "Hello, how are you?"

Run in interactive mode:

jixing ollama run gemma3:1b -i

Run a Moxing (GGUF) model:

jixing moxing serve gguf-model-name "Your prompt here"

List all sessions:

jixing sessions list

Search through message history:

jixing search "previous conversation about Python"

Show statistics:

jixing stats

Start web interface:

jixing web --port 5000

Python API

from jixing import run_ollama, query_sessions, ToolResult

result = run_ollama(model="gemma3:1b", prompt="Hello!")
print(result.success)    # True / False
print(result.data)       # Response data
print(result.metadata)   # Metadata including version

CLI Help

$ jixing --help
usage: jixing [-h] [-V] [-v] [-o OUTPUT] [--json] [-q] {ollama,moxing,sessions,search,stats,info,web} ...

positional arguments:
  {ollama,moxing,sessions,search,stats,info,web}
    ollama              Run Ollama model
    moxing              Run Moxing model
    sessions            Manage sessions
    search              Search message history
    stats               Show statistics
    info                Show system information
    web                 Start web interface

options:
  -V, --version         Show version
  -v, --verbose         Verbose output
  -o, --output OUTPUT   Output path
  --json                Output results as JSON
  -q, --quiet           Suppress non-essential output

Architecture

jixing/
├── jixing/
│   ├── __init__.py     # Package exports
│   ├── __version__.py  # Version info
│   ├── core.py         # Core logic, Session, ModelRunner
│   ├── api.py          # ToolResult API functions
│   ├── cli.py          # CLI interface
│   ├── db.py           # SQLite database
│   ├── models/         # Model adapters
│   ├── tools.py        # OpenAI function definitions
│   └── web.py          # Flask web interface
├── tests/
├── pyproject.toml
└── README.md

Agent Integration

Integrate JiXing with OpenAI function-calling agents:

from openai import OpenAI
from jixing.tools import TOOLS, dispatch

client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Run Ollama model gemma3:1b with prompt 'Hello'"}],
    tools=TOOLS,
)

for tool_call in response.choices[0].message.tool_calls:
    result = dispatch(tool_call.function.name, tool_call.function.arguments)
    # Feed result back to LLM...

License

GPL-3.0

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

jixing-1.0.3.tar.gz (62.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jixing-1.0.3-py3-none-any.whl (49.0 kB view details)

Uploaded Python 3

File details

Details for the file jixing-1.0.3.tar.gz.

File metadata

  • Download URL: jixing-1.0.3.tar.gz
  • Upload date:
  • Size: 62.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for jixing-1.0.3.tar.gz
Algorithm Hash digest
SHA256 40a5dd4f043ecab24c4ee3171d5ee7f04e30781f84826b6219b8e8159c1a96dd
MD5 1faa60d0d9724a872deacffd04fb7efb
BLAKE2b-256 d52739819f03f98515c3521f3004f822fff74fccf3440d462dfe2d209da0e6ad

See more details on using hashes here.

File details

Details for the file jixing-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: jixing-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 49.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for jixing-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 571422eabf96248f6638af070bad68c343dc385eceffa972a7a8bf9956facdfe
MD5 efae0a7d9a5862386be8fe888ab6b17d
BLAKE2b-256 140e97e56638008ebab1447764511abf137925eae222f7188451351537ebe69a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page