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

[FEATURE] Ollama Authentication Header injection #586

Open
sraeuchle opened this issue Feb 1, 2024 · 1 comment
Open

[FEATURE] Ollama Authentication Header injection #586

sraeuchle opened this issue Feb 1, 2024 · 1 comment
Labels
enhancement New feature or request P2 High priority

Comments

@sraeuchle
Copy link

Hey there,

I have run a Ollama Instance behind a Authentication Proxy so i need to send a Authentication Header for every Ollama Request.
In your current OllamaClient implementation I can't handle that in any way. See:

public OllamaClient(String baseUrl, Duration timeout) {

please add a OKHttpClient on your builder as optional so I am able to do an inject like so:

OkHttpClient client = new OkHttpClient.Builder().addInterceptor(new Interceptor() {
      @Override
      public Response intercept(Chain chain) throws IOException {
        Request newRequest  = chain.request().newBuilder()
            .addHeader("Authorization", "Bearer " + token)
            .build();
        return chain.proceed(newRequest);
      }
    }).build();

OllamaChatModel.builder()
    .client(client)
    ....

Thanks a lot!

@sraeuchle sraeuchle added the enhancement New feature or request label Feb 1, 2024
@mnnayeck
Copy link

total blocker :(

@langchain4j langchain4j added the P2 High priority label Apr 17, 2024
langchain4j pushed a commit that referenced this issue May 7, 2024
## Context
See #586 

## Change
Add `customHeaders` parameter in `Ollama*Model` builders

## Checklist
Before submitting this PR, please check the following points:
- [ ] I have added unit and integration tests for my change
- [x] All unit and integration tests in the module I have added/changed
are green
- [x] All unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules are green
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
geoand added a commit to quarkiverse/quarkus-langchain4j that referenced this issue May 13, 2024
geoand added a commit to quarkiverse/quarkus-langchain4j that referenced this issue May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2 High priority
Projects
None yet
Development

No branches or pull requests

3 participants