From aef14559a13bfc2537a5998a1f8c27e693576a96 Mon Sep 17 00:00:00 2001 From: Huanzhang Hu Date: Mon, 9 Sep 2024 09:24:12 +0800 Subject: [PATCH] change models api (#54) Co-authored-by: huhuanzhang --- main.go | 123 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 88 insertions(+), 35 deletions(-) diff --git a/main.go b/main.go index 6937120..5d60def 100644 --- a/main.go +++ b/main.go @@ -224,9 +224,12 @@ func (s *ProxyService) models(c *gin.Context) { "data": []gin.H{ { "capabilities": gin.H{ - "family": "gpt-3.5-turbo", - "object": "model_capabilities", - "type": "chat", + "family": "gpt-3.5-turbo", + "limits": gin.H{"max_prompt_tokens": 12288}, + "object": "model_capabilities", + "supports": gin.H{"tool_calls": true}, + "tokenizer": "cl100k_base", + "type": "chat", }, "id": "gpt-3.5-turbo", "name": "GPT 3.5 Turbo", @@ -235,20 +238,26 @@ func (s *ProxyService) models(c *gin.Context) { }, { "capabilities": gin.H{ - "family": "gpt-3.5-turbo", - "object": "model_capabilities", - "type": "chat", + "family": "gpt-3.5-turbo", + "limits": gin.H{"max_prompt_tokens": 12288}, + "object": "model_capabilities", + "supports": gin.H{"tool_calls": true}, + "tokenizer": "cl100k_base", + "type": "chat", }, "id": "gpt-3.5-turbo-0613", - "name": "GPT 3.5 Turbo (2023-06-13)", + "name": "GPT 3.5 Turbo", "object": "model", "version": "gpt-3.5-turbo-0613", }, { "capabilities": gin.H{ - "family": "gpt-4", - "object": "model_capabilities", - "type": "chat", + "family": "gpt-4", + "limits": gin.H{"max_prompt_tokens": 20000}, + "object": "model_capabilities", + "supports": gin.H{"tool_calls": true}, + "tokenizer": "cl100k_base", + "type": "chat", }, "id": "gpt-4", "name": "GPT 4", @@ -257,53 +266,95 @@ func (s *ProxyService) models(c *gin.Context) { }, { "capabilities": gin.H{ - "family": "gpt-4", - "object": "model_capabilities", - "type": "chat", + "family": "gpt-4", + "limits": gin.H{"max_prompt_tokens": 20000}, + "object": "model_capabilities", + "supports": gin.H{"tool_calls": true}, + "tokenizer": "cl100k_base", + "type": "chat", }, "id": "gpt-4-0613", - "name": "GPT 4 (2023-06-13)", + "name": "GPT 4", "object": "model", "version": "gpt-4-0613", }, { "capabilities": gin.H{ - "family": "gpt-4-turbo", - "object": "model_capabilities", - "type": "chat", + "family": "gpt-4-turbo", + "limits": gin.H{"max_prompt_tokens": 20000}, + "object": "model_capabilities", + "supports": gin.H{"parallel_tool_calls": true, "tool_calls": true}, + "tokenizer": "cl100k_base", + "type": "chat", }, "id": "gpt-4-0125-preview", - "name": "GPT 4 Turbo (2024-01-25 Preview)", + "name": "GPT 4 Turbo", "object": "model", "version": "gpt-4-0125-preview", }, { "capabilities": gin.H{ - "family": "text-embedding-ada-002", - "object": "model_capabilities", - "type": "embeddings", + "family": "gpt-4o", + "limits": gin.H{"max_prompt_tokens": 20000}, + "object": "model_capabilities", + "supports": gin.H{"parallel_tool_calls": true, "tool_calls": true}, + "tokenizer": "o200k_base", + "type": "chat", }, - "id": "text-embedding-ada-002", - "name": "Embedding V2 Ada", + "id": "gpt-4o", + "name": "GPT 4o", "object": "model", - "version": "text-embedding-ada-002", + "version": "gpt-4o-2024-05-13", + }, + { + "capabilities": gin.H{ + "family": "gpt-4o", + "limits": gin.H{"max_prompt_tokens": 20000}, + "object": "model_capabilities", + "supports": gin.H{"parallel_tool_calls": true, "tool_calls": true}, + "tokenizer": "o200k_base", + "type": "chat", + }, + "id": "gpt-4o-2024-05-13", + "name": "GPT 4o", + "object": "model", + "version": "gpt-4o-2024-05-13", + }, + { + "capabilities": gin.H{ + "family": "gpt-4o", + "limits": gin.H{"max_prompt_tokens": 20000}, + "object": "model_capabilities", + "supports": gin.H{"parallel_tool_calls": true, "tool_calls": true}, + "tokenizer": "o200k_base", + "type": "chat", + }, + "id": "gpt-4-o-preview", + "name": "GPT 4o", + "object": "model", }, { "capabilities": gin.H{ - "family": "text-embedding-ada-002", - "object": "model_capabilities", - "type": "embeddings", + "family": "text-embedding-ada-002", + "limits": gin.H{"max_inputs": 256}, + "object": "model_capabilities", + "supports": gin.H{}, + "tokenizer": "cl100k_base", + "type": "embeddings", }, - "id": "text-embedding-ada-002-index", - "name": "Embedding V2 Ada (Index)", + "id": "text-embedding-ada-002", + "name": "Embedding V2 Ada", "object": "model", "version": "text-embedding-ada-002", }, { "capabilities": gin.H{ - "family": "text-embedding-3-small", - "object": "model_capabilities", - "type": "embeddings", + "family": "text-embedding-3-small", + "limits": gin.H{"max_inputs": 256}, + "object": "model_capabilities", + "supports": gin.H{"dimensions": true}, + "tokenizer": "cl100k_base", + "type": "embeddings", }, "id": "text-embedding-3-small", "name": "Embedding V3 small", @@ -312,9 +363,11 @@ func (s *ProxyService) models(c *gin.Context) { }, { "capabilities": gin.H{ - "family": "text-embedding-3-small", - "object": "model_capabilities", - "type": "embeddings", + "family": "text-embedding-3-small", + "object": "model_capabilities", + "supports": gin.H{"dimensions": true}, + "tokenizer": "cl100k_base", + "type": "embeddings", }, "id": "text-embedding-3-small-inference", "name": "Embedding V3 small (Inference)",