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

extproc: remove the path from the translator factory #334

Merged
merged 5 commits into from
Feb 13, 2025

Conversation

nacx
Copy link
Contributor

@nacx nacx commented Feb 12, 2025

Commit Message

extproc: remove the path from the translator factory

Removes the path from the translator factory, now that there is a dedicated processor for the chat completion endpoint.

Related Issues/PRs (if applicable)

Follow-up for: #325 (review)

Special notes for reviewers (if applicable)

Note that I don't remove the Factory type completely so that only the right translator is instantiated and only when needed.

@nacx nacx requested a review from a team as a code owner February 12, 2025 22:58
@nacx nacx changed the title Remove the path from the translator factory extproc: remove the path from the translator factory Feb 12, 2025
// - `l`: the logger.
type Factory func(path string) (Translator, error)
// Factory creates a [Translator] for the given API schema combination.
type Factory func() Translator

// NewFactory returns a callback function that creates a translator for the given API schema combination.
func NewFactory(in, out filterapi.VersionedAPISchema) (Factory, error) {
Copy link
Member

Choose a reason for hiding this comment

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

should we now rename this to NewChatCompletionTranslatorFactory ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've completely removed the Factory now, and moved the translator instantiation to the chat completion processor, as it does only make sense for that processor.

WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

sg

@nacx nacx marked this pull request as draft February 12, 2025 23:36
@nacx nacx marked this pull request as ready for review February 13, 2025 00:23
@mathetake
Copy link
Member

coverage!

@nacx nacx force-pushed the cleanup-translator-factory branch from c3a1722 to 916b0bf Compare February 13, 2025 09:04
@nacx nacx force-pushed the cleanup-translator-factory branch from 916b0bf to bbfdc4e Compare February 13, 2025 15:50
}
return nil, fmt.Errorf("unsupported path: %s", path)
// NewOpenAIToAWSBedrockTranslator implements [Factory] for OpenAI to AWS Bedrock translation.
func NewOpenAIToAWSBedrockTranslator() Translator {
Copy link
Member

Choose a reason for hiding this comment

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

here as well

Signed-off-by: Ignasi Barrera <[email protected]>
Copy link
Member

@mathetake mathetake left a comment

Choose a reason for hiding this comment

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

Thank you for a nice clean up!

@mathetake mathetake merged commit f49dc98 into envoyproxy:main Feb 13, 2025
17 checks passed
@nacx nacx deleted the cleanup-translator-factory branch February 13, 2025 16: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