Skip to content

extproc: remove the path from the translator factory#334

Merged
mathetake merged 5 commits intoenvoyproxy:mainfrom
nacx:cleanup-translator-factory
Feb 13, 2025
Merged

extproc: remove the path from the translator factory#334
mathetake merged 5 commits intoenvoyproxy:mainfrom
nacx:cleanup-translator-factory

Conversation

@nacx
Copy link
Copy Markdown
Member

@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
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
Copy Markdown
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
Copy Markdown
Member 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
Copy Markdown
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
Copy Markdown
Member

coverage!

@nacx nacx force-pushed the cleanup-translator-factory branch from c3a1722 to 916b0bf Compare February 13, 2025 09:04
nacx added 4 commits February 13, 2025 16:48
Signed-off-by: Ignasi Barrera <ignasi@tetrate.io>
Signed-off-by: Ignasi Barrera <ignasi@tetrate.io>
Signed-off-by: Ignasi Barrera <ignasi@tetrate.io>
Signed-off-by: Ignasi Barrera <ignasi@tetrate.io>
@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
Copy Markdown
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 <ignasi@tetrate.io>
Copy link
Copy Markdown
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
16 checks passed
@nacx nacx deleted the cleanup-translator-factory branch February 13, 2025 16:00
mathetake added a commit that referenced this pull request Feb 18, 2025
**Commit Message**

extproc: decouple router package from api paths

This is a follow-up change to decouple the router package from the API
paths. Now that we have specialized processors per API path it does not
make sense for the router package to have path-related logic.
Now each processor is responsible for instantiating the right body
parser for the path they're processing.

**Related Issues/PRs (if applicable)**

Follow-up for #325 and
#334

**Special notes for reviewers (if applicable)**

N/A

---------

Signed-off-by: Ignasi Barrera <ignasi@tetrate.io>
Co-authored-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
daixiang0 pushed a commit to daixiang0/ai-gateway that referenced this pull request Feb 19, 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:
envoyproxy#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.

---------

Signed-off-by: Ignasi Barrera <ignasi@tetrate.io>
Signed-off-by: Loong <long0dai@foxmail.com>
daixiang0 pushed a commit to daixiang0/ai-gateway that referenced this pull request Feb 19, 2025
**Commit Message**

extproc: decouple router package from api paths

This is a follow-up change to decouple the router package from the API
paths. Now that we have specialized processors per API path it does not
make sense for the router package to have path-related logic.
Now each processor is responsible for instantiating the right body
parser for the path they're processing.

**Related Issues/PRs (if applicable)**

Follow-up for envoyproxy#325 and
envoyproxy#334

**Special notes for reviewers (if applicable)**

N/A

---------

Signed-off-by: Ignasi Barrera <ignasi@tetrate.io>
Co-authored-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Loong <long0dai@foxmail.com>
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