OpenAI icon indicating copy to clipboard operation
OpenAI copied to clipboard

typesafe models

Open kalafus opened this issue 1 year ago • 2 comments

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

kalafus avatar Feb 06 '24 05:02 kalafus

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Feb 16 '24 01:02 sonarqubecloud[bot]

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)

kalafus avatar Feb 16 '24 17:02 kalafus