Skip to main content

A Python library for interacting with various language model APIs

Project description

This is a personal library developed by Qichang Zheng.

Installation

pip install qichang

LLM Conversation

For single conversation

import qichang
llm = qichang.LLM_API()
llm.chat('GPT3.5', 'Hello, how are you?')
llm.chat('GPT4', 'Hello, how are you?')

For multi-turn conversation

We currently have two servers in Virginia and Singapore. This function will automatically choose the server with the lowest latency, but you can also manually set the server.

import qichang
llm = qichang.LLM_API()
# Manually set the server
# llm.server = 'Virginia'
# llm.server = 'Singapore'
# Here we need to specify the chatID (string) to distinguish different conversations
llm.chat('GPT3.5', 'Hello, how are you?', 'ChatID')
llm.chat('GPT4', 'What did I just asked?', 'ChatID')

Model Downloader

This is a tool to download the huggingface models in China. Note that this function only works for some models, the author is working on further improvement.

import qichang
downloader = qichang.Model_Downloader()
downloader.download('Qwen/Qwen-7B-Chat', 'test') # Download the model to the folder 'test'

Davinci Embedding

This is a tool to get the embedding of the text from the Davinci model.

import os
import qichang

os.environ["OPENAI_API_KEY"] = "your_api_key"

Embedder = qichang.Embedder()
Embedder.embedding('Hello, how are you?')

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

qichang-0.0.59.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

qichang-0.0.59-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file qichang-0.0.59.tar.gz.

File metadata

  • Download URL: qichang-0.0.59.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for qichang-0.0.59.tar.gz
Algorithm Hash digest
SHA256 bf758a89fbde68ee63c8d383aa8a5da02cf1a70fe69862ce1dd016051ffab6d6
MD5 15c7871e4a614c4074561b455ab39ff6
BLAKE2b-256 9a98f5b02892c802900e7e37244f0f447b8823332acde75769d13c8f495b856e

See more details on using hashes here.

File details

Details for the file qichang-0.0.59-py3-none-any.whl.

File metadata

  • Download URL: qichang-0.0.59-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for qichang-0.0.59-py3-none-any.whl
Algorithm Hash digest
SHA256 4d1418ec2000203ef1ed798a2d2f7e803d22073401626bfbfc2e4c10a3091c7f
MD5 5643d65b2f34d99d28bf70ff004bf2c3
BLAKE2b-256 441e8eadeda4e1c6b11ac76d97e9a7c221a6a8d2704b9b9f2bd79816f216f74e

See more details on using hashes here.

Supported by

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