Skip to content

Commit 26cb0ef

Browse files
lint
1 parent 3af401d commit 26cb0ef

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Sources/OpenAI/Public/Service/DefaultOpenAIService.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,19 @@ struct DefaultOpenAIService: OpenAIService {
8282
func realtimeSession(
8383
model: String,
8484
configuration: OpenAIRealtimeSessionConfiguration)
85-
async throws -> OpenAIRealtimeSession
85+
async throws -> OpenAIRealtimeSession
8686
{
8787
// Build the WebSocket URL
8888
let baseURL = openAIEnvironment.baseURL.replacingOccurrences(of: "https://", with: "wss://")
8989
let version = openAIEnvironment.version ?? "v1"
90-
90+
9191
// Check if this is an Azure endpoint (contains "azure_openai" in base URL or proxy path)
9292
let isAzureEndpoint = openAIEnvironment.baseURL.contains("azure_openai") ||
93-
(openAIEnvironment.proxyPath?.contains("azure_openai") ?? false)
94-
93+
(openAIEnvironment.proxyPath?.contains("azure_openai") ?? false)
94+
9595
let path: String
9696
let urlString: String
97-
97+
9898
if isAzureEndpoint {
9999
// Azure format: path/realtime?api-version=X&deployment=Y
100100
// For Airbnb's Azure proxy, deployment is passed as a query parameter
@@ -105,32 +105,32 @@ struct DefaultOpenAIService: OpenAIService {
105105
path = openAIEnvironment.proxyPath.map { "\($0)/\(version)" } ?? version
106106
urlString = "\(baseURL)/\(path)/realtime?model=\(model)"
107107
}
108-
108+
109109
guard let url = URL(string: urlString) else {
110110
throw APIError.requestFailed(description: "Invalid realtime session URL")
111111
}
112-
112+
113113
// Create the WebSocket request with auth headers
114114
var request = URLRequest(url: url)
115115
request.setValue(apiKey.value, forHTTPHeaderField: apiKey.headerField)
116-
116+
117117
// Only add openai-beta header for non-Azure endpoints
118118
if !isAzureEndpoint {
119119
request.setValue("realtime=v1", forHTTPHeaderField: "openai-beta")
120120
}
121-
121+
122122
if let organizationID {
123123
request.setValue(organizationID, forHTTPHeaderField: "OpenAI-Organization")
124124
}
125-
125+
126126
// Add any extra headers
127127
extraHeaders?.forEach { key, value in
128128
request.setValue(value, forHTTPHeaderField: key)
129129
}
130-
130+
131131
// Create the WebSocket task
132132
let webSocketTask = URLSession.shared.webSocketTask(with: request)
133-
133+
134134
// Return the realtime session
135135
return OpenAIRealtimeSession(
136136
webSocketTask: webSocketTask,

0 commit comments

Comments
 (0)