Commit Graph

62 Commits

Author SHA1 Message Date
Laisky.Cai
aa30c37e3c Merge branch 'upstream/main' 2025-02-03 12:25:00 +00:00
Laisky.Cai
f47c70aaa2 Merge branch 'upstream/main' 2025-01-31 10:32:35 +00:00
JustSong
1fead8e7f7 chore: add debug log for distributor 2025-01-31 17:26:33 +08:00
Laisky.Cai
d5fa98f2e0 fix: translate error messages and comments to English for consistency 2025-01-27 03:34:27 +00:00
Laisky.Cai
13b1b165bd refactor: update UI text and error messages to English for better accessibility 2025-01-19 12:59:58 +00:00
Laisky.Cai
082cfbe574 Merge remote-tracking branch 'origin/upstream/main' 2024-11-20 02:09:28 +00:00
JustSong
6eb0770a89 feat: support set system prompt for channel (close #1920) 2024-11-10 14:53:34 +08:00
抒情熊
fdd7bf41c0
feat: support multipart/form-data format request (#1690)
Some checks failed
CI / Unit tests (push) Has been cancelled
CI / commit_lint (push) Has been cancelled
* "add parser multipart/form-data"

* chore: fix impl

* chore: update impl

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2024-09-22 17:32:47 +08:00
Laisky.Cai
115287b8cf Merge remote-tracking branch 'origin/upstream/main' 2024-06-17 03:16:36 +00:00
Zhong Liu
c1971870fa
fix: support for Spark Lite model (#1526)
* fix: Support for Spark Lite model

* fix: fix panic

* fix: fix xunfei version config

---------

Co-authored-by: JustSong <39998050+songquanpeng@users.noreply.github.com>
Co-authored-by: JustSong <songquanpeng@foxmail.com>
2024-06-13 00:07:26 +08:00
Laisky.Cai
c524e60d9f Merge remote-tracking branch 'origin/upstream/main' 2024-05-29 06:12:37 +00:00
Laisky.Cai
ca23dd9a97 Merge commit '1c2654320e5b6268b13b6efca40ce37a523d032b' 2024-04-28 01:53:31 +00:00
JustSong
9026ec7510 feat: support cloudflare now 2024-04-26 23:05:48 +08:00
Laisky.Cai
425059f5c6 feat: support openai images edits api 2024-04-25 03:02:20 +00:00
Laisky.Cai
84a6817314 feat: able to fetch every request's cost 2024-04-23 00:58:25 +00:00
Laisky.Cai
7047d9605e Merge commit '3d149fedf45472eff92910324974c762fc37dad6' 2024-04-21 15:05:13 +00:00
JustSong
3d149fedf4 chore: do not hardcode context key 2024-04-21 19:43:23 +08:00
JustSong
e30ebda0fe chore: move config key to package ctxkey 2024-04-21 18:55:13 +08:00
Laisky.Cai
c735b9b4d3 Merge commit '2369025842b828ac38f4427fd1ebab8d03b1fe7f' 2024-04-20 01:07:29 +00:00
Laisky.Cai
fc9a784950
feat: support aws bedrockruntime claude3 (#1328)
* feat: support aws bedrockruntime claude3

closes #622, closes #749, closes #1300

* fix: convert to aws claude model id

* fix: Update AWS adapter to handle stream completions and calculate usage metrics

Based on the file summaries provided, here are the important bullet points for the commit message:

- Add functionality to handle stream completion events from AWS in the relay/adaptor/aws/main.go file
- Marshall AWS response to OpenAI format and calculate usage metrics in the same file
- Implement a custom render function for streaming events in the same file
- Improve error handling for JSON unmarshalling and marshalling errors in the same file

* fix: Implement AWS handler with usage tracking and error handling

- Implemented streaming response handling for AWS handler
- Set response content type to text/event-stream
- Added error handling for failed marshaling/unmarshaling
- Updated return values to include `relaymodel.ErrorWithStatusCode` and `relaymodel.Usage`
- Improved error handling and response formatting for AWS adaptor

* fix: Refactor AWS Adapter for Improved Model Mapping and Error Handling

* Refactor AWS adapter to improve model management
  - Replace hardcoded model list in `adapter.go` with a function to get models from `awsModelIDMap`
  - Update `GetModelList` function to return model list directly
  - Add `GetChannelName` function to get channel name from `Adaptor` object
* Improve error handling and code organization in main.go
  - Replace switch statement with a map to map AWS model IDs to OpenAI model IDs
  - Return an error if the model is not found in the map
  - Use a single return statement instead of wrapping multiple return statements in the `awsModelID` function
  - Add a new error message for when the model is not found in the map in the `Handler` function

* fix: bug fix

* chore: change variable name & package

* chore: change variable name

* perf: update config related code

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2024-04-20 00:40:47 +08:00
Laisky.Cai
e93e489ea9 fix: model id 2024-04-18 03:37:25 +00:00
Laisky.Cai
4e1bfe4879 feat: support aws bedrockruntime claude3
closes #622, closes #749, closes #1300
2024-04-18 02:52:26 +00:00
Laisky.Cai
b638a2fcbd Merge commit '7bf61f916504097ac23efb765b938d8f94c342ce' 2024-04-17 05:18:58 +00:00
JustSong
7bf61f9165 fix: fix retry not working (close #1314) 2024-04-15 23:09:12 +08:00
Laisky.Cai
50bab08496 Refactor codebase, introduce relaymode package, update constants and improve consistency
- Refactor constant definitions and organization
- Clean up package level variables and functions
- Introduce new `relaymode` and `apitype` packages for constant definitions
- Refactor and simplify code in several packages including `openai`, `relay/channel/baidu`, `relay/util`, `relay/controller`, `relay/channeltype`
- Add helper functions in `relay/channeltype` package to convert channel type constants to corresponding API type constants
- Remove deprecated functions such as `ResponseText2Usage` from `relay/channel/openai/helper.go`
- Modify code in `relay/util/validation.go` and related files to use new `validator.ValidateTextRequest` function
- Rename `util` package to `relaymode` and update related imports in several packages
2024-04-06 05:18:04 +00:00
JustSong
0b8ccb94eb chore: reorganize common package 2024-04-06 02:03:59 +08:00
JustSong
f9d914873f chore: reorganize constant related package 2024-04-06 00:44:33 +08:00
JustSong
dc7aaf2de5 feat: able to set model limitation for token (close #178) 2024-04-04 02:08:18 +08:00
Laisky.Cai
ddd2dd1041 fix: Refactor relay/channel, upgrade deps, improve request handling and error messages.
* Updated relay/channel/gemini package to use gin-gonic/gin for routing
* Added timeouts, environment variable for proxy, and error handling for HTTP clients in relay/util/init.go
* Improved error handling, URL path cases, and channel selection logic in middleware/distributor.go
* Added Content-Type header, closed request bodies, and added context to requests in relay/channel/common.go
* Upgraded various dependencies in go.mod
* Modified the GetRequestURL method in relay/channel/gemini/adaptor.go to include a "key" parameter in the URL and set a default version of "v1beta"
* Added io and net/http packages in relay/channel/gemini/adaptor.go and relay/channel/gemini/main.go
* Added a struct for GeminiStreamResp and modified response handling in relay/channel/gemini/main.go
* Imported packages for io and net/http added, gin-gonic/gin package added, and error handling improved in relay/channel/gemini/main.go
2024-03-19 03:11:19 +00:00
Laisky.Cai
cb6cb66646 Merge remote-tracking branch 'origin/upstream/main' 2024-03-05 01:02:35 +00:00
JustSong
2df877a352 feat: switch priority when retry (close #1048) 2024-03-03 22:14:07 +08:00
Laisky.Cai
2989686ace fix: Refactor: Migrate Distributor logging to ratio metrics
- Log a ratio for each channel in the context
- Initialize `minimalRatio` to -1 instead of 0
2024-03-01 13:55:21 +00:00
Laisky.Cai
dbe3930a8c fix: Switch to channel-ratio
- Use channel ratios instead of group ratios in all applicable places
- Start using the lowest channel ratio of the specified channel's groups
2024-03-01 13:49:23 +00:00
JustSong
565ea58e68 feat: built in retry supported (close #1036, close #770) 2024-02-25 19:01:49 +08:00
JustSong
de9a58ca0b refactor: use config field to save config 2024-02-18 02:22:50 +08:00
JustSong
2cd1a78203 chore: update module name 2024-01-28 19:38:58 +08:00
JustSong
2d760d4a01
refactor: refactor relay part (#957)
* refactor: refactor relay part

* refactor: refactor config part
2024-01-21 23:21:42 +08:00
David Zhuang
5cf23d8698
feat: add Google Gemini Pro support (#826)
* fest: Add Google Gemini Pro, fix #810

* fest: Add tooling to Gemini; Add OpenAI-like system prompt to Gemini

* refactor: removing unused if statement

* fest: Add dummy model message for system message in gemini model

* chore: update implementation

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2023-12-17 12:48:32 +08:00
JustSong
379074f7d0 feat: support plugin for ali channel (close #797) 2023-12-10 17:22:52 +08:00
ckt1031
ddcaf95f5f
feat: support tts model (#713)
* Added support for Text-to-Speech models and
endpoints

* chore: update impl

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2023-11-17 21:18:51 +08:00
JustSong
b4b4acc288 feat: support Tencent's model (close #519) 2023-10-03 14:19:03 +08:00
JustSong
159b9e3369 fix: fix unable to set zero value for base url & model mapping 2023-09-18 22:07:17 +08:00
JustSong
42451d9d02 refactor: update logging related logic 2023-09-17 15:39:46 +08:00
JustSong
04acdb1ccb feat: support aiproxy's library 2023-09-03 12:51:59 +08:00
JustSong
d09d317459 feat: supper whisper now (close #197) 2023-08-27 15:28:23 +08:00
滔哥
7e058bfb9b
feat: support xunfei's v2 api (#442, close #440)
* 兼容讯飞v2接口

* Revert "兼容讯飞v2接口"

This reverts commit 21f05d1294.

* fix: fix implementation

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
Co-authored-by: JustSong <39998050+songquanpeng@users.noreply.github.com>
2023-08-19 17:50:34 +08:00
JustSong
c87e05bfc2 chore: add more context in error message 2023-07-23 09:49:46 +08:00
ckt
b520b54625
feat: initial support of Dall-E (#148, #266)
* feat: initial support of Dall-E

* fix: fix N not timed

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
Co-authored-by: JustSong <39998050+songquanpeng@users.noreply.github.com>
2023-07-15 12:30:06 +08:00
玩牛牛
81c5901123
feat: add support for /v1/engines/text-embedding-ada-002/embeddings (#224, close #222) 2023-07-15 12:03:23 +08:00
JustSong
aabc546691 fix: fix the wrong message when channel is deleted 2023-06-29 11:27:34 +08:00