Add bearer token support to API requests #46
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces the use of bearer tokens for authentication in the OllamaKit API requests. The changes include adding a new
bearerToken
property to theOllamaKit
struct and updating various methods to include this token when making API requests.Key changes include:
Authentication Enhancement
bearerToken
property to theOllamaKit
struct and updated the initializer to accept this token. (Sources/OllamaKit/OllamaKit.swift
) [1] [2]asURLRequest
method inOKRouter
to include the bearer token in the request headers if provided. (Sources/OllamaKit/Utils/OKRouter.swift
)API Request Updates
chat
method inOllamaKit+Chat.swift
[1] [2]copyModel
method inOllamaKit+CopyModel.swift
[1] [2]deleteModel
method inOllamaKit+DeleteModel.swift
[1] [2]embeddings
method inOllamaKit+Embeddings.swift
[1] [2]generate
method inOllamaKit+Generate.swift
[1] [2]modelInfo
method inOllamaKit+ModelInfo.swift
[1] [2]models
method inOllamaKit+Models.swift
[1] [2]pullModel
method inOllamaKit+PullModel.swift
[1] [2]reachable
method inOllamaKit+Reachable.swift
[1] [2]I'm still looking at this, and working on testing it, just wanted to get the initial code into PR form.