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

ollama: Add Support for Custom HTTP Headers in Client 🔐 #511

Closed
wants to merge 3 commits into from

Conversation

tuhochi
Copy link

@tuhochi tuhochi commented Jan 11, 2024

Hello Team,

I've made an update to the ollama package to enhance the functionality of the Client struct. This update allows users to set custom HTTP headers when making requests to the Ollama server.

Key Changes:

  • Added a new field additionalHeaders in the Client struct to store custom headers.
  • Updated the NewClient function to accept custom headers as a parameter.
  • Implemented the parseHeaders function to convert header strings to a map.
  • Modified the do and stream methods of the Client struct to include custom headers in requests.

Why This Change:
Custom HTTP headers are crucial for various use cases, such as setting authentication tokens, customizing content types, or providing API keys. This flexibility is essential for users who need to interact with different types of HTTP-based services through the Ollama client.

Additional Notes:
This change is backward compatible as it adds a new feature without altering the existing functionalities. Users who don't need custom headers can continue to use the client as before.

I believe this enhancement will make the Ollama client more versatile and user-friendly. Looking forward to your feedback and suggestions.

Thank you for considering this contribution!

Best regards tuhochi!

@tmc
Copy link
Owner

tmc commented Jan 18, 2024

I think the approach in #505 is preferable.

@tmc
Copy link
Owner

tmc commented Jan 19, 2024

Closing as #505 merged.

@tmc tmc closed this Jan 19, 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