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

Implement From<String> for Model, Language, and Redact #86

Merged
merged 5 commits into from
Aug 16, 2024

Conversation

jcdyer
Copy link
Contributor

@jcdyer jcdyer commented Aug 15, 2024

Proposed changes

Add an option to convert strings to various enumerated query options infallibly using From<String>.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update or tests (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING.md doc
  • I have added tests and/or examples that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

A customer has requested this feature. It is not the default way to specify the options, because we want to encourage customers to do it in a type-safe manner using the enum where possible. To use this version, one can simply do:

Options::builder()
    .model(String::from("nova-2").into())
    .build()

(Normally, one would probably have a String to begin with, if it were coming from a runtime input value, so the String::from call would not be needed. If it is being created directly in code, the existing enum should be used directly.

Options::builder()
    .model(Model::Nova2)
    .build()

src/common/options.rs Outdated Show resolved Hide resolved
jcdyer and others added 2 commits August 16, 2024 14:14
@DamienDeepgram
Copy link
Contributor

LGTM

@jcdyer jcdyer merged commit eec66ac into main Aug 16, 2024
18 checks passed
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.

3 participants