@@ -28,6 +28,8 @@ public struct ChatModel: Codable, Equatable, Identifiable {
2828 public var apiKeyName : String
2929 @FallbackDecoding < EmptyString >
3030 public var baseURL : String
31+ @FallbackDecoding < EmptyBool >
32+ public var isFullURL : Bool
3133 @FallbackDecoding < EmptyInt >
3234 public var maxTokens : Int
3335 @FallbackDecoding < EmptyBool >
@@ -44,13 +46,15 @@ public struct ChatModel: Codable, Equatable, Identifiable {
4446 public init (
4547 apiKeyName: String = " " ,
4648 baseURL: String = " " ,
49+ isFullURL: Bool = false ,
4750 maxTokens: Int = 4000 ,
4851 supportsFunctionCalling: Bool = true ,
4952 supportsOpenAIAPI2023_11: Bool = false ,
5053 modelName: String = " "
5154 ) {
5255 self . apiKeyName = apiKeyName
5356 self . baseURL = baseURL
57+ self . isFullURL = isFullURL
5458 self . maxTokens = maxTokens
5559 self . supportsFunctionCalling = supportsFunctionCalling
5660 self . supportsOpenAIAPI2023_11 = supportsOpenAIAPI2023_11
@@ -60,10 +64,15 @@ public struct ChatModel: Codable, Equatable, Identifiable {
6064
6165 public var endpoint : String {
6266 switch format {
63- case . openAI, . openAICompatible :
67+ case . openAI:
6468 let baseURL = info. baseURL
6569 if baseURL. isEmpty { return " https://api.openai.com/v1/chat/completions " }
66- return baseURL
70+ return " \( baseURL) /v1/chat/completions "
71+ case . openAICompatible:
72+ let baseURL = info. baseURL
73+ if baseURL. isEmpty { return " https://api.openai.com/v1/chat/completions " }
74+ if info. isFullURL { return baseURL }
75+ return " \( baseURL) /v1/chat/completions "
6776 case . azureOpenAI:
6877 let baseURL = info. baseURL
6978 let deployment = info. azureOpenAIDeploymentName
0 commit comments