Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typesafe models #166

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

kalafus
Copy link
Contributor

@kalafus kalafus commented Feb 6, 2024

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

Copy link

sonarcloud bot commented Feb 16, 2024

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

@kalafus
Copy link
Contributor Author

kalafus commented Feb 16, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant