Skip to content

Commit

Permalink
support azure openai api
Browse files Browse the repository at this point in the history
  • Loading branch information
fatwang2 committed Apr 23, 2024
1 parent 25244df commit 54625a1
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 22 deletions.
10 changes: 9 additions & 1 deletion README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<a href="https://www.buymeacoffee.com/fatwang2" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>

# Version Updates
- V0.2.3, 20240423, support for Azure OpenAI in Cloudflare Worker. It also introduces the ability to use an authorization code and customize the user's request key.
- V0.2.2, 20240420, support Moonshot API
- V0.2.1, 20240310, supports Google, Bing, Duckduckgo, Search1API for news-type searches; supports adjusting the number of search results via the MAX_RESULTS environment variable; supports adjusting the number of in-depth searches desired via the CRAWL_RESULTS environment variable.
- V0.2.0,20240310,Optimized openai.js, cloudflare worker version, really faster this time!
Expand Down Expand Up @@ -38,6 +39,7 @@ Help your LLM API support networking, search, news, web page summarization, has
| Model | Features | Stream | Deployments |
| -------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `OpenAI` | search, news, crawler | stream, unstream| Zeabur, Local deployment, Cloudflare Worker, Vercel|
| `Azure OpenAI` | search, news, crawler | stream, unstream| Cloudflare Worker|
| `Gemini` | search | stream, unstream| Cloudflare Worker|
| `Moonshot` | search, news, crawler | unstream| Zeabur, Local deployment, Cloudflare Worker, Vercel|

Expand Down Expand Up @@ -112,12 +114,18 @@ This project provides some additional configuration options, which can be set th
| `GOOGLE_KEY` | Conditional | Required if Google search is selected. API key. Apply at https://search2ai.online/googlekey. | `xxx` |
| `SERPAPI_KEY` | Conditional | Required if serpapi is selected. Free 100 times/month. Register at https://search2ai.online/serpapi. | `xxx` |
| `SERPER_KEY` | Conditional | Required if serper is selected. Free 2500 times for 6 months. Register at https://search2ai.online/serper. | `xxx` |
| `OPENAI_TYPE` | No | OpenAI provider source, default is openai | `openai, azure` |
| `RESOURCE_NAME` | Conditional | Required if azure is selected | `xxxx` |
| `DEPLOY_NAME` | Conditional | Required if azure is selected | `gpt-35-turbo` |
| `API_VERSION` | Conditional | Required if azure is selected | `2024-02-15-preview` |
| `AZURE_API_KEY` | Conditional | Required if azure is selected | `xxxx` |
| `AUTH_KEYS` | No | If you want users to define a separate authorization code as a key when making requests, you need to fill this in. Required if azure is selected | `000,1111,2222` |
| `OPENAI_API_KEY` | No | If you want users to define a separate authorization code as a key when requesting openai, you need to fill this in | `sk-xxx` |

# Risk statement
To ensure the persistence of this project, certain interface requests will be forwarded via [search1api](https://search.search2ai.one). Please be assured that this forwarding service does not save any private data.

# Future Iterations
- Support for Azure OpenAI
- Fix streaming output issues in Vercel project
- Improve the speed of streaming output
- Support more vertical searches
Expand Down
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@
<a href="https://www.buymeacoffee.com/fatwang2" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>

# 版本更新
- V0.2.3,20240423,Cloudflare Worker版本支持Azure OpenAI;支持授权码,可自定义用户的请求key
- V0.2.2,20240420,支持Moonshot的非流式模式
- V0.2.1,20240310,支持Google、Bing、Duckduckgo、Search1API新闻类搜索;支持通过环境变量MAX_RESULTS调整搜索结果数量;支持通过环境变量CRAWL_RESULTS调整希望深度搜索的数量
- V0.2.0,20240310,优化openai.js,cloudflare worker版本,这次速度真的更快了!
- V0.1.9,20240318,优化openai.js对流式的处理方式,速度更快,建议更新;修复服务器部署版本的语音问题;增加Github赞助按钮
- V0.1.8,20240305,支持search1api搜索服务,更新Gemini版本搜索变量配置,开放新闻搜索能力,增加风险声明
- V0.1.7,20240224,Gemini版本支持流式输出,且兼容vision model
- V0.1.6,20240221,支持Gemini模型,暂时可通过cloudflare worker的方式配置
- V0.1.5,20240205,支持新闻搜索,快速浏览新闻更方便
- V0.1.4,20240120,支持Zeabur一键部署,非常方便,强烈推荐!
- V0.1.3,20240120,支持本地部署,可自行部署在自己的服务器上

更多历史更新,请参见 [版本记录](https://github.com/fatwang2/search2ai/releases)

Expand All @@ -39,6 +33,7 @@
| 模型 | 功能 | 流式输出 | 部署方式 |
| -------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `OpenAI` | 联网、新闻、内容爬取 | 流式、非流式| Zeabur、本地部署、Cloudflare Worker、Vercel|
| `Azure OpenAI` | 联网、新闻、内容爬取 | 流式、非流式| Cloudflare Worker|
| `Gemini` | 联网 | 流式、非流式| Cloudflare Worker|
| `Moonshot` | 联网、新闻、内容爬取 | 非流式| Zeabur、本地部署、Cloudflare Worker、Vercel|

Expand Down Expand Up @@ -113,21 +108,20 @@ http://localhost:3014/v1/chat/completions
| `GOOGLE_KEY` | No | 如选Google搜索必填,API key,申请地址 https://search2ai.online/googlekey| `xxx`|
| `SERPAPI_KEY` | No | 如选serpapi必填,免费100次/月,注册地址 https://search2ai.online/serpapi| `xxx`|
| `SERPER_KEY` | No | 如选serper必填,6个月免费额度2500次,注册地址 https://search2ai.online/serper| `xxx`|
| `OPENAI_API` | No | 默认为openai,支持openai, azure| `openai`|
| `OPENAI_TYPE` | No | openai供给来源,默认为openai| `openai, azure`|
| `RESOURCE_NAME` | No | 如选azure必填| `xxxx`|
| `DEPLOY_NAME` | No | 如选azure必填| `gpt-35-turbo`|
| `API_VERSION` | No | 如选azure必填| `2024-03-01-preview`|
| `AUTH_KEYS` | Yes | 必填,对外授权码| `000,1111,2222`|
| `API_VERSION` | No | 如选azure必填| `2024-02-15-preview`|
| `AZURE_API_KEY` | No | 如选azure必填| `xxxx`|
| `OPENAI_API_KEY` | No | 如选Openai必填| `sk-xxx`|
| `AUTH_KEYS` | No | 如果希望用户请求的时候单独定义授权码作为key,则需要填写,如选azure则必填| `000,1111,2222`|
| `OPENAI_API_KEY` | No | 如果希望用户请求openai的时候也单独定义授权码作为key,则需要填写| `sk-xxx`|



# 风险声明
为了确保本项目的持久运行,某些接口请求将通过[search1api](https://search.search2ai.one)进行转发。请放心,该转发服务不会保存任何隐私数据。

# 后续迭代
- 支持Azure OpenAI
- 修复Vercel项目流式输出问题
- 提升流式输出的速度
- 支持更多垂类搜索
44 changes: 35 additions & 9 deletions search2openai.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 54625a1

Please sign in to comment.