langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
46.89k stars 6.63k forks source link

已经在LocalAI 里设置了Embedding 模型,怎样在创建知识库时使用? #4679

Closed czhcc closed 4 months ago

czhcc commented 4 months ago

Self Checks

Dify version

0.6.8

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

我是本地运行,已在LocalAI中创建了Embedding 模型,但在创建知识库时不能选用。怎样在创建知识库时使用自己的Embedding 模型?

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

dosubot[bot] commented 4 months ago

To use your custom Embedding model when creating a knowledge base in Dify version 0.6.8, follow these steps:

  1. Deploy LocalAI:

    • Clone the LocalAI repository and navigate to the specified directory:
      $ git clone https://github.com/go-skynet/LocalAI
      $ cd LocalAI/examples/langchain-chroma
    • Download example LLM and Embedding models:
      $ wget https://huggingface.co/skeskinen/ggml/resolve/main/all-MiniLM-L6-v2/ggml-model-q4_0.bin -O models/bert
      $ wget https://gpt4all.io/models/ggml-gpt4all-j.bin -O models/ggml-gpt4all-j
    • Configure the .env file:
      $ mv .env.example .env
    • Start LocalAI:
      $ docker-compose up -d --build
      $ docker logs -f langchain-chroma-api-1
  2. Integrate the Models into Dify:

    • Go to Settings > Model Providers > LocalAI in Dify.
    • Fill in the details for the Embedding model:
      • Model Type: Embeddings
      • Model Name: text-embedding-ada-002
      • Server URL: http://127.0.0.1:8080 (or the appropriate host domain if using Docker)
  3. Set the Default Model:

    • Dify automatically selects the default model based on usage, but you can configure this in Settings > Model Provider.
  4. Use the Model in Your Application:

    • Once the model provider is configured, the embedding model will be ready for use in your knowledge base.

By following these steps, you can integrate and use your custom Embedding model in Dify version 0.6.8 [1][2].

#### Details **About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.