A number of types that are `Codable` don't encode correctly
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 38/100
Línea de trabajo
Start with Sources/OpenAI/Public/Models/ChatQuery.swift, especially ChatQuery.ChatCompletionMessageParam, and identify other typed enums with the same encoding or decoding concern. Add round-trip tests for the affected types and verify that encoding then decoding returns the initial value.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
A number of types that are Codable don't encode correctly. This seems to impact a number of the typed enums that are typically received from an OpenAI compatible server and that are not persisted by a client (unless the client would persist its requests)
For instance ChatQuery.ChatCompletionMessageParam would need a decoding such as
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let role = try container.decode(Role.self, forKey: .role)
switch role {
case .system:
self = try .system(.init(from: decoder))
case .developer:
self = try .developer(.init(from: decoder))
case .user:
self = try .user(.init(from: decoder))
case .assistant:
self = try .assistant(.init(from: decoder))
case .tool:
self = try .tool(.init(from: decoder))
}
}
I mostly look at the types in ChatQuery but typically you need to hand write the encoding / decoding for each typed enum as the generated conformances are not correct and only you know about the key used to determine which nested type is right.
As a side note, it could be helpful to have tests that validate that the encoding and decoding of those types gives back the initial value.
Lmk if you want a PR.
- Lenguaje dominante
- Swift
- Estrellas
- 2.9k
- Forks
- 519
- Merge medio
- 4 d 9 h
- PR fusionados (30 d)
- 13
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de MacPaw/OpenAI
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 3 días
-
Enable batch promptsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
MacPaw/OpenAI#73 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 3 días
-
Check the HTTP status code for JSON responsesPosiblemente ocupada @mvanhorn la tomó hace 2 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
MacPaw/OpenAI#469 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 3 días
-
Add Batch API supportAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 3 días
Todos los issues de MacPaw/OpenAI
Issues similares
-
type: cleanup
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
googleapis/google-cloud-swift#1477 ·
Los mantenedores suelen responder en 1 día
-
🐛 Bug Report: Console `/join` shows an endless spinner for invited users who are not signed inAbiertoproduct / auth product / console product / databases product / messaging product / self-hosted product / sites product / storage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
P1 status: first-line-handled status: needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
a2ui-project/a2ui#3282 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
binding:web core docs p3
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
RunanywhereAI/runanywhere-sdks#1123 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
omacom/try-omarchy#359 ·
Los mantenedores suelen responder en 1 día