Skip to content

Commit 1c0f046

Browse files
authored
Add AIProxy support for setting custom ClientID (#52)
1 parent 2092e73 commit 1c0f046

File tree

4 files changed

+112
-100
lines changed

4 files changed

+112
-100
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,18 @@ For example, a `429` means that your requests are being rate limited.
123123
The `APIError` type has a case `responseUnsuccessful` with two associated values: a `description` and `statusCode`.
124124
Here is a usage example using the chat completion API:
125125

126-
```
127-
let service = OpenAIServiceFactory.service(apiKey: apiKey)
128-
let parameters = ChatCompletionParameters(messages: [.init(role: .user, content: .text("hello world"))],
129-
model: .gpt4o)
130-
do {
131-
let choices = try await service.startChat(parameters: parameters).choices
132-
// Work with choices
133-
} catch APIError.responseUnsuccessful(let description, let statusCode) {
134-
print("Network error with status code: \(statusCode) and description: \(description)")
135-
} catch {
136-
print(error.localizedDescription)
137-
}
126+
```swift
127+
let service = OpenAIServiceFactory.service(apiKey: apiKey)
128+
let parameters = ChatCompletionParameters(messages: [.init(role: .user, content: .text("hello world"))],
129+
model: .gpt4o)
130+
do {
131+
let choices = try await service.startChat(parameters: parameters).choices
132+
// Work with choices
133+
} catch APIError.responseUnsuccessful(let description, let statusCode) {
134+
print("Network error with status code: \(statusCode) and description: \(description)")
135+
} catch {
136+
print(error.localizedDescription)
137+
}
138138
```
139139

140140

0 commit comments

Comments
 (0)