Observed since 21 Oct, 11:09 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A creative idea involves wrapping the OpenAI library to facilitate seamless connections with domestic large models. This project emerged precisely because large model interfaces are compatible with OpenAI, making it easier to utilize large models compared to traditional methods.
AILink is a library that mainly connects to the use of domestic large models, which is encapsulated and implemented based on compatible OpenAI interfaces. Through the AILink library, users only need to configure a {PROVIDER}_API_KEY to quickly connect and use domestic large models, which is quite convenient.
their corresponding large models include:
For the model list corresponding to the provider, refer to the article OpenAI库牵手国产大模型,一键解锁!超全参数配置秘籍来袭
The minimum required version of Python is >=3.10.
The installation command is as follows:
pip install AILink
AILink will retain the same interface as OpenAI, and is fully compatible with OpenAI's usage, except for the instantiation of objects.
Before executing the code, you need to set up environment variables, for example:
export BAICHUAN_API_KEY=sk-?
The environment variables for other providers are set in a similar pattern, following the {PROVIDER}_API_KEY format. Here, PROVIDER should be replaced with the name of the provider as listed in "The Supported Providers," using all uppercase letters.
For example, the following case:
# - 阿里云[aliyun]
export ALIYUN_API_KEY=sk-?
# AILink(model="aliyun:qwen-plus")
# - 百度[baidu]
export BAIDU_API_KEY=sk-?
# AILink(model="baidu:ernie-4.0-8k-latest")
# - 智谱[zhipu]
export ZHIPU_API_KEY=sk-?
# AILink(model="zhipu:GLM-4-Plus")
# - 字节跳动[bytedance]
export BYTEDANCE_API_KEY=sk-?
# AILink(model="bytedance:Doubao-lite-4k")
from ailink import AILink
client = AILink(model="baichuan:Baichuan4-Turbo")
# 创建聊天请求
response = client.chat.completions.create(
stream=True,
messages=[{'role': 'user', 'content': '今天是星期几'}] # 用户输入的信息
)
for chunk in response:
print(chunk.choices[0].delta.content, end="", flush=True)
from ailink import AILink
client = AILink(api_key='sk-?', base_url='https://api.baichuan-ai.com/v1')
# 创建聊天请求
response = client.chat.completions.create(
stream=True,
messages=[{'role': 'user', 'content': '今天是星期几'}] # 用户输入的信息
)
for chunk in response:
print(chunk.choices[0].delta.content, end="", flush=True)
from ailink import AILink
client = AILink(model="baichuan:Baichuan4-Turbo", api_key='sk-?')
# 创建聊天请求
response = client.chat.completions.create(
stream=True,
messages=[{'role': 'user', 'content': '今天是星期几'}] # 用户输入的信息
)
for chunk in response:
print(chunk.choices[0].delta.content, end="", flush=True)
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.0.7 | 27 Dec 2024 | 2 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 11:09 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:d3641fc061f78d7e19e1782e45033702eb664039228f6d26a4df0e69294b9a96