Skip to main content

LLM redis中介的客户端程序

Project description

llm_client_redis

介绍

整合多种llm 的api接入,使用 redis 作为消息队列,实现多客户端并发调用 llm 服务。本项目是调用部分,还有另一个项目专门用于接收 redis 消息, 实现与 llm 的通信,并将返回结果给 redis,

软件架构

软件架构说明

安装教程

1. 使用 PyPI 安装

pip install llm_client_redis

2. 项目安装

pip install -r requirements.txt

3. 完成安装后进行配置文件初始化

执行如下的命令,可以对 llm-client-redis 生成初始的配置文件

llm-client-init

路径在 ~/.llm-client-redis/config/ 下,分别生成 config.inillm_resources.json 文件

  • config.ini 文件用于配置 redis 的连接信息
  • llm_resources.json 文件用于配置 llm 的信息,包括 llm 的名称,需要与服务器端一致

使用说明

1. python api 调用

llm_client_redis.llm_client.py

一次获取所有回答内容,等待出现相应的时间会较长

from src.llm_client_redis import LLMClientRedis
from langchain_core.messages import BaseMessage, SystemMessage, HumanMessage
from typing import List

llm_client_redis: LLMClientRedis = LLMClientRedis(llm_json_path="../config/llm_resources.json",
                                                  config_path="../config/config.ini")

model: str = "home_qwen3:32b"

messages: List[BaseMessage] = [SystemMessage("你是一个好助手"), HumanMessage("你好")]

data = llm_client_redis.request(messages=messages, model=model)

print(data)

2. cmd 调用

chat-session

进入命令行模式,实现调用

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

特技

  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

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

llm_client_redis-0.1.1.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

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

llm_client_redis-0.1.1-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

Details for the file llm_client_redis-0.1.1.tar.gz.

File metadata

  • Download URL: llm_client_redis-0.1.1.tar.gz
  • Upload date:
  • Size: 34.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for llm_client_redis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1995404e33764107414002fcc688af4b0c570b49c5dff6b96828398450776b25
MD5 157fca50e9546f118fc731ba29912c93
BLAKE2b-256 36f56af0a9b0481e6b9faa9129102dfd3df78aed31c1aec84c0229672ac66db8

See more details on using hashes here.

File details

Details for the file llm_client_redis-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_client_redis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 219b9a944ea13ab267085c3835e29fcf14d38d0e56343679973a4807be125099
MD5 32b9f83dc33f717af5a4f1b34a6a0d5b
BLAKE2b-256 0d1ac992c620006cff9eccc9c01a2af7118764348fc09c03074c83bc9a8523d9

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