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

Add support for gpt-4o-mini in ModelType #787

Merged
merged 1 commit into from
Sep 11, 2024
Merged

Conversation

realdavidvega
Copy link
Contributor

Background

ModelType didn't have the enum of gpt-4o-mini with the right encoding configuration, leading to falling back to ModelType.TODO, which has CL100K encoding.

This led to errors when using the tokenizer decoder, like in the AI.runWithEnumSingleTokenSerializer, which was used for one token enums.

This PR

Adds ModelType.GPT_4O_MINI with O200K_BASE encoding and 128000 context length.

Example:

@Serializable
enum class Sentiment {
  positive,
  negative,
  neutral
}

suspend fun main() {
  val sentiment = AI<Sentiment>("I love Xef!", config = AIConfig(model = CreateChatCompletionRequestModel.gpt_4o_mini))
  println(sentiment) // positive
}

which returns positive.

Copy link
Contributor

@Montagon Montagon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@realdavidvega realdavidvega merged commit f51bbb3 into main Sep 11, 2024
6 checks passed
@realdavidvega realdavidvega deleted the feature/gpt-4o-mini branch September 11, 2024 14:47
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.

2 participants