-
Notifications
You must be signed in to change notification settings - Fork 510
Closed
Description
Since the new Update I keep client.chats(query: ChatQuery()) keeps throwing errors. Example code:
let result = try await client.chats(query: ChatQuery(
messages: [
.init(role: .system, content: """
You are a music expert who knows every style, genre, artist, and album; from mainstream hits to obscure world music. You can sense any gathering's mood and craft the perfect playlist. Your job is to create a playlist that perfectly fits a shoort description we'll provide. The user will send you albums in the format `artist - title`. Return, in JSON format, those albums, in that exact same `artist - title` format, which match the given description.
EXAMPLE JSON OUTPUT:
{
"playlist": [
"Philip Glass - Koyaanisqatsi",
"Philip Glass - Glassworks",
"Philip Glass - Einstein on the Beach"
]
}
THE DESCRIPTION: \(prompt)
""")!,
.init(role: .user, content: albums.map(\.description).joined(
separator: "\n"))!,
],
model: model.rawValue,
responseFormat: .jsonObject
))This will throw:
keyNotFound(CodingKeys(stringValue: "tool_calls", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "choices", intValue: nil), _CodingKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "message", intValue: nil)], debugDescription: "No value associated with key CodingKeys(stringValue: \"tool_calls\", intValue: nil) (\"tool_calls\").", underlyingError: nil))
Using model gpt-4o. When using the DeepSeek api host/model it throws a slightly different error:
keyNotFound(CodingKeys(stringValue: "annotations", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "choices", intValue: nil), _CodingKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "message", intValue: nil)], debugDescription: "No value associated with key CodingKeys(stringValue: \"annotations\", intValue: nil) (\"annotations\").", underlyingError: nil))
Both models used to work in 0.3.6.
Metadata
Metadata
Assignees
Labels
No labels