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

Custom Headers #158

Merged
merged 3 commits into from
Nov 7, 2024
Merged

Custom Headers #158

merged 3 commits into from
Nov 7, 2024

Conversation

ParthSareen
Copy link
Contributor

@ParthSareen ParthSareen commented Nov 7, 2024

  • Allow users to add custom headers
  • Prevents overriding of basic headers
  • Updated interface to user HeadersInit instead of Headers -> more flexible class
type HeadersInit = [string, string][] | Record<string, string> | Headers

Checked functionality by adding logging middleware on go server locally.
Also ran some quick tests:
image

Closes #154
Closes #156

Shoutout to @gnpaone for getting it most of the way there!

ParthSareen and others added 2 commits November 7, 2024 11:54
Co-authored-by: Naveen <78990165+gnpaone@users.noreply.github.com>
@ParthSareen ParthSareen requested a review from BruceMacD November 7, 2024 20:15

if (!options.headers) {
options.headers = {}
}

// Filter out default headers from custom headers
const customHeaders = Object.fromEntries(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bringing to parity with python sdk impl. For ref: ollama/ollama-python#313

src/utils.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@BruceMacD BruceMacD left a comment

Choose a reason for hiding this comment

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

Thanks for finishing this off

Co-authored-by: Bruce MacDonald <brucewmacdonald@gmail.com>
@ParthSareen ParthSareen merged commit 6e7e496 into main Nov 7, 2024
3 checks passed
@ParthSareen ParthSareen deleted the parth/header-passthrough branch November 7, 2024 21:22
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