@@ -8,7 +8,8 @@ Convert different model APIs into the OpenAI API format out of the box.
88
99当前支持模型:
1010
11- - Azure OpenAI API
11+ - Azure OpenAI API (GPT 3.5/4)
12+ - Azure GPT4 Vision (GPT4v)
1213- YI 34B API
1314- Google Gemini Pro
1415
@@ -43,6 +44,27 @@ docker run --rm -it -e AZURE_ENDPOINT=https://suyang231210.openai.azure.com/ -p
4344
4445当服务启动之后,我们就可以通过访问 ` http://localhost:8080/v1 ` 来访问和 OpenAI 一样的 API 服务啦。
4546
47+ 你可以使用 ` curl ` 来进行一个快速测试:
48+
49+ ``` bash
50+ curl -v http://127.0.0.1:8080/v1/chat/completions \
51+ -H " Content-Type: application/json" \
52+ -H " Authorization: Bearer 123" \
53+ -d ' {
54+ "model": "gpt-4",
55+ "messages": [
56+ {
57+ "role": "system",
58+ "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."
59+ },
60+ {
61+ "role": "user",
62+ "content": "Compose a poem that explains the concept of recursion in programming."
63+ }
64+ ]
65+ }'
66+ ```
67+
4668你如果你希望不要将 API Key 暴露给应用,或者不放心各种复杂的开源软件是否有 API Key 泄漏风险,我们可以多配置一个 ` AZURE_API_KEY=你的 API Key ` 环境变量,然后各种开源软件在请求的时候就无需再填写 API key 了(或者随便填写也行)。
4769
4870当然,因为 Azure 的一些限制,以及一些开源软件中的模型调用名称不好调整,我们可以通过下面的方式,来将原始请求中的模型,映射为我们真实的模型名称。比如,将 GPT 3.5/4 都替换为 ` yi-34b-chat ` :
@@ -53,6 +75,34 @@ gpt-3.5-turbo:yi-34b-chat,gpt-4:yi-34b-chat
5375
5476如果你希望使用 ` yi-34b-chat ` ,或者 ` gemini-pro ` ,我们需要设置 ` AOA_TYPE=yi ` 或者 ` AOA_TYPE=gemini ` ,除此之外,没有任何差别。
5577
78+ ### GPT4 Vision
79+
80+
81+ 如果你已经拥有了 Azure GPT4 Vision,并且想要使用 OpenAI API 的接口格式来进行调用,我们可以在使用 ` azure ` 服务类型时,设置 ` AZURE_VISION ` 的数值为 ` true|1|on|yes ` 任意值,激活 Vision API。
82+
83+ ``` bash
84+ AZURE_VISION=true
85+ ```
86+
87+ 调用方法很简单,除了使用 SDK 之外,同样可以使用 ` curl ` :
88+
89+ ``` bash
90+ curl -v http://127.0.0.1:8080/v1/chat/completions \
91+ -H " Content-Type: application/json" \
92+ -H " Authorization: Bearer 123" \
93+ -d ' {
94+ "model": "gpt-4v",
95+ "messages":[
96+ {"role":"system","content":"You are a helpful assistant."},
97+ {"role":"user","content":[
98+ {"type":"text","text":"Describe this picture:"},
99+ { "type": "image_url", "image_url": { "url": "https://learn.microsoft.com/azure/ai-services/computer-vision/media/quickstarts/presentation.png", "detail": "high" }}
100+ ]}
101+ ]
102+ }'
103+ ```
104+
105+
56106## 容器快速上手
57107
58108项目中包含当前支持的三种模型接口的 ` docker compose ` 示例文件,我们将 ` example ` 目录中的不同的文件,按需选择使用,将必填的信息填写完毕后,将文件修改为 ` docker-compose.yml ` 。
0 commit comments