typesafe models
What
typesafe models
Why
shouldn't have to validate models.
SpeechQuery had a method to validateSpeechModel, pointing out the need to validate Models, and highlighting the lack of validation across all other Query structs.
**Responses should use Strings and never models, as I have observed some endpoints returning strings incompatible with available models -- e.g., if reaching the text-embedding-ada-002 endpoint, response indicates the model used is text-embedding-ada-002-v2. Responses specify that the models are non-optional, so Response models need be strings to guarantee decoding.
Affected Areas
Models and Queries
Quality Gate passed
Issues
0 New issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
as it is, i can e.g., create a ChatQuery with an AudioSpeechQuery model tts-1, and it won't be kicked back until the server returns an APIError. The API defines which Model is compatible with which Query, so why not adopt Query specific model types as i have done in this pull, and achieve maximum type safety, neatly avoiding such scenarios?
(same isn't possible for Results, as endpoints don't necessarily return the same model name as was sent in the Query)