semvec/pypi-packages huggingface dataset:
fuckllm 0.1.0
A comprehensive AI agent framework with memory, tools, and TTS capabilities
Requires Python: >=3.10
Keywords: ai, agent, memory, tts, llm

# Mini AI

一个功能完整的 AI Agent 框架，支持记忆管理、工具调用、TTS（文字转语音）等功能。

## 功能特性

- 🤖 **Agent 系统**: React 模式的智能代理，支持工具调用和推理
- 🧠 **记忆管理**: Memory Card 和 Memory State 系统，实现长期记忆和短期状态管理
- 🔧 **工具集成**: 支持自定义工具和 MCP (Model Context Protocol) 工具
- 🗣️ **TTS 支持**: 集成阿里云 CosyVoice 和 Qwen TTS
- 💾 **向量数据库**: 支持 ChromaDB 和自定义 JSON 向量存储
- 🎯 **多模型支持**: 兼容 OpenAI、智谱 AI、阿里云等多种 LLM 提供商

## 安装

### 基础安装

```bash
pip install -e .
```

### 安装包含 TTS 功能

```bash
pip install -e ".[tts]"
```

### 安装包含向量数据库功能

```bash
pip install -e ".[vectordb]"
```

### 完整安装（包含所有功能）

```bash
pip install -e ".[full]"
```

### 开发模式安装

```bash
pip install -e ".[dev]"
```

## 快速开始

### 1. 配置环境变量

创建 `.env` 文件或设置环境变量：

```bash
# OpenAI 兼容的 API
export zhipuai_api_key="your_zhipuai_key"
export siliconflow_api_key="your_siliconflow_key"
export ark_api_key="your_ark_key"

# 阿里云（用于 TTS）
export ali_api_key="your_ali_key"
```

### 2. 使用基础 Agent

```python
from mini_ai.agent import Agent
from mini_ai.model import Chater
from mini_ai.config import zhipuai_config
from mini_ai.tools import ToolKits

# 初始化模型
model = Chater(zhipuai_config().to_dict())

# 创建工具集
tool_kits = ToolKits()

@tool_kits.tool()
def get_weather(city: str):
    """获取指定城市的天气信息
    
    Args:
        city: 城市名称
    
    Returns:
        str: 天气信息
    """
    return f"{city} 今天晴天，温度25度"

# 创建 Agent
agent = Agent(
    model=model,
    tool_kits=tool_kits,
    system_prompt="你是一个有用的AI助手"
)

# 使用 Agent
import asyncio
async def main():
    response = await agent("今天北京天气怎么样？")
    
asyncio.run(main())
```

### 3. 使用记忆管理

```python
from mini_ai.agent import AgenticMemory
from mini_ai.model import Chater, Embedder
from mini_ai.config import zhipuai_config

chater = Chater(zhipuai_config().to_dict())
embedder = Embedder(zhipuai_config().to_dict())

memory = AgenticMemory(chater, embedder)

# 使用记忆系统
# ... (详见文档)
```

### 4. 使用 TTS

```python
from mini_ai.tts._tts_cache import AliTTS

tts = AliTTS(
    api_key="your_ali_key",
    default_model="cosyvoice-v2",
    default_voice="longxiaochun_v2"
)

# 合成语音
result = tts.cosyvoice_synthesize(
    text="你好，这是一个测试",
    voice="longxiaochun_v2"
)

print(f"音频文件保存在: {result.file_path}")
```

## 项目结构

```
mini_ai/
├── agent/          # Agent 实现（React, Memory, 角色扮演等）
├── config/         # 配置管理（模型配置、打印配置、TTS配置）
├── format/         # 格式化工具（Memory 格式化、MCP 格式化、打印格式化）
├── memory/         # 记忆系统（即时记忆）
├── model/          # 模型调用（Chat、Embedding）
├── prompt/         # 提示词模板（Memory Card、Cursor等）
├── tools/          # 工具系统（工具注册、MCP 支持）
├── tts/            # 文字转语音（阿里云、Qwen）
├── type/           # 类型定义
├── utils/          # 工具函数（文件操作、缓存等）
└── vb/             # 向量数据库（Chroma、JSON）
```

## 支持的模型

- ✅ 智谱 AI (GLM-4.5)
- ✅ SiliconFlow
- ✅ 火山引擎 ARK
- ✅ 阿里云 Qwen
- ✅ 任何 OpenAI 兼容的 API

## 许可证

MIT License

## 贡献

欢迎提交 Issue 和 Pull Request！
fastapi-globals 0.2.1
Use request global variables in FastAPI
Requires Python: >=3.10

# `fastapi-globals`

Allows you to use request global values. Can be used to store request speficic data, like state, database
connection, etc.

## Installation

Just use `pip install fastapi-globals` to install the library.

**Note:** `fastapi-globals` is compatible with `fastapi` versions `0.100.0` and later on
Python `3.10`, `3.11`, `3.12` and `3.13`. This is also ensured running all tests on all those versions
using `tox`.

## Setup

Add the `GlobalsMiddleware` to your app:
```python
app = fastapi.FastAPI(
    title="Your app API",
)
app.add_middleware(GlobalsMiddleware)  # <-- This line is necessary
```

## Usage

Import `g` and then access (set/get) attributes of it:
```python
from fastapi_globals import g


g.foo = "foo"

# In some other code
assert g.foo == "foo"
```

Best way to utilize the global `g` in your code is to set the desired
value in a FastAPI dependency, like so:
```python
async def set_global_foo() -> None:
    g.foo = "foo"


@app.get("/test/", dependencies=[Depends(set_global_foo)])
async def test():
    assert g.foo == "foo"
```

## Default values

You may use `g.set_default("name", some_value)` to set a default value
for a global variable. This default value will then be used instead of `None`
when the variable is accessed before it was set.

Note that default values should only be set at startup time, never
inside dependencies or similar. Otherwise you may run into the issue that
the value was already used any thus have a value of `None` set already, which
would result in the default value not being used.
pydantic-apply 0.8.1
Apply changes as patches to pydantic models.
Requires Python: >=3.10

# pydantic-apply

## Installation

Just use `pip install pydantic-apply` to install the library.

**Note:** `pydantic-apply` is compatible with `pydantic` version `2.x` on Python `3.10`, `3.11`, `3.12`
and `3.13`. This is also ensured running all tests on all those versions using `tox`.

## About

With `pydantic-apply` you can apply changes to your pydantic models by using
the `ApplyModelMixin` it provides:

```python
import pydantic

from pydantic_apply import ApplyModelMixin


class Something(ApplyModelMixin, pydantic.BaseModel):
    name: str
    age: int


obj = Something(name='John Doe', age=42)
obj.model_apply({
    "age": 43,
})
assert obj.age == 43
```

As the apply data you may pass any dictionary or other pydanic object as you
wish. pydantic objects will be converted to dict's when being applied - but will
only use fields that where explicitly set on the model instance. Also note
that `.apply()` will ignore all fields not present in the model, like the
model constructor would.

### Nested models

`pydantic-apply` will also know how to apply changes to nested models. If those
models are by themself subclasses of `ApplyModelMixin` it will call `apply()`
on those fields as well. Otherwise the whole attribute will be replaced.

### Apply changes when using `validate_assignment`

When your models have `validate_assignment` enabled it may become tricky to
apply changes to the model. This is due to the fact that you only can assign
fields once at a time. But with `validate_assignment` enabled this means each
field assignment will trigger its own validation and this validation might
fail as the model state is not completely changes and thus in a "broken"
intermediate state.

`pydantic-apply` will take care of this issue and disable the validation for
each assignment while applying the changes. It will also ensure the resulting
object will still pass the validation, so you don't have to care about this
case at all.

# Contributing

If you want to contribute to this project, feel free to just fork the project,
create a dev branch in your fork and then create a pull request (PR). If you
are unsure about whether your changes really suit the project please create an
issue first, to talk about this.