semvec/pypi-packages huggingface dataset:
pdm-pfsc 0.13.3
Core functionPlug-In Foundation Service Collection)
License: MIT
Requires Python: >=3.9

# Plug-In Foundation Services Collection

The [Python Development Master](https://pdm-project.org) offers various extension points.

You can either add plug-ins or signals. Some parts are not very intuitive for the
experienced python developer who are used to work with python standard libraries like logging or
is hard to test as there are some points that are not that easy to test.

This collection offers a set of services helping to write better plug-ins.

## `abstractions`

This module provides three protocols, that will abstract PDM core and PDM project classes, so
that they can easily mocked in unit tests.

## `actions`

Actions are a collection of actions to run. This can be useful, if you
want to add different verbal commands.

Each of this action can add options to the parser. They all can be
registered in an `ActionRegistry`. This provides an instance method called `register`
which can be used to decorate implementations of `ActionBase`.

## `config`

The configuration section is unstable.

## `hook`

Hooks surround `actions` by hooks - an action can provide an implementation of
the `HookGenerator` protocol, that must emit instances of `HookInfo`, a dataclass
that gives information about the `HookBase` class to instantiate and run
before and after the action is executed itself.

## `logging`

The `logging` module provides a logger based on the python standard logging facilities.

The `TermUIHandler` uses `pdm.core.ui.echo` to write data to a log. The `TracingLogger` is
created to add a log-level called `TRACE` to the logging, which is later used by `traced_function`.

The default instance for the logging is added in the `logger` variable. It's default value
can be set using `setup_logger`. The value passed is identical to the `verbose` level
of the `pdm` invocation arguments.

The decorator `traced_function` can be used to decorate a function for tracing the sequence of
events - just like `set -x` does in POSIX scripts.

## `proc`

The `CliRunnerMixin` allows you to run child-processes from your plug-in or signal.
It offers a class-var called `run_process`, that has the same signature like
`subprocess.run` from the python standard library, but can be overwritten for your tests.
effimemo 0.1.1
A Python package for managing LLM context windows
License: MIT
Requires Python: >=3.8
Keywords: llm, context, management, token, window, ai, chatbot

# EffiMemo

一个用于管理大语言模型（LLM）上下文窗口的Python包。

## 功能特性

- 智能上下文管理：自动管理对话历史，确保不超过token限制
- 多种裁切策略：支持first、last和selective策略
- 灵活配置：可自定义最大token数、模型类型等参数
- 系统消息保护：可选择性保留重要的系统消息

## 安装

```bash
pip install effimemo
```

## 快速开始

```python
from effimemo import create_context_manager

# 创建上下文管理器
manager = create_context_manager(
    max_tokens=8192,
    model_name="gpt-4",
    strategy="last",
    preserve_system=True
)

# 使用管理器处理对话
messages = [
    {"role": "system", "content": "你是一个有用的助手"},
    {"role": "user", "content": "你好"},
    {"role": "assistant", "content": "你好！有什么可以帮助你的吗？"}
]

# 管理上下文
managed_messages = manager.manage_context(messages)
```

## API文档

### create_context_manager

创建上下文管理器实例。

**参数：**
- `max_tokens` (int): 最大token数量，默认8192
- `model_name` (str): 模型名称，默认"gpt-4"
- `strategy` (str): 裁切策略，可选"first"、"last"或"selective"，默认"last"
- `preserve_system` (bool): 是否保留系统消息，默认True

**返回：**
- `ContextManager`: 上下文管理器实例

## 许可证

MIT License

## 作者

Manus AI