songquanpeng / one-api

OpenAI 接口管理 & 分发系统,支持 Azure、Anthropic Claude、Google PaLM 2 & Gemini、智谱 ChatGLM、百度文心一言、讯飞星火认知、阿里通义千问、360 智脑以及腾讯混元,可用于二次分发管理 key,仅单可执行文件,已打包好 Docker 镜像,一键部署,开箱即用. OpenAI key management & redistribution system, using a single API for all LLMs, and features an English UI.
https://openai.justsong.cn/
MIT License
19.41k stars 4.32k forks source link

feat: update Gemini adaptor to support custom response_format #1890

Closed mxdlzg closed 1 month ago

mxdlzg commented 1 month ago

The code changes in the main.go file update the Gemini adaptor to support custom response formats. It adds a mimeTypeMap variable to map response format types to MIME types. The ConvertRequest function now checks if the ResponseFormat field is provided in the request and sets the appropriate response MIME type and schema in the geminiRequest object.

我已确认该 PR 已自测通过,相关截图如下: (此处放上测试通过的截图,如果不涉及前端改动或从 UI 上无法看出,请放终端启动成功的截图)

image

image

image