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

Update openai client generation #545

Merged
merged 2 commits into from
Nov 17, 2023
Merged

Conversation

fedefernandez
Copy link
Contributor

Some context:

  • All the classes in the package com.xebia.functional.openai.models.ext. are manually created
  • All the classes in the package com.xebia.functional.openai but not in models.ext are generated automatically from the API

This PR:

  • Delegates the model classes generation to the generation library (removing the manual ones)
  • Updates the API template for exposing the HTTP client. The file ApiClient.kt.mustache is a copy from the original template with the change in the lateinit var client: HttpClient (removing the private modifier). This is reflected in ApiClient.kt
  • Adds a new generic type, OpenAIModel, to customize the model sent (it can be one of the supported model by the specific endpoint or a custom model)
  • Updates de KMMGeneratorConfig.java to support the generation of anyOf models

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.

Great job, @fedefernandez! 🙌

@fedefernandez fedefernandez merged commit 91b282c into main Nov 17, 2023
5 checks passed
@fedefernandez fedefernandez deleted the openai-generated-client-models branch November 17, 2023 12:00
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