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

feat: Add configurable endpoint option #222

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

udostm
Copy link

@udostm udostm commented Aug 1, 2024

What

This PR adds fully customizable endpoint support. Instead of "just" adding basePath you can now pass a fully configured endpoint URL.

Why

Internal/hosted OpenAI Instances sometimes use different paths to host the OpenAI endpoint. Previous versions of the framework only allowed for changing scheme, host and port. As changing the basePath is a common requirement (and also supported by frameworks in other languages) this PR adds fully customisable endpoint support - incl. the basePath.

Affected Areas

  • Introduced a new initializer that accepts a fully configured endpoint: URL.
  • The existing initializer (accepting host, port, and scheme) remains available and now also configures the endpoint.
  • Converted the previously stored host, port, and scheme properties to computed properties based on the endpoint to maintain API compatibility.

- Introduced a new initializer that accepts a fully configured endpoint URL.
- The existing initializer (accepting `host`, `port`, and `scheme`) remains available and now also configures the endpoint.
- Converted the previously stored `host`, `port`, and `scheme` properties to computed properties based on the endpoint to maintain API compatibility.
@udostm
Copy link
Author

udostm commented Aug 1, 2024

Base on #221 it might make sense to rewrite the code to not include the /v1 suffix implicitly?

This update allows the `endpoint:URL` to specify the entire `basePath`, including the version path segment (e.g., `/v1`).
Copy link

sonarcloud bot commented Aug 1, 2024

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