Comments (4)
Can you describe the usage scenario of the function and the specific problem solved?
from chatgpt-next-web.
I have also encountered a similar scenario, and I will describe the specific requirements in detail: It is necessary to add a parameter to control whether the selected model must use a third-party custom interface. For example, I own a third-party proxy interface address (which includes custom features like quotas and other custom functions). This interface address has been implemented and unified all other model interfaces, such as integrating OpenAI, Claude, Gemini, etc., with the unified interface format being OpenAI's standard format. Now when I use the Claude model, I want it to go through my customized third-party proxy interface instead of calling the model's own API. Currently, I have to modify the code in api.ts to meet my needs, and the comments are the modified code.
constructor(provider: ModelProvider = ModelProvider.GPT) {
switch (provider) {
case ModelProvider.GeminiPro:
this.llm = new GeminiProApi();
break;
case ModelProvider.Claude:
this.llm = new ChatGPTApi();
// this.llm = new ClaudeApi();
break;
default:
this.llm = new ChatGPTApi();
}
}
我也碰到过相关场景,我大概描述一下具体的需求:需要增加一个 参数 来控制 选用模型是否强制使用第三方自定义接口
比如我拥有一个第三方代理接口地址(里面自定义了额度等其他自定义功能),这个接口地址已经实现并统一了所有的其他模型接口,比如集成 opnenai、claude、gemini等模型,统一接口格式为openai的标准格式。
现在我调用 claude 模型,我希望走的是我自定义的第三方代理接口而不是调用本身模型相关的API,
当前情况下,我不得不修改 api.ts 里面的这段代码来实现我的需求,注释是修改过的代码
constructor(provider: ModelProvider = ModelProvider.GPT) {
switch (provider) {
case ModelProvider.GeminiPro:
this.llm = new GeminiProApi();
break;
case ModelProvider.Claude:
this.llm = new ChatGPTApi();
// this.llm = new ClaudeApi();
break;
default:
this.llm = new ChatGPTApi();
}
}
from chatgpt-next-web.
如果能实现类似效果的话,也不失为一种解决方案:
constructor(provider: ModelProvider = ModelProvider.GPT) {
//通过环境变量选择按原始路由进行请求,还是按OpenAI的标准格式请求
//readSomeEnvConfig() 是假想的函数
const chatGeminiThroughOpenai = readSomeEnvConfig();
const chatClaudeThroughOpenai = readSomeEnvConfig();
switch (provider) {
case ModelProvider.GeminiPro:
if (chatGeminiThroughOpenai){
this.llm = new ChatGPTApi();
}
else{
this.llm = new GeminiProApi();
}
break;
case ModelProvider.Claude:
if (chatClaudeThroughOpenai){
this.llm = new ChatGPTApi();
}
else{
this.llm = new ClaudeApi();
}
break;
default:
this.llm = new ChatGPTApi();
}
}
from chatgpt-next-web.
Can you describe the usage scenario of the function and the specific problem solved?
As mentioned by the individuals below, there is a request to add a field where one can input the URL of intermediary servers (such as one-api, new-api, etc.) in order to request all models through the URL addresses of these intermediary servers. This includes not only OpenAI's models but also other models like Claude.
from chatgpt-next-web.
Related Issues (20)
- Cloudflare 的模型前面带@ 类似@cf/meta/llama-2-7b-chat-fp16 如何部署走openai通道 HOT 2
- [Bug] The issue with the large amount of accumulated content
- [Bug] When using the claude 3 opus, send a message and reply with data: [DONE], the other claude model succeeds.
- [Feature Request] docker镜像里有计划更新这个功能吗? HOT 1
- [Bug] Mask中不会默认选中azure的模型 HOT 3
- [Bug] "The Quota has been exceeded" - Version 2.14.1 (20240806.144936) - Mac M1 HOT 6
- [Bug] HOT 4
- [Bug] upstash 同步失败 HOT 1
- [Bug] empty response from server HOT 4
- [Bug] Claude3 opus 回复大段文字失败 HOT 5
- [Bug] 更新到 2.14.1 之后 Gemini Free Tier 无法使用 HOT 1
- [Bug] invalid_request_error with claude and anthropic api HOT 2
- [Feature Request] Custom Endpoint API Claude
- [Bug] 当使用让AI识别图片时,对话没有被总结,以至于后续提问完全忽略图片内容。 HOT 1
- [Bug] 新版本检测错误 HOT 4
- [Feature Request] 对话中希望增加模型名称的显示 HOT 1
- [Bug] 升級到 2.14.1 之後, google gemini 無法使用 HOT 1
- [Bug] windows 端exe无法自定义接口 HOT 1
- [Bug] `CUSTOM_MODELS`可选项配置`-all,+xxx`后导致自定义模型无法使用 HOT 1
- [Feature Request] Add support for prompt caching with Claude HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatgpt-next-web.