error occurred when I used dify to integrate the embedding model deployed by ollama #5554

Closed
opened 2026-02-21 18:11:35 -05:00 by yindo · 4 comments
Owner

Originally created by @hanyimei on GitHub (Sep 11, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.8.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

An error occurred when I used dify to integrate the embedding model deployed by ollama:
An error occurred during credentials validation: Session.request() got an unexpected keyword argument 'options'
This is not an issue when using dify v0.7.2, and the same error occurs when replacing the embedding model deployed in ollama

✔️ Expected Behavior

Integrate the embedding model deployed by ollama on dify

Actual Behavior

An error occurred during credentials validation: Session.request() got an unexpected keyword argument 'options'

Originally created by @hanyimei on GitHub (Sep 11, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.8.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce An error occurred when I used dify to integrate the embedding model deployed by ollama: An error occurred during credentials validation: Session.request() got an unexpected keyword argument 'options' This is not an issue when using dify v0.7.2, and the same error occurs when replacing the embedding model deployed in ollama ### ✔️ Expected Behavior Integrate the embedding model deployed by ollama on dify ### ❌ Actual Behavior An error occurred during credentials validation: Session.request() got an unexpected keyword argument 'options'
yindo added the 🐞 bug label 2026-02-21 18:11:35 -05:00
yindo closed this issue 2026-02-21 18:11:35 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 11, 2024):

Hello @hanyimei! I'm here to help you with any bugs, questions, or contributions. Let's tackle this issue together while we wait for a human maintainer.

I found some similar issues and discussions that might help you resolve the error you're encountering:

  1. Similar Discussions:

  2. Similar Issues:

The solution to a similar issue suggests ensuring that the arguments passed to the httpx request are correctly structured. Here is the correct way to configure the Session.request() method in Dify to avoid the 'unexpected keyword argument' error:

def _do_http_request(self, headers: dict[str, Any]) -> httpx.Response:
    """
    do http request depending on api bundle
    """
    kwargs = {
        "url": self.server_url,
        "headers": headers,
        "params": self.params,
        "timeout": (self.timeout.connect, self.timeout.read, self.timeout.write),
        "follow_redirects": True,
    }

    if self.method in ("get", "head", "post", "put", "delete", "patch"):
        response = getattr(ssrf_proxy, self.method)(data=self.body, files=self.files, **kwargs)
    else:
        raise ValueError(f"Invalid http method {self.method}")
    return response

Ensure that you are passing the correct arguments to the HttpExecutor class and that the method signature matches the expected parameters [6].

Additionally, when upgrading from Dify version 0.7.2 to 0.8.0, you need to adjust the VECTOR_STORE environment variable in your .env file to specify your desired vector database service. This is a new requirement in version 0.8.0 [7].

Make sure to configure these settings according to your specific vector database service.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 11, 2024): <!-- Greeting --> Hello @hanyimei! I'm here to help you with any bugs, questions, or contributions. Let's tackle this issue together while we wait for a human maintainer. <!-- Answer --> I found some similar issues and discussions that might help you resolve the error you're encountering: 1. **Similar Discussions**: - [An error occurred during credentials validation](https://github.com/langgenius/dify/discussions/3639) <sup>[[1]](https://github.com/langgenius/dify/discussions/3639)</sup> - [Adding a local ollama model error](https://github.com/langgenius/dify/discussions/7362) <sup>[[2]](https://github.com/langgenius/dify/discussions/7362)</sup> 2. **Similar Issues**: - [Ollama Embed RAG 500 Bad Request](https://github.com/langgenius/dify/issues/8128) (Closed) <sup>[[3]](https://github.com/langgenius/dify/issues/8128)</sup> - [Ollama reports an error when adding Text Embedding](https://github.com/langgenius/dify/issues/8209) (Closed) <sup>[[4]](https://github.com/langgenius/dify/issues/8209)</sup> - [Connection error using Ollama](https://github.com/langgenius/dify/issues/2624) (Closed) <sup>[[5]](https://github.com/langgenius/dify/issues/2624)</sup> The solution to a similar issue suggests ensuring that the arguments passed to the `httpx` request are correctly structured. Here is the correct way to configure the `Session.request()` method in Dify to avoid the 'unexpected keyword argument' error: ```python def _do_http_request(self, headers: dict[str, Any]) -> httpx.Response: """ do http request depending on api bundle """ kwargs = { "url": self.server_url, "headers": headers, "params": self.params, "timeout": (self.timeout.connect, self.timeout.read, self.timeout.write), "follow_redirects": True, } if self.method in ("get", "head", "post", "put", "delete", "patch"): response = getattr(ssrf_proxy, self.method)(data=self.body, files=self.files, **kwargs) else: raise ValueError(f"Invalid http method {self.method}") return response ``` Ensure that you are passing the correct arguments to the `HttpExecutor` class and that the method signature matches the expected parameters <sup>[[6]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/http_request/http_executor.py)</sup>. Additionally, when upgrading from Dify version 0.7.2 to 0.8.0, you need to adjust the `VECTOR_STORE` environment variable in your `.env` file to specify your desired vector database service. This is a new requirement in version 0.8.0 <sup>[[7]](https://github.com/langgenius/dify/blob/main/docker/README.md)</sup>. Make sure to configure these settings according to your specific vector database service. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Sep 11, 2024):

This has been fixed. See above discussions.

@crazywoola commented on GitHub (Sep 11, 2024): This has been fixed. See above discussions.
Author
Owner

@hanyimei commented on GitHub (Sep 11, 2024):

It worked fine when I used the same url to integrate large models deployed by ollama

@hanyimei commented on GitHub (Sep 11, 2024): It worked fine when I used the same url to integrate large models deployed by ollama
Author
Owner

@hanyimei commented on GitHub (Sep 11, 2024):

I don't understand your solution, please explain it in detail

@hanyimei commented on GitHub (Sep 11, 2024): I don't understand your solution, please explain it in detail
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5554