chore: import upstream snapshot with attribution
Check Markdown links / linkChecker (push) Has been cancelled
Check Markdown links / linkChecker (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
<p align="right">
|
||||
<strong>English</strong>|<a href="https://github.com/Portkey-AI/gateway/blob/main/.github/cn.CODE_OF_CONDUCT.md">中文</a>
|
||||
</p>
|
||||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
support@portkey.ai.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
||||
@@ -0,0 +1,40 @@
|
||||
## 🎉 欢迎
|
||||
你好,感谢你考虑为Portkey的AI网关做出贡献!无论你是在报告一个bug,建议一个功能,改进文档,还是编写代码,你的贡献对我们来说都是非常宝贵的。
|
||||
|
||||
## 🚀 快速开始
|
||||
1. 在Github上Fork仓库。
|
||||
2. 将你fork的仓库克隆到你的机器上。
|
||||
```sh
|
||||
$ git clone https://github.com/YOUR_USERNAME/gateway.git
|
||||
```
|
||||
|
||||
## 🖋 贡献类型
|
||||
1. 新的集成:为其他LLM供应商或总体供应商创建集成。
|
||||
2. Bug修复
|
||||
3. 增强
|
||||
4. 文档
|
||||
5. **Hacktoberfest** 提交!
|
||||
|
||||
|
||||
## 🗓️ Hacktoberfest
|
||||
在 [Hacktoberfest 月](https://hacktoberfest.com/)期间,从10月1日到31日,您被接受的 PR 将计入您的 Hacktoberfest 参与度!🚀
|
||||
✅ 要获得接受,您的 PR 必须被合并、批准或贴上 `hacktoberfest-accepted` 标签。
|
||||
🧐 记得遵守 [质量标准](https://hacktoberfest.digitalocean.com/resources/qualitystandards)以避免您的 PR 被标记为 `垃圾邮件` 或 `无效`。
|
||||
## 🔄 提交 PR
|
||||
1. 完成您的更改后,通过运行以下命令来格式化和 Lint 您的代码:
|
||||
```sh
|
||||
make format; make lint
|
||||
```
|
||||
2. 在提交 PR 时,请在标题前添加以下任何一个:
|
||||
* `provider:` 添加新的 LLM 提供商。
|
||||
* `integration:` 新的集成。
|
||||
* `docs:` 新的指南、文档添加等。
|
||||
* `improvement:` 改进或增强。
|
||||
* `bug:` 修复错误。
|
||||
* `hacktoberfest:` Hacktoberfest 贡献。
|
||||
## 🤔 寻求帮助
|
||||
遇到问题或有疑问?请毫不犹豫地在我们的 [Discord 社区](https://discord.com/invite/DD7vgKK299) 分享您的疑问或问题 - 这是获得支持和与其他贡献者联系的最快方式。
|
||||
## 🚧 发布流程
|
||||
我们尽快进行发布,以确保新功能和修复能快速地到达用户手中。我们遵循无缝的 CI/CD 流水线,以确保代码从开发到生产的平稳过渡。
|
||||
## 🎊 您的 PR 被合并了!
|
||||
所有成功的 PR 都会在我们的 [Discord](https://discord.com/invite/DD7vgKK299) 上庆祝,并在发布说明中提及,重大贡献将在我们的 [Twitter](https://twitter.com/PortkeyAI) 上突出显示。请继续关注,未来我们将为贡献者提供更多奖金和礼品!
|
||||
@@ -0,0 +1,45 @@
|
||||
## 🎉 Welcome
|
||||
Hello and thank you for considering contributing to Portkey's AI Gateway! Whether you're reporting a bug, suggesting a feature, improving documentation, or writing code, your contributions are invaluable to us.
|
||||
|
||||
## 🚀 Quick Start
|
||||
1. Fork the repository on Github.
|
||||
2. Clone your forked repository to your machine.
|
||||
```sh
|
||||
$ git clone https://github.com/YOUR_USERNAME/gateway.git
|
||||
```
|
||||
|
||||
## 🖋 Types of Contributions
|
||||
1. New integrations: Creating integrations for other LLM providers or vendors in general.
|
||||
2. Bug fixes
|
||||
3. Enhancements
|
||||
4. Documentation
|
||||
5. **Hacktoberfest** submissions!
|
||||
|
||||
## 🗓️ Hacktoberfest
|
||||
During the [Hacktoberfest month](https://hacktoberfest.com/), running from October 1st to 31st, your accepted PR will count towards your Hacktoberfest participation! 🚀
|
||||
|
||||
✅ To gain acceptance, your PR must be merged, approved, or tagged with the `hacktoberfest-accepted` label.
|
||||
|
||||
🧐 Remember to adhere to the [quality standards](https://hacktoberfest.digitalocean.com/resources/qualitystandards) to avoid your PR being marked as `spam` or `invalid`.
|
||||
|
||||
## 🔄 Raising PRs
|
||||
1. Once you are done with your changes, format and Lint your code by running:
|
||||
```sh
|
||||
make format; make lint
|
||||
```
|
||||
2. While raising your PRs, please prepend any of the following to your title:
|
||||
* `provider:` for adding new LLM providers.
|
||||
* `integration:` for new integrations.
|
||||
* `docs`: for new cookbooks, doc additions, etc.
|
||||
* `improvement:` for improvements or enhancements.
|
||||
* `bug:` for bug fixes.
|
||||
* `hacktoberfest:` for Hacktoberfest contributions
|
||||
|
||||
## 🤔 Getting Help
|
||||
Facing issues or have questions? Don't hesitate to share your doubts or questions on our [Discord Community](https://discord.com/invite/DD7vgKK299) - this is the quickest way to get support and connect with other contributors.
|
||||
|
||||
## 🚧 Release Process
|
||||
Releases are made as soon as possible to ensure that new features and fixes reach our users quickly. We follow a seamless CI/CD pipeline to ensure the smooth transition of code from development to production.
|
||||
|
||||
## 🎊 Your PR is Merged!
|
||||
All successful PRs are celebrated on our [Discord](https://discord.com/invite/DD7vgKK299) and are mentioned in the release notes, and significant contributions are highlighted on our [Twitter](https://twitter.com/PortkeyAI). Stay tuned for more bounties and goodies for contributors in the near future!
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Bug Report
|
||||
description: Report any issue with the project
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: What Happened?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected-behavior
|
||||
attributes:
|
||||
label: What Should Have Happened?
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: code-snippet
|
||||
attributes:
|
||||
label: Relevant Code Snippet
|
||||
validations:
|
||||
required: false
|
||||
- type: input
|
||||
id: contact
|
||||
attributes:
|
||||
label: Your Twitter/LinkedIn
|
||||
description: When the bug get fixed, we'd like to thank you publicly for reporting it.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,8 @@
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Discord for Support & Discussions
|
||||
url: https://discord.com/invite/DD7vgKK299
|
||||
about: Hang out with the community of LLM practitioners and resolve your issues fast
|
||||
- name: Get on a Call
|
||||
url: https://calendly.com/rohit-portkey/noam
|
||||
about: Get a tailored demo for your use cases
|
||||
@@ -0,0 +1,25 @@
|
||||
name: Feature Request
|
||||
description: Suggest a new provider to integrate, new features, or something more
|
||||
title: "[Feature] "
|
||||
labels: ["enhancement"]
|
||||
body:
|
||||
- type: textarea
|
||||
id: feature
|
||||
attributes:
|
||||
label: What Would You Like to See with the Gateway?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Context for your Request
|
||||
description: Why you want this feature and how it beneits you.
|
||||
validations:
|
||||
required: false
|
||||
- type: input
|
||||
id: contact
|
||||
attributes:
|
||||
label: Your Twitter/LinkedIn
|
||||
description: If we work on this request, we'd like to thank you publicly for suggesting it.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,230 @@
|
||||
<div align="center">
|
||||
<img src="/docs/images/gateway-border.png" width=350>
|
||||
|
||||
<p align="right">
|
||||
<a href="../README.md">English</a> | <strong>中文</strong> | <a href="./README.jp.md">日本語</a>
|
||||
</p>
|
||||
|
||||
# AI Gateway
|
||||
|
||||
### 通过一个快速友好的API链接超过100个大型语言模型。
|
||||
|
||||
[](./LICENSE)
|
||||
[](https://portkey.ai/community)
|
||||
[](https://twitter.com/portkeyai)
|
||||
[](https://www.npmjs.com/package/@portkey-ai/gateway)
|
||||
<!--  -->
|
||||
|
||||
</div>
|
||||
<br><br>
|
||||
|
||||
[Portkey的AI网关](https://portkey.ai/features/ai-gateway) 是您的应用程序与托管的大型语言模型(LLMs)之间的接口。它通过统一的API简化了对OpenAI、Anthropic、Mistral、LLama2、Anyscale、Google Gemini等的API请求。
|
||||
|
||||
✅ 极速响应(快9.9倍),占用空间极小(安装后约45kb)<br>✅ 跨多个模型、提供商和密钥进行**负载均衡**<br>✅ 通过**备用方案**确保应用程序的稳定性<br>✅ 默认提供具有指数级备用方案的**自动重试**<br>✅ 根据需要插入中间件<br>✅ 经过超过**1000亿令牌**的实战测试<br> <br>
|
||||
|
||||
## 入门指南
|
||||
|
||||
### 安装
|
||||
|
||||
如果您熟悉Node.js和`npx`,您可以在本地运行您的私有AI网关。
|
||||
|
||||
```
|
||||
npx @portkey-ai/gateway
|
||||
```
|
||||
|
||||
<sup>
|
||||
[ 其它部署选项 ]
|
||||
<a href="https://portkey.wiki/gh-18"><img height="12" width="12" src="https://cfassets.portkey.ai/logo/dew-color.svg" /> Portkey Cloud 官方部署(推荐)</a>
|
||||
<a href="../docs/installation-deployments.md#docker"><img height="12" width="12" src="https://cdn.simpleicons.org/docker/3776AB" /> Docker</a>
|
||||
<a href="../docs/installation-deployments.md#nodejs-server"><img height="12" width="12" src="https://cdn.simpleicons.org/node.js/3776AB" /> Node.js</a>
|
||||
<a href="../docs/installation-deployments.md#cloudflare-workers"><img height="12" width="12" src="https://cdn.simpleicons.org/cloudflare/3776AB" /> Cloudflare</a>
|
||||
<a href="../docs/installation-deployments.md#replit"><img height="12" width="12" src="https://cdn.simpleicons.org/replit/3776AB" /> Replit</a>
|
||||
<a href="../docs/installation-deployments.md"> 其它...</a>
|
||||
|
||||
</sup>
|
||||
> 您的AI网关现在运行在 [http://localhost:8787](http://localhost:8787/) 🚀 <br>
|
||||
|
||||
### 使用方法
|
||||
|
||||
让我们尝试通过AI网关向OpenAI发起一个**聊天**请求:
|
||||
|
||||
```
|
||||
bashCopy codecurl '127.0.0.1:8787/v1/chat/completions' \
|
||||
-H 'x-portkey-provider: openai' \
|
||||
-H "Authorization: Bearer $OPENAI_KEY" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"messages": [{"role": "user","content": "Say this is test."}], "max_tokens": 20, "model": "gpt-4"}'
|
||||
```
|
||||
|
||||
[支持的SDK完整列表](#supported-sdks)
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
## 支持的AI厂商
|
||||
|
||||
|| AI厂商 | 支持 | 流式 | 支持的端点 |
|
||||
|---|---|---|---|--|
|
||||
| <img src="docs/images/openai.png" width=25 />| OpenAI | ✅ |✅ | `/completions`, `/chat/completions`,`/embeddings`, `/assistants`, `/threads`, `/runs` |
|
||||
| <img src="docs/images/azure.png" width=25>| Azure OpenAI | ✅ |✅ | `/completions`, `/chat/completions`,`/embeddings` |
|
||||
| <img src="docs/images/anyscale.png" width=25>| Anyscale | ✅ | ✅ | `/chat/completions` |
|
||||
| <img src="https://upload.wikimedia.org/wikipedia/commons/2/2d/Google-favicon-2015.png" width=25>| Google Gemini & Palm | ✅ |✅ | `/generateMessage`, `/generateText`, `/embedText` |
|
||||
| <img src="docs/images/anthropic.png" width=25>| Anthropic | ✅ |✅ | `/messages`, `/complete` |
|
||||
| <img src="docs/images/cohere.png" width=25>| Cohere | ✅ |✅ | `/generate`, `/embed`, `/rerank` |
|
||||
| <img src="https://assets-global.website-files.com/64f6f2c0e3f4c5a91c1e823a/654693d569494912cfc0c0d4_favicon.svg" width=25>| Together AI | ✅ |✅ | `/chat/completions`, `/completions`, `/inference` |
|
||||
| <img src="https://www.perplexity.ai/favicon.svg" width=25>| Perplexity | ✅ |✅ | `/chat/completions` |
|
||||
| <img src="https://docs.mistral.ai/img/favicon.ico" width=25>| Mistral | ✅ |✅ | `/chat/completions`, `/embeddings` |
|
||||
|
||||
> [在这里查看支持的100多个模型的完整列表](https://portkey.ai/docs/welcome/what-is-portkey#ai-providers-supported)
|
||||
<br />
|
||||
|
||||
## 特点
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<h4><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/universal-api">统一API签名</a></h4>
|
||||
使用OpenAI的API签名连接100多个LLM。AI网关处理请求、响应和错误转换,因此您无需对代码进行任何更改。您可以使用OpenAI SDK本身连接到任何支持的LLM。
|
||||
<br><br>
|
||||
<img src="docs/images/openai.png" height=40 /> <img src="docs/images/azure.png" height=40 />
|
||||
<img src="docs/images/anyscale.png" height=40 />
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/2/2d/Google-favicon-2015.png" height=40 /> <br><br>
|
||||
<img src="docs/images/anthropic.png" height=40 />
|
||||
<img src="docs/images/cohere.png" height=40 />
|
||||
<img src="https://assets-global.website-files.com/64f6f2c0e3f4c5a91c1e823a/654693d569494912cfc0c0d4_favicon.svg" height=40 /> <br><br>
|
||||
<img src="https://www.perplexity.ai/favicon.svg" height=40 />
|
||||
<img src="https://docs.mistral.ai/img/favicon.ico" height=40 />
|
||||
<img src="https://1000logos.net/wp-content/uploads/2021/10/logo-Meta.png" height=40 />
|
||||
<br><br>
|
||||
</td>
|
||||
<td>
|
||||
<h4><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/fallbacks">备用方案</a></h4>
|
||||
不要让失败阻止您。备用功能允许您按优先顺序指定语言模型API(LLMs)列表。如果主LLM无法响应或遇到错误,Portkey将自动备用到列表中的下一个LLM,确保您的应用程序的稳定性和可靠性。
|
||||
<br><br>
|
||||
<img src="https://framerusercontent.com/images/gmlOW8yeKP2pGuIsObM6gKLzeMI.png" height=200 />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<h4><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/automatic-retries">自动重试</a></h4>
|
||||
临时问题不应该意味着手动重新运行。AI网关可以自动重试失败的请求多达5次。我们采用指数退避策略,间隔重试尝试以防止网络过载。
|
||||
<br><br>
|
||||
<img src="https://github.com/roh26it/Rubeus/assets/971978/8a6e653c-94b2-4ba7-95c7-93544ee476b1" height=200 />
|
||||
</td>
|
||||
<td>
|
||||
<h4><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/load-balancing">负载均衡</a></h4>
|
||||
根据自定义权重在多个API密钥或提供商之间有效分配负载。这确保了您的生成式AI应用程序的高可用性和最佳性能,防止任何单一LLM成为性能瓶颈。
|
||||
<br><br>
|
||||
<img src="https://framerusercontent.com/images/6EWuq3FWhqrPe3kKLqVspevi4.png" height=200 />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
## 配置 AI 网关
|
||||
AI 网关支持[配置](https://portkey.ai/docs/api-reference/config-object),以实现如**后备(fallbacks)**、**负载均衡(load balancing)**、**重试(retries)**等多样化的路由策略。
|
||||
<br><br>
|
||||
您可以在通过 `x-portkey-config` 头部进行 OpenAI 调用时使用这些配置
|
||||
```js
|
||||
// 使用 OpenAI JS SDK
|
||||
const client = new OpenAI({
|
||||
baseURL: "http://127.0.0.1:8787", // 网关 URL
|
||||
defaultHeaders: {
|
||||
'x-portkey-config': {.. 你的配置在这里 ..},
|
||||
}
|
||||
});
|
||||
```
|
||||
<br>
|
||||
<details><summary>这里有一个示例配置,在回退到 Gemini Pro 之前会重试 OpenAI 请求 5 次</summary>
|
||||
|
||||
```js
|
||||
{
|
||||
"retry": { "count": 5 },
|
||||
"strategy": { "mode": "fallback" },
|
||||
"targets": [{
|
||||
"provider": "openai",
|
||||
"api_key": "sk-***"
|
||||
},{
|
||||
"provider": "google",
|
||||
"api_key": "gt5***",
|
||||
"override_params": {"model": "gemini-pro"}
|
||||
}]
|
||||
}
|
||||
```
|
||||
</details> <details> <summary>此配置将使得在 2 个 OpenAI 密钥之间实现等量的负载均衡</summary>
|
||||
|
||||
```js
|
||||
{
|
||||
"strategy": { "mode": "loadbalance" },
|
||||
"targets": [{
|
||||
"provider": "openai",
|
||||
"api_key": "sk-***",
|
||||
"weight": "0.5"
|
||||
},{
|
||||
"provider": "openai",
|
||||
"api_key": "sk-***",
|
||||
"weight": "0.5"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</details>
|
||||
了解更多关于配置对象。
|
||||
<br>
|
||||
|
||||
## 支持的SDKs
|
||||
|
||||
| 语言 | 支持的SDKs |
|
||||
|---|---|
|
||||
| Node.js / JS / TS | [Portkey SDK](https://www.npmjs.com/package/portkey-ai) <br> [OpenAI SDK](https://www.npmjs.com/package/openai) <br> [LangchainJS](https://www.npmjs.com/package/langchain) <br> [LlamaIndex.TS](https://www.npmjs.com/package/llamaindex) |
|
||||
| Python | [Portkey SDK](https://pypi.org/project/portkey-ai/) <br> [OpenAI SDK](https://pypi.org/project/openai/) <br> [Langchain](https://pypi.org/project/langchain/) <br> [LlamaIndex](https://pypi.org/project/llama-index/) |
|
||||
| Go | [go-openai](https://github.com/sashabaranov/go-openai) |
|
||||
| Java | [openai-java](https://github.com/TheoKanning/openai-java) |
|
||||
| Rust | [async-openai](https://docs.rs/async-openai/latest/async_openai/) |
|
||||
| Ruby | [ruby-openai](https://github.com/alexrudall/ruby-openai) |
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## 部署 AI 网关
|
||||
|
||||
[查看文档](docs/installation-deployments.md)了解如何在本地安装 AI 网关或者在流行的平台上部署它。
|
||||
|
||||
<br>
|
||||
|
||||
## 路线图
|
||||
|
||||
1. 支持更多的提供商。如果缺少某个提供商或 LLM 平台,请[提出功能请求](https://github.com/Portkey-AI/gateway/issues)。
|
||||
2. 增强的负载均衡功能,以优化不同模型和提供商之间的资源使用。
|
||||
3. 更加健壮的后备和重试策略,以进一步提高请求的可靠性。
|
||||
4. 增加统一 API 签名的可定制性,以满足更多样化的使用案例。
|
||||
|
||||
[💬 在这里参与路线图讨论。](https://github.com/Portkey-AI/gateway/projects/)
|
||||
|
||||
<br>
|
||||
|
||||
## 贡献
|
||||
|
||||
最简单的贡献方式是选择任何带有 `good first issue` 标签的问题 💪。在[这里](./CONTRIBUTING.md)阅读贡献指南。
|
||||
|
||||
发现 Bug?[在这里提交](https://github.com/Portkey-AI/gateway/issues) | 有功能请求?[在这里提交](https://github.com/Portkey-AI/gateway/issues)
|
||||
|
||||
<br>
|
||||
|
||||
## 社区
|
||||
|
||||
加入我们不断增长的全球社区,寻求帮助,分享想法,讨论 AI。
|
||||
|
||||
- 查看我们的官方[博客](https://portkey.ai/blog)
|
||||
- 在 [Discord](https://portkey.ai/community) 上与我们实时交流
|
||||
- 在 [Twitter](https://twitter.com/PortkeyAI) 上关注我们
|
||||
- 在 [LinkedIn](https://www.linkedin.com/company/portkey-ai/) 上与我们建立联系
|
||||
- 阅读日文版文档 [日本語](./README.jp.md)
|
||||
|
||||
<!-- - 在 [YouTube](https://www.youtube.com/channel/UCZph50gLNXAh1DpmeX8sBdw) 上访问我们 --> <!-- - 加入我们的 [Dev 社区](https://dev.to/portkeyai) --> <!-- - 在 [Stack Overflow](https://stackoverflow.com/questions/tagged/portkey) 上查看标记为 #portkey 的问题 -->
|
||||
|
||||

|
||||
@@ -0,0 +1,297 @@
|
||||
<div align="center">
|
||||
|
||||
<p align="right">
|
||||
<a href="../README.md">English</a> | <a href="./README.cn.md">中文</a> | <strong>日本語</strong>
|
||||
</p>
|
||||
|
||||
|
||||
# AIゲートウェイ
|
||||
#### 1つの高速でフレンドリーなAPIで200以上のLLMに確実にルーティング
|
||||
<img src="docs/images/demo.gif" width="650" alt="Gateway Demo"><br>
|
||||
|
||||
[](./LICENSE)
|
||||
[](https://portkey.ai/community)
|
||||
[](https://twitter.com/portkeyai)
|
||||
[](https://www.npmjs.com/package/@portkey-ai/gateway)
|
||||
[](https://status.portkey.ai/?utm_source=status_badge)
|
||||
|
||||
</div>
|
||||
|
||||
[AIゲートウェイ](https://portkey.ai/features/ai-gateway)は、250以上の言語、ビジョン、オーディオ、画像モデルへのリクエストを統一されたAPIで簡素化します。キャッシング、フォールバック、リトライ、タイムアウト、ロードバランシングをサポートし、最小の遅延でエッジデプロイが可能なプロダクション対応のゲートウェイです。
|
||||
|
||||
✅ **超高速**(9.9倍速)で**小さなフットプリント**(ビルド後約100kb)<br>
|
||||
✅ 複数のモデル、プロバイダー、キー間で**ロードバランシング**<br>
|
||||
✅ **フォールバック**でアプリの信頼性を確保<br>
|
||||
✅ デフォルトで**自動リトライ**(指数関数的フォールバック)<br>
|
||||
✅ **リクエストタイムアウト**の設定が可能<br>
|
||||
✅ **マルチモーダル**でビジョン、TTS、STT、画像生成モデルをサポート<br>
|
||||
✅ 必要に応じてミドルウェアを**プラグイン**<br>
|
||||
✅ **480Bトークン**以上の実績<br>
|
||||
✅ **エンタープライズ対応**でセキュリティ、スケール、カスタムデプロイメントをサポート<br><br>
|
||||
|
||||
> [!TIP]
|
||||
> ⭐️ **このリポジトリにスターを付ける**ことで、新しいプロバイダー統合や機能のGitHubリリース通知を受け取ることができます。
|
||||
|
||||

|
||||
|
||||
<details>
|
||||
<summary><kbd>スター履歴</kbd></summary>
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=portkey-ai%2Fgateway&theme=dark&type=Date">
|
||||
<img width="100%" src="https://api.star-history.com/svg?repos=portkey-ai%2Fgateway&type=Date">
|
||||
</picture>
|
||||
</details>
|
||||
<br>
|
||||
|
||||
## セットアップとインストール
|
||||
AIゲートウェイを使用するには、**ホストされたAPI**を使用するか、**オープンソース**または**エンタープライズバージョン**を自分の環境にセルフホストします。
|
||||
<br>
|
||||
|
||||
### 👉 portkey.aiでホストされたゲートウェイ(最速)
|
||||
ホストされたAPIは、ジェネレーティブAIアプリケーションのためのAIゲートウェイをセットアップする最速の方法です。私たちは**毎日数十億のトークン**を処理しており、Postman、Haptik、Turing、MultiOn、SiteGPTなどの企業でプロダクションで使用されています。
|
||||
|
||||
<a href="https://app.portkey.ai/signup"><img src="https://portkey.ai/blog/content/images/2024/08/Get-API-Key--3-.png" height=50 alt="Get API Key" /></a><br>
|
||||
<br>
|
||||
|
||||
### 👉 オープンソースバージョンのセルフホスト([MITライセンス](https://github.com/Portkey-AI/gateway?tab=MIT-1-ov-file#readme))
|
||||
|
||||
ローカルでAIゲートウェイを実行するには、ターミナルで以下のコマンドを実行します。(npxがインストールされている必要があります)または、[Cloudflare](https://github.com/Portkey-AI/gateway/blob/main/docs/installation-deployments.md#cloudflare-workers)、[Docker](https://github.com/Portkey-AI/gateway/blob/main/docs/installation-deployments.md#docker)、[Node.js](https://github.com/Portkey-AI/gateway/blob/main/docs/installation-deployments.md#nodejs-server)などのデプロイメントガイドを参照してください。
|
||||
```bash
|
||||
npx @portkey-ai/gateway
|
||||
```
|
||||
<sup>あなたのAIゲートウェイはhttp://localhost:8787で実行されています 🚀</sup>
|
||||
<br>
|
||||
|
||||
### 👉 エンタープライズバージョンのセルフホスト
|
||||
AIゲートウェイのエンタープライズバージョンは、**組織管理**、**ガバナンス**、**セキュリティ**などのエンタープライズ対応機能を提供します。オープンソース、ホスト、エンタープライズバージョンの比較は[こちら](https://docs.portkey.ai/docs/product/product-feature-comparison)をご覧ください。
|
||||
|
||||
エンタープライズデプロイメントアーキテクチャ、サポートされているプラットフォームについては、[**エンタープライズプライベートクラウドデプロイメント**](https://docs.portkey.ai/docs/product/enterprise-offering/private-cloud-deployments)をご覧ください。
|
||||
|
||||
<a href="https://portkey.sh/demo-22"><img src="https://portkey.ai/blog/content/images/2024/08/Get-API-Key--5-.png" height=50 alt="Book an enterprise AI gateway demo" /></a><br>
|
||||
|
||||
<br>
|
||||
|
||||
## AIゲートウェイを通じたリクエストの作成
|
||||
|
||||
### <img src="docs/images/openai.png" height=15 /> OpenAI API & SDKと互換性あり
|
||||
|
||||
AIゲートウェイはOpenAI API & SDKと互換性があり、200以上のLLMに信頼性のある呼び出しを拡張します。ゲートウェイを通じてOpenAIを使用するには、**クライアントを更新**してゲートウェイのURLとヘッダーを含め、通常通りリクエストを行います。AIゲートウェイは、OpenAI形式で書かれたリクエストを指定されたプロバイダーが期待するシグネチャに変換できます。[例を表示](https://docs.portkey.ai/docs/guides/getting-started/getting-started-with-ai-gateway)
|
||||
<br><br>
|
||||
|
||||
### <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Python-logo-notext.svg/1869px-Python-logo-notext.svg.png" height=15 /> Python SDKの使用 <a href="https://colab.research.google.com/drive/1hLvoq_VdGlJ_92sPPiwTznSra5Py0FuW?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg"></a>
|
||||
[Portkey Python SDK](https://github.com/Portkey-AI/portkey-python-sdk)は、OpenAI Python SDKのラッパーであり、他のすべてのプロバイダーに対する追加パラメータのサポートを提供します。**Pythonで構築している場合、これはゲートウェイに接続するための推奨ライブラリです**。
|
||||
```bash
|
||||
pip install -qU portkey-ai
|
||||
```
|
||||
<br>
|
||||
|
||||
|
||||
### <img src="https://cdn-icons-png.flaticon.com/512/5968/5968322.png" height=15 /> Node.JS SDKの使用
|
||||
[Portkey JS/TS SDK](https://www.npmjs.com/package/portkey-ai)は、OpenAI JS SDKのラッパーであり、他のすべてのプロバイダーに対する追加パラメータのサポートを提供します。**JSまたはTSで構築している場合、これはゲートウェイに接続するための推奨ライブラリです**。
|
||||
|
||||
```bash
|
||||
npm install --save portkey-ai
|
||||
```
|
||||
<br>
|
||||
|
||||
|
||||
### <img src="https://www.svgrepo.com/show/305922/curl.svg" height=15 /> REST APIの使用
|
||||
AIゲートウェイは、すべての他のプロバイダーとモデルに対する追加パラメータのサポートを備えたOpenAI互換エンドポイントをサポートします。[APIリファレンスを表示](https://docs.portkey.ai/docs/api-reference/introduction)。
|
||||
<br><br>
|
||||
|
||||
### その他の統合
|
||||
|
||||
| 言語 | サポートされているSDK |
|
||||
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| JS / TS | [LangchainJS](https://www.npmjs.com/package/langchain) <br> [LlamaIndex.TS](https://www.npmjs.com/package/llamaindex) |
|
||||
| Python | <br> [Langchain](https://portkey.ai/docs/welcome/integration-guides/langchain-python) <br> [LlamaIndex](https://portkey.ai/docs/welcome/integration-guides/llama-index-python) |
|
||||
| Go | [go-openai](https://github.com/sashabaranov/go-openai) |
|
||||
| Java | [openai-java](https://github.com/TheoKanning/openai-java) |
|
||||
| Rust | [async-openai](https://docs.rs/async-openai/latest/async_openai/) |
|
||||
| Ruby | [ruby-openai](https://github.com/alexrudall/ruby-openai) |
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## ゲートウェイクックブック
|
||||
|
||||
### トレンドのクックブック
|
||||
- [Nvidia NIM](/cookbook/providers/nvidia.ipynb)のモデルをAIゲートウェイで使用する
|
||||
- [CrewAIエージェント](/cookbook/monitoring-agents/CrewAI_with_Telemetry.ipynb)をPortkeyで監視する
|
||||
- AIゲートウェイで[トップ10のLMSYSモデルを比較する](./use-cases/LMSYS%20Series/comparing-top10-LMSYS-models-with-Portkey.ipynb)
|
||||
|
||||
### 最新のクックブック
|
||||
* [Nemotronを使用して合成データセットを作成する](/cookbook/use-cases/Nemotron_GPT_Finetuning_Portkey.ipynb)
|
||||
* [PortkeyゲートウェイをVercelのAI SDKと使用する](/cookbook/integrations/vercel-ai.md)
|
||||
* [PortkeyでLlamaエージェントを監視する](/cookbook/monitoring-agents/Llama_Agents_with_Telemetry.ipynb)
|
||||
|
||||
|
||||
|
||||
### [その他の例](https://github.com/Portkey-AI/gateway/tree/main/cookbook)
|
||||
|
||||
## サポートされているプロバイダー
|
||||
|
||||
[25以上のプロバイダー](https://portkey.ai/docs/welcome/integration-guides)と[6以上のフレームワーク](https://portkey.ai/docs/welcome/integration-guides)とのゲートウェイ統合を探索してください。
|
||||
|
||||
| | プロバイダー | サポート | ストリーム |
|
||||
| -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | ------- | ------ |
|
||||
| <img src="docs/images/openai.png" width=35 /> | [OpenAI](https://portkey.ai/docs/welcome/integration-guides/openai) | ✅ | ✅ |
|
||||
| <img src="docs/images/azure.png" width=35> | [Azure OpenAI](https://portkey.ai/docs/welcome/integration-guides/azure-openai) | ✅ | ✅ |
|
||||
| <img src="docs/images/anyscale.png" width=35> | [Anyscale](https://portkey.ai/docs/welcome/integration-guides/anyscale-llama2-mistral-zephyr) | ✅ | ✅ |
|
||||
| <img src="https://upload.wikimedia.org/wikipedia/commons/2/2d/Google-favicon-2015.png" width=35> | [Google Gemini & Palm](https://portkey.ai/docs/welcome/integration-guides/gemini) | ✅ | ✅ |
|
||||
| <img src="docs/images/anthropic.png" width=35> | [Anthropic](https://portkey.ai/docs/welcome/integration-guides/anthropic) | ✅ | ✅ |
|
||||
| <img src="docs/images/cohere.png" width=35> | [Cohere](https://portkey.ai/docs/welcome/integration-guides/cohere) | ✅ | ✅ |
|
||||
| <img src="https://assets-global.website-files.com/64f6f2c0e3f4c5a91c1e823a/654693d569494912cfc0c0d4_favicon.svg" width=35> | [Together AI](https://portkey.ai/docs/welcome/integration-guides/together-ai) | ✅ | ✅ |
|
||||
| <img src="https://www.perplexity.ai/favicon.svg" width=35> | [Perplexity](https://portkey.ai/docs/welcome/integration-guides/perplexity-ai) | ✅ | ✅ |
|
||||
| <img src="https://docs.mistral.ai/img/favicon.ico" width=35> | [Mistral](https://portkey.ai/docs/welcome/integration-guides/mistral-ai) | ✅ | ✅ |
|
||||
| <img src="https://docs.nomic.ai/img/nomic-logo.png" width=35> | [Nomic](https://portkey.ai/docs/welcome/integration-guides/nomic) | ✅ | ✅ |
|
||||
| <img src="https://files.readme.io/d38a23e-small-studio-favicon.png" width=35> | [AI21](https://portkey.ai/docs/welcome/integration-guides) | ✅ | ✅ |
|
||||
| <img src="https://platform.stability.ai/small-logo-purple.svg" width=35> | [Stability AI](https://portkey.ai/docs/welcome/integration-guides/stability-ai) | ✅ | ✅ |
|
||||
| <img src="https://deepinfra.com/_next/static/media/logo.4a03fd3d.svg" width=35> | [DeepInfra](https://portkey.ai/docs/welcome/integration-guides) | ✅ | ✅ |
|
||||
| <img src="https://ollama.com/public/ollama.png" width=35> | [Ollama](https://portkey.ai/docs/welcome/integration-guides/ollama) | ✅ | ✅ |
|
||||
| <img src="https://novita.ai/favicon.ico" width=35> | Novita AI | ✅ | ✅ | `/chat/completions`, `/completions` |
|
||||
|
||||
> [サポートされている200以上のモデルの完全なリストを表示](https://portkey.ai/docs/welcome/what-is-portkey#ai-providers-supported)
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
||||
## エージェント
|
||||
ゲートウェイは、人気のあるエージェントフレームワークとシームレスに統合されます。[ドキュメントを読む](https://docs.portkey.ai/docs/welcome/agents)。
|
||||
|
||||
|
||||
| フレームワーク | 200以上のLLMを呼び出す | 高度なルーティング | キャッシング | ロギングとトレース* | オブザーバビリティ* | プロンプト管理* |
|
||||
|------------------------------|--------|-------------|---------|------|---------------|-------------------|
|
||||
| [Autogen](https://docs.portkey.ai/docs/welcome/agents/autogen) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| [CrewAI](https://docs.portkey.ai/docs/welcome/agents/crewai) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| [LangChain](https://docs.portkey.ai/docs/welcome/agents/langchain-agents) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| [Phidata](https://docs.portkey.ai/docs/welcome/agents/phidata) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| [Llama Index](https://docs.portkey.ai/docs/welcome/agents/llama-agents) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| [Control Flow](https://docs.portkey.ai/docs/welcome/agents/control-flow) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| [独自のエージェントを構築する](https://docs.portkey.ai/docs/welcome/agents/bring-your-own-agents) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
|
||||
<br>
|
||||
|
||||
*ホストされたアプリでのみ利用可能です。詳細なドキュメントは[こちら](https://docs.portkey.ai/docs/welcome/agents)をご覧ください。
|
||||
|
||||
|
||||
## 機能
|
||||
|
||||
<table width=100%>
|
||||
<tr>
|
||||
<td width="50%">
|
||||
<strong><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/fallbacks">フォールバック</a></strong><br/>
|
||||
失敗したリクエストに対して別のプロバイダーやモデルにフォールバックします。トリガーするエラーを指定できます。アプリケーションの信頼性を向上させます。
|
||||
<br><br>
|
||||
<img src="https://framerusercontent.com/images/gmlOW8yeKP2pGuIsObM6gKLzeMI.png" height=100 />
|
||||
</td>
|
||||
<td width="50%">
|
||||
<strong><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/automatic-retries">自動リトライ</a></strong><br/>
|
||||
失敗したリクエストを最大5回自動的にリトライします。指数関数的バックオフ戦略により、リトライ試行の間隔を空けてネットワークの過負荷を防ぎます。
|
||||
<br><br>
|
||||
<img src="https://github.com/roh26it/Rubeus/assets/971978/8a6e653c-94b2-4ba7-95c7-93544ee476b1" height=100 />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="50%">
|
||||
<strong><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/load-balancing">ロードバランシング</a></strong><br/>
|
||||
複数のAPIキーやAIプロバイダー間でLLMリクエストを重み付けして分散させ、高可用性と最適なパフォーマンスを確保します。
|
||||
<br><br>
|
||||
<img src="https://framerusercontent.com/images/6EWuq3FWhqrPe3kKLqVspevi4.png" height=100 />
|
||||
</td>
|
||||
<td width="50%">
|
||||
<strong><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/request-timeouts">リクエストタイムアウト</a></strong></br><br/>
|
||||
応答しないLLMリクエストを自動的に終了させるために、詳細なリクエストタイムアウトを設定します。
|
||||
<br><br>
|
||||
<img src="https://github.com/vrushankportkey/gateway/assets/134934501/b23b98b2-6451-4747-8898-6847ad8baed4" height=100 />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</table>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="50%">
|
||||
<strong><a href="https://docs.portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/multimodal-capabilities">マルチモーダルLLMゲートウェイ</a></strong><br/>
|
||||
ビジョン、オーディオ(テキストから音声、音声からテキスト)、画像生成モデルを複数のプロバイダーから呼び出すことができます — すべてOpenAIのシグネチャを使用して
|
||||
<br><br>
|
||||
<img src="https://docs.portkey.ai/~gitbook/image?url=https%3A%2F%2F2878743244-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fy3MCfQqftZOnHqSmVV5x%252Fuploads%252FOVuOxN4uFdBp1BdXX4E6%252Fmultimodal-icon.png%3Falt%3Dmedia%26token%3Db8b7bd49-0194-4d2f-89d4-c6633a872372&width=768&dpr=2&quality=100&sign=f51129a9&sv=1" height=100 />
|
||||
</td>
|
||||
<td width="50%">
|
||||
<strong><a href="https://docs.portkey.ai/docs/product/guardrails">ガードレール</a></strong></br><br/>
|
||||
指定されたチェックに従ってLLMの入力と出力をリアルタイムで検証します。独自のチェックを作成するか、20以上の事前構築されたガードレールから選択できます。
|
||||
<br><br>
|
||||
<img src="https://docs.portkey.ai/~gitbook/image?url=https%3A%2F%2F2878743244-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fy3MCfQqftZOnHqSmVV5x%252Fuploads%252FDFkhZpqtBfQMIW9BhVum%252Fguardrails-icon.png%3Falt%3Dmedia%26token%3D91cfe226-5ce9-44b3-a0e8-be9f3ae3917f&width=768&dpr=2&quality=100&sign=73608afc&sv=1" height=100 />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
**これらの機能は、`x-portkey-config`ヘッダーまたはSDKの`config`パラメータに追加されたゲートウェイ設定を通じて構成されます。**
|
||||
|
||||
以下は、上記の機能を示すサンプル設定JSONです。すべての機能はオプションです。
|
||||
|
||||
```json
|
||||
{
|
||||
"retry": { "attempts": 5 },
|
||||
"request_timeout": 10000,
|
||||
"strategy": { "mode": "fallback" }, // または 'loadbalance' など
|
||||
"targets": [{
|
||||
"provider": "openai",
|
||||
"api_key": "sk-***"
|
||||
},{
|
||||
"strategy": {"mode": "loadbalance"}, // オプションのネスト
|
||||
"targets": {...}
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
次に、APIリクエストに設定を使用します。
|
||||
|
||||
|
||||
### ゲートウェイ設定の使用
|
||||
|
||||
リクエストで設定オブジェクトを使用する方法については、[こちらのガイド](https://portkey.ai/docs/api-reference/config-object)をご覧ください。
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
## ゲートウェイエンタープライズバージョン
|
||||
AIアプリを<ins>信頼性</ins>と<ins>将来の互換性</ins>を高め、完全な<ins>データセキュリティ</ins>と<ins>プライバシー</ins>を確保します。
|
||||
|
||||
✅ セキュアなキー管理 - ロールベースのアクセス制御とトラッキングのため<br>
|
||||
✅ シンプルでセマンティックなキャッシング - 繰り返しのクエリを高速に提供し、コストを削減<br>
|
||||
✅ アクセス制御とインバウンドルール - 接続できるIPと地域を制御<br>
|
||||
✅ PII削除 - リクエストから自動的に機密データを削除し、意図しない露出を防止<br>
|
||||
✅ SOC2、ISO、HIPAA、GDPRコンプライアンス - ベストセキュリティプラクティスのため<br>
|
||||
✅ プロフェッショナルサポート - 機能の優先順位付けとともに<br>
|
||||
|
||||
[エンタープライズデプロイメントについての相談を予約する](https://portkey.sh/demo-22)
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
## 貢献
|
||||
|
||||
最も簡単な貢献方法は、`good first issue`タグの付いた問題を選ぶことです 💪。貢献ガイドラインは[こちら](/.github/CONTRIBUTING.md)をご覧ください。
|
||||
|
||||
バグ報告?[こちらで提出](https://github.com/Portkey-AI/gateway/issues) | 機能リクエスト?[こちらで提出](https://github.com/Portkey-AI/gateway/issues)
|
||||
|
||||
<br>
|
||||
|
||||
## コミュニティ
|
||||
|
||||
世界中の成長するコミュニティに参加して、AIに関するヘルプ、アイデア、ディスカッションを行いましょう。
|
||||
|
||||
- 公式[ブログ](https://portkey.ai/blog)を閲覧する
|
||||
- [Discord](https://portkey.ai/community)でリアルタイムチャット
|
||||
- [Twitter](https://twitter.com/PortkeyAI)でフォロー
|
||||
- [LinkedIn](https://www.linkedin.com/company/portkey-ai/)で接続
|
||||
- [日本語のドキュメント](./.github/README.jp.md)を読む
|
||||
<!-- - [YouTube](https://www.youtube.com/channel/UCZph50gLNXAh1DpmeX8sBdw)で訪問 -->
|
||||
<!-- - [Devコミュニティ](https://dev.to/portkeyai)に参加 -->
|
||||
<!-- - [Stack Overflow](https://stackoverflow.com/questions/tagged/portkey)で#portkeyタグの質問を閲覧 -->
|
||||
|
||||

|
||||
@@ -0,0 +1,11 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 1.x.x | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please report any security vulnerabilities at support@portkey.ai
|
||||
@@ -0,0 +1,6 @@
|
||||
## How to file issues and get help
|
||||
|
||||
This project uses GitHub Issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates.
|
||||
For new issues, file your bug or feature request as a new Issue.
|
||||
|
||||
For help and questions about using this project, please contact `support@portkey.ai`. Join the community discussions [here](https://discord.com/invite/DD7vgKK299).
|
||||
@@ -0,0 +1,92 @@
|
||||
<p align="right">
|
||||
<a href=".github\CODE_OF_CONDUCT.md">English</a>|<strong>中文</strong>
|
||||
</p>
|
||||
|
||||
# 贡献者公约行为准则
|
||||
|
||||
## 我们的承诺
|
||||
|
||||
我们作为成员、贡献者和领导者,承诺参与我们的
|
||||
社区对每个人来说是一个无骚扰的体验,无论他们的年龄、体型、可见或不可见的残疾、种族、性特征、性别认同和表达、经验水平、教育、社会经济地位、国籍、个人外表、种族、宗教或性别认同和取向。
|
||||
|
||||
我们承诺以促进开放、欢迎、多元、包容和健康的社区的方式行动和互动。
|
||||
|
||||
## 我们的标准
|
||||
|
||||
对于有助于我们社区积极环境的行为举例包括:
|
||||
|
||||
* 对他人表现出同理心和善意
|
||||
* 尊重不同的意见、观点和经验
|
||||
* 优雅地给予并接受建设性反馈
|
||||
* 承担责任并向受我们错误影响的人道歉,
|
||||
并从经验中学习
|
||||
* 关注的不仅是我们作为个体的最佳利益,而是整个社区的最佳利益
|
||||
|
||||
不可接受的行为举例包括:
|
||||
|
||||
* 使用性语言或图像,以及任何形式的性关注或
|
||||
进步
|
||||
* 恶意挑衅、侮辱性或贬损性评论,以及个人或政治攻击
|
||||
* 公开或私下骚扰
|
||||
* 在未经明确许可的情况下发布他人的私人信息,如实际地址或电子邮件地址
|
||||
* 其他在专业环境中可能被合理视为不适当的行为
|
||||
|
||||
## 执行责任
|
||||
|
||||
社区领导者负责澄清和执行我们可接受行为的标准,并将采取适当和公平的纠正措施以响应他们认为不当、威胁性、冒犯性或有害的任何行为。
|
||||
|
||||
社区领导者有权利和责任移除、编辑或拒绝不符合本行为准则的评论、提交、代码、wiki编辑、问题以及其他贡献,并在适当时候沟通调节决策的原因。
|
||||
|
||||
## 范围
|
||||
|
||||
本行为准则适用于所有社区空间,并且当个人在公共空间正式代表社区时也适用。代表我们的社区的例子包括使用官方电子邮件地址、通过官方社交媒体账户发布,或者在在线或离线活动中担任指定代表。
|
||||
|
||||
## 执行
|
||||
|
||||
滥用、骚扰或以其他方式不可接受的行为可向负责执行的社区领导者报告到
|
||||
support@portkey.ai。
|
||||
所有投诉将进行及时和公正的审查和调查。
|
||||
|
||||
所有社区领导者都有义务尊重任何事件报告者的隐私和安全。
|
||||
|
||||
## 执行指南
|
||||
|
||||
社区领导者将根据以下社区影响指南确定他们认为违反本行为准则的任何行为的后果:
|
||||
|
||||
### 1. 更正
|
||||
|
||||
**社区影响**:使用不当的语言或其他在社区中被认为不专业或不受欢迎的行为。
|
||||
|
||||
**后果**:社区领导者将发出私人书面警告,提供违规行为的性质的清晰说明以及解释为什么行为不当。可能会要求公开道歉。
|
||||
|
||||
### 2. 警告
|
||||
|
||||
**社区影响**:通过单一事件或一系列行动的违规行为。
|
||||
|
||||
**后果**:警告连同持续行为的后果。不得与涉事人员进行互动,包括与执行行为准则的人进行未经请求的互动,在指定时间内。这包括避免在社区空间以及像社交媒体这样的外部渠道的互动。违反这些条款可能会导致临时或永久禁止。
|
||||
|
||||
### 3. 临时禁止
|
||||
|
||||
**社区影响**:严重违反社区标准,包括持续不当行为。
|
||||
|
||||
**后果**:在指定时间内禁止与社区进行任何形式的互动或公开沟通。在此期间,不允许与涉事人员进行公开或私下互动,包括与执行行为准则的人进行未经请求的互动。违反这些条款可能会导致永久禁止。
|
||||
|
||||
### 4. 永久禁止
|
||||
|
||||
**社区影响**:展现违反社区标准的行为模式,包括持续不当行为,骚扰个体,或对个体或群体的侵犯性或贬低性行为。
|
||||
|
||||
**后果**:永久禁止在社区内进行任何形式的公共互动。
|
||||
|
||||
## 归属
|
||||
|
||||
本行为准则改编自 [Contributor Covenant][homepage],
|
||||
2.0版本,可在
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html 查看。
|
||||
|
||||
社区影响指南的灵感来自 [Mozilla 的行为准则执行阶梯](https://github.com/mozilla/diversity)。
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
有关本行为准则的常见问题解答,请参见
|
||||
https://www.contributor-covenant.org/faq。翻译版本可在
|
||||
https://www.contributor-covenant.org/translations 查看。
|
||||
@@ -0,0 +1,14 @@
|
||||
**Description:** (required)
|
||||
- Detailed change 1
|
||||
- Detailed change 2
|
||||
|
||||
**Tests Run/Test cases added:** (required)
|
||||
- [ ] Description of test case
|
||||
|
||||
**Type of Change:**
|
||||
<!-- Put an 'x' in the boxes that apply -->
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] Documentation update
|
||||
- [ ] Refactoring (no functional changes)
|
||||
@@ -0,0 +1,25 @@
|
||||
name: Check Prettier Formatting
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
check-formatting:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Check formatting
|
||||
run: npm run format:check
|
||||
@@ -0,0 +1,44 @@
|
||||
name: Publish Docker image
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
name: Push Docker image to Docker Hub
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ secrets.DOCKER_ORGANISATION }}/gateway
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=pep440,pattern={{version}},value=${{ github.event.release.tag_name }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -0,0 +1,51 @@
|
||||
name: Check Markdown links
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '**/*.md' # Only run when markdown files change
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: '0 0 * * 0' # Run weekly on Sundays
|
||||
workflow_dispatch: # Allows manual triggering
|
||||
|
||||
jobs:
|
||||
linkChecker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Link Checker
|
||||
uses: lycheeverse/lychee-action@v1.8.0
|
||||
with:
|
||||
args: --verbose --no-progress './**/*.md'
|
||||
fail: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create Issue If Failed
|
||||
if: failure()
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const title = '🔗 Broken links found in documentation';
|
||||
const body = 'The link checker found broken links in the documentation. Please check the [workflow run](${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}) for details.';
|
||||
|
||||
const existingIssues = await github.rest.issues.listForRepo({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
labels: 'documentation,broken-links',
|
||||
});
|
||||
|
||||
const issueExists = existingIssues.data.some(issue => issue.title === title);
|
||||
if (!issueExists) {
|
||||
await github.rest.issues.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: title,
|
||||
body: body,
|
||||
labels: ['documentation', 'broken-links']
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
name: Publish to NPM
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '20.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Publish package on NPM
|
||||
run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
@@ -0,0 +1,75 @@
|
||||
name: Gateway Tests
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
gateway-tests:
|
||||
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'run tests') }}
|
||||
runs-on: ubuntu-latest
|
||||
environment: production
|
||||
steps:
|
||||
- name: Checkout head
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Start gateway and run tests
|
||||
id: run-tests
|
||||
continue-on-error: true
|
||||
run: |
|
||||
npm run build/start-server.js &
|
||||
echo "Waiting for gateway to start..."
|
||||
while ! curl -s http://localhost:8787 > /dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
echo "Gateway is ready. Running tests..."
|
||||
npm run test:gateway
|
||||
|
||||
- name: Update PR Check
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
const { owner, repo } = context.repo;
|
||||
const issue_number = context.issue.number;
|
||||
|
||||
try {
|
||||
const { data: pull_request } = await github.rest.pulls.get({
|
||||
owner,
|
||||
repo,
|
||||
pull_number: issue_number,
|
||||
});
|
||||
|
||||
const sha = pull_request.head.sha;
|
||||
|
||||
await github.rest.checks.create({
|
||||
owner,
|
||||
repo,
|
||||
name: 'Gateway Tests (Comment Triggered)',
|
||||
head_sha: sha,
|
||||
status: 'completed',
|
||||
conclusion: '${{ steps.run-tests.outcome }}',
|
||||
output: {
|
||||
title: 'Gateway Test Results',
|
||||
summary: 'Gateway tests have completed.',
|
||||
text: 'These tests were triggered by a comment on the PR.'
|
||||
},
|
||||
});
|
||||
|
||||
console.log('Check run created successfully');
|
||||
} catch (error) {
|
||||
console.error('Error creating check run:', error);
|
||||
core.setFailed(`Action failed with error: ${error}`);
|
||||
}
|
||||
|
||||
env:
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
|
||||
@@ -0,0 +1,26 @@
|
||||
name: Auto Triage Label
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
label_issues:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- name: Add Triage Label
|
||||
uses: actions/github-script@v7.0.1
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.addLabels({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
labels: ['triage']
|
||||
})
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
Reference in New Issue
Block a user