Anyscale
无缝集成 Anyscale 端点与 Portkey,使您的 OSS 模型具备生产就绪状态
Portkey SDK 与 Anyscale 的集成
1. 安装 Portkey SDK
npm install --save portkey-aipip install portkey-ai2. 使用 Anyscale 虚拟密钥初始化 Portkey
import Portkey from 'portkey-ai'
const portkey = new Portkey({
apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
virtualKey: "ANYSCALE_VIRTUAL_KEY" // Your Anyscale Virtual Key
})from portkey_ai import Portkey
portkey = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
virtual_key="ANYSCALE_VIRTUAL_KEY" # Replace with your virtual key for Anyscale
)3. 使用 Anyscale 调用聊天完成
const chatCompletion = await portkey.chat.completions.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'mistralai/Mistral-7B-Instruct-v0.1',
});
console.log(chatCompletion.choices);completion = portkey.chat.completions.create(
messages= [{ "role": 'user', "content": 'Say this is a test' }],
model= 'mistralai/Mistral-7B-Instruct-v0.1'
)
print(completion.choices)直接使用 Portkey 的 REST API
使用 OpenAI Python 或 Node SDK 进行 Anyscale
管理 Anyscale 提示
创建提示

使用提示
支持的模型列表
模型名称
Portkey上的模型键
高级用例
流式响应
微调

Portkey 功能
Last updated