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

无法启动成功,无法使用 #1354

Open
yuzhi-jiang opened this issue Mar 4, 2025 · 32 comments
Open

无法启动成功,无法使用 #1354

yuzhi-jiang opened this issue Mar 4, 2025 · 32 comments
Labels
bug Something isn't working

Comments

@yuzhi-jiang
Copy link

前提ifno: ollama本地部署,已有配置中相关模型,启动时docker-compose.yml相关端口未占用, wrenai version: 0.15.3

问题1:pgsql,password带有符号#时,无法识别,

Image

Image

问题二:无法使用

Image

Image

这是返回值:

{
    "errors": [
        {
            "locations": [
                {
                    "line": 2,
                    "column": 3
                }
            ],
            "path": [
                "createAskingTask"
            ],
            "message": "Cannot read properties of null (reading 'hash')",
            "extensions": {
                "code": "INTERNAL_SERVER_ERROR",
                "message": "Cannot read properties of null (reading 'hash')",
                "shortMessage": "Internal server error"
            }
        }
    ],
    "data": null
}

以下是config.yml

type: llm
provider: litellm_llm
models:
- api_base: http://127.0.0.1:11434/v1  # change this to your ollama host, api_base should be <ollama_url>/v1
  api_key_name: LLM_OLLAMA_API_KEY
  model: openai/deepseek-r1:14b  # openai/<ollama_model_name>
  timeout: 600

---
type: embedder
provider: litellm_embedder
models:
# - model: text-embedding-3-large
#   api_base: https://api.openai.com/v1
#   api_key_name: EMBEDDER_OPENAI_API_KEY
#   timeout: 120
- model: openai/bge-m3:latest  # put your ollama embedder model name here, openai/<ollama_model_name>
  api_base: http://127.0.0.1:11434/v1  # change this to your ollama host, api_base should be <ollama_url>/v1
  api_key_name: EMBEDDER_OLLAMA_API_KEY
  timeout: 600
---
type: engine
provider: wren_ui
endpoint: http://wren-ui:3000

---
type: document_store
provider: qdrant
location: http://qdrant:6333
embedding_model_dim: 3072
timeout: 120
recreate_index: true

---
type: pipeline
pipes:
  - name: db_schema_indexing
    embedder: litellm_embedder.openai/bge-m3:latest
    document_store: qdrant
  - name: historical_question_indexing
    embedder: litellm_embedder.openai/bge-m3:latest
    document_store: qdrant
  - name: table_description_indexing
    embedder: litellm_embedder.openai/bge-m3:latest
    document_store: qdrant
  - name: db_schema_retrieval
    llm: litellm_llm.openai/deepseek-r1:14b
    embedder: litellm_embedder.openai/bge-m3:latest
    document_store: qdrant
  - name: historical_question_retrieval
    embedder: litellm_embedder.openai/bge-m3:latest
    document_store: qdrant
  - name: sql_generation
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_correction
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: followup_sql_generation
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_summary
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_answer
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_breakdown
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_expansion
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_explanation
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: semantics_description
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: relationship_recommendation
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: question_recommendation
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: question_recommendation_db_schema_retrieval
    llm: litellm_llm.openai/deepseek-r1:14b
    embedder: litellm_embedder.openai/bge-m3:latest
    document_store: qdrant
  - name: question_recommendation_sql_generation
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: chart_generation
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: chart_adjustment
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: intent_classification
    llm: litellm_llm.openai/deepseek-r1:14b
    embedder: litellm_embedder.openai/bge-m3:latest
    document_store: qdrant
  - name: data_assistance
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_pairs_indexing
    document_store: qdrant
    embedder: litellm_embedder.openai/bge-m3:latest
  - name: sql_pairs_deletion
    document_store: qdrant
    embedder: litellm_embedder.openai/bge-m3:latest
  - name: sql_pairs_retrieval
    document_store: qdrant
    embedder: litellm_embedder.openai/bge-m3:latest
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: preprocess_sql_data
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_executor
    engine: wren_ui
  - name: sql_question_generation
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_generation_reasoning
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_regeneration
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui

---
settings:
  column_indexing_batch_size: 50
  table_retrieval_size: 10
  table_column_retrieval_size: 100
  allow_using_db_schemas_without_pruning: false
  query_cache_maxsize: 1000
  query_cache_ttl: 3600
  langfuse_host: https://cloud.langfuse.com
  langfuse_enable: true
  logging_level: DEBUG
  development: false

.env配置:

COMPOSE_PROJECT_NAME=wrenai
PLATFORM=linux/amd64

PROJECT_DIR=.

# service port
WREN_ENGINE_PORT=8080
WREN_ENGINE_SQL_PORT=7432
WREN_AI_SERVICE_PORT=5555
WREN_UI_PORT=3000
IBIS_SERVER_PORT=8000
WREN_UI_ENDPOINT=http://wren-ui:${WREN_UI_PORT}

# ai service settings
QDRANT_HOST=qdrant
SHOULD_FORCE_DEPLOY=1

# vendor keys
LLM_OPENAI_API_KEY=
EMBEDDER_OPENAI_API_KEY=
LLM_AZURE_OPENAI_API_KEY=
EMBEDDER_AZURE_OPENAI_API_KEY=
QDRANT_API_KEY=
LLM_OLLAMA_API_KEY=xxx
EMBEDDER_OLLAMA_API_KEY=xxx

# version
# CHANGE THIS TO THE LATEST VERSION
WREN_PRODUCT_VERSION=0.15.3
WREN_ENGINE_VERSION=0.13.1
WREN_AI_SERVICE_VERSION=0.15.7
IBIS_SERVER_VERSION=0.13.1
WREN_UI_VERSION=0.20.1
WREN_BOOTSTRAP_VERSION=0.1.5

# user id (uuid v4)
USER_UUID=

# for other services
POSTHOG_API_KEY=phc_nhF32aj4xHXOZb0oqr2cn4Oy9uiWzz6CCP4KZmRq9aE
POSTHOG_HOST=https://app.posthog.com
TELEMETRY_ENABLED=true
# this is for telemetry to know the model, i think ai-service might be able to provide a endpoint to get the information
GENERATION_MODEL=gpt-4o-mini
LANGFUSE_SECRET_KEY=
LANGFUSE_PUBLIC_KEY=

# the port exposes to the host
# OPTIONAL: change the port if you have a conflict
HOST_PORT=3000
AI_SERVICE_FORWARD_PORT=5555

# Wren UI
EXPERIMENTAL_ENGINE_RUST_VERSION=false

以下是一些容器的log:

Image

Image

wrenai-wren-ai-service-1

2025-03-04 14:24:02 INFO:     Started server process [9]
2025-03-04 14:24:02 INFO:     Waiting for application startup.
2025-03-04 14:24:02 I0304 06:24:02.642 9 wren-ai-service:40] Imported Provider: src.providers.document_store
2025-03-04 14:24:02 I0304 06:24:02.646 9 wren-ai-service:64] Registering provider: qdrant
2025-03-04 14:24:02 I0304 06:24:02.646 9 wren-ai-service:40] Imported Provider: src.providers.document_store.qdrant
2025-03-04 14:24:02 I0304 06:24:02.647 9 wren-ai-service:40] Imported Provider: src.providers.embedder
2025-03-04 14:24:03 I0304 06:24:03.547 9 wren-ai-service:64] Registering provider: azure_openai_embedder
2025-03-04 14:24:03 I0304 06:24:03.547 9 wren-ai-service:40] Imported Provider: src.providers.embedder.azure_openai
2025-03-04 14:24:04 /app/.venv/lib/python3.12/site-packages/pydantic/_internal/_config.py:345: UserWarning: Valid config keys have changed in V2:
2025-03-04 14:24:04 * 'fields' has been removed
2025-03-04 14:24:04   warnings.warn(message, UserWarning)
2025-03-04 14:24:05 I0304 06:24:05.271 9 wren-ai-service:64] Registering provider: litellm_embedder
2025-03-04 14:24:05 I0304 06:24:05.271 9 wren-ai-service:40] Imported Provider: src.providers.embedder.litellm
2025-03-04 14:24:05 I0304 06:24:05.276 9 wren-ai-service:64] Registering provider: ollama_embedder
2025-03-04 14:24:05 I0304 06:24:05.276 9 wren-ai-service:40] Imported Provider: src.providers.embedder.ollama
2025-03-04 14:24:05 I0304 06:24:05.287 9 wren-ai-service:64] Registering provider: openai_embedder
2025-03-04 14:24:05 I0304 06:24:05.288 9 wren-ai-service:40] Imported Provider: src.providers.embedder.openai
2025-03-04 14:24:05 I0304 06:24:05.289 9 wren-ai-service:40] Imported Provider: src.providers.engine
2025-03-04 14:24:05 I0304 06:24:05.291 9 wren-ai-service:64] Registering provider: wren_ui
2025-03-04 14:24:05 I0304 06:24:05.292 9 wren-ai-service:64] Registering provider: wren_ibis
2025-03-04 14:24:05 I0304 06:24:05.293 9 wren-ai-service:64] Registering provider: wren_engine
2025-03-04 14:24:05 I0304 06:24:05.293 9 wren-ai-service:40] Imported Provider: src.providers.engine.wren
2025-03-04 14:24:05 I0304 06:24:05.295 9 wren-ai-service:40] Imported Provider: src.providers.llm
2025-03-04 14:24:05 I0304 06:24:05.318 9 wren-ai-service:64] Registering provider: azure_openai_llm
2025-03-04 14:24:05 I0304 06:24:05.318 9 wren-ai-service:40] Imported Provider: src.providers.llm.azure_openai
2025-03-04 14:24:05 I0304 06:24:05.319 9 wren-ai-service:64] Registering provider: litellm_llm
2025-03-04 14:24:05 I0304 06:24:05.321 9 wren-ai-service:40] Imported Provider: src.providers.llm.litellm
2025-03-04 14:24:05 I0304 06:24:05.332 9 wren-ai-service:64] Registering provider: ollama_llm
2025-03-04 14:24:05 I0304 06:24:05.332 9 wren-ai-service:40] Imported Provider: src.providers.llm.ollama
2025-03-04 14:24:05 I0304 06:24:05.464 9 wren-ai-service:64] Registering provider: openai_llm
2025-03-04 14:24:05 I0304 06:24:05.464 9 wren-ai-service:40] Imported Provider: src.providers.llm.openai
2025-03-04 14:24:05 I0304 06:24:05.465 9 wren-ai-service:40] Imported Provider: src.providers.loader
2025-03-04 14:24:05 ERROR:    Traceback (most recent call last):
2025-03-04 14:24:05   File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 693, in lifespan
2025-03-04 14:24:05     async with self.lifespan_context(app) as maybe_state:
2025-03-04 14:24:05   File "/usr/local/lib/python3.12/contextlib.py", line 204, in __aenter__
2025-03-04 14:24:05     return await anext(self.gen)
2025-03-04 14:24:05            ^^^^^^^^^^^^^^^^^^^^^
2025-03-04 14:24:05   File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
2025-03-04 14:24:05     async with original_context(app) as maybe_original_state:
2025-03-04 14:24:05   File "/usr/local/lib/python3.12/contextlib.py", line 204, in __aenter__
2025-03-04 14:24:05     return await anext(self.gen)
2025-03-04 14:24:05            ^^^^^^^^^^^^^^^^^^^^^
2025-03-04 14:24:05   File "/src/__main__.py", line 31, in lifespan
2025-03-04 14:24:05     pipe_components = generate_components(settings.components)
2025-03-04 14:24:05                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-04 14:24:05   File "/src/providers/__init__.py", line 332, in generate_components
2025-03-04 14:24:05     config = transform(configs)
2025-03-04 14:24:05              ^^^^^^^^^^^^^^^^^^
2025-03-04 14:24:05   File "/src/providers/__init__.py", line 294, in transform
2025-03-04 14:24:05     converted = processor(entry)
2025-03-04 14:24:05                 ^^^^^^^^^^^^^^^^
2025-03-04 14:24:05   File "/src/providers/__init__.py", line 78, in llm_processor
2025-03-04 14:24:05     "kwargs": model["kwargs"],
2025-03-04 14:24:05               ~~~~~^^^^^^^^^^
2025-03-04 14:24:05 KeyError: 'kwargs'
2025-03-04 14:24:05 
2025-03-04 14:24:05 ERROR:    Application startup failed. Exiting.
2025-03-04 14:25:02 INFO:     Started server process [8]
2025-03-04 14:25:02 INFO:     Waiting for application startup.
2025-03-04 14:25:02 I0304 06:25:02.173 8 wren-ai-service:40] Imported Provider: src.providers.document_store
2025-03-04 14:25:02 I0304 06:25:02.176 8 wren-ai-service:64] Registering provider: qdrant
2025-03-04 14:25:02 I0304 06:25:02.176 8 wren-ai-service:40] Imported Provider: src.providers.document_store.qdrant
2025-03-04 14:25:02 I0304 06:25:02.177 8 wren-ai-service:40] Imported Provider: src.providers.embedder
2025-03-04 14:25:02 I0304 06:25:02.732 8 wren-ai-service:64] Registering provider: azure_openai_embedder
2025-03-04 14:25:02 I0304 06:25:02.732 8 wren-ai-service:40] Imported Provider: src.providers.embedder.azure_openai
2025-03-04 14:25:03 /app/.venv/lib/python3.12/site-packages/pydantic/_internal/_config.py:345: UserWarning: Valid config keys have changed in V2:
2025-03-04 14:25:03 * 'fields' has been removed
2025-03-04 14:25:03   warnings.warn(message, UserWarning)
2025-03-04 14:25:04 I0304 06:25:04.114 8 wren-ai-service:64] Registering provider: litellm_embedder
2025-03-04 14:25:04 I0304 06:25:04.115 8 wren-ai-service:40] Imported Provider: src.providers.embedder.litellm
2025-03-04 14:25:04 I0304 06:25:04.117 8 wren-ai-service:64] Registering provider: ollama_embedder
2025-03-04 14:25:04 I0304 06:25:04.117 8 wren-ai-service:40] Imported Provider: src.providers.embedder.ollama
2025-03-04 14:25:04 I0304 06:25:04.120 8 wren-ai-service:64] Registering provider: openai_embedder
2025-03-04 14:25:04 I0304 06:25:04.120 8 wren-ai-service:40] Imported Provider: src.providers.embedder.openai
2025-03-04 14:25:04 I0304 06:25:04.121 8 wren-ai-service:40] Imported Provider: src.providers.engine
2025-03-04 14:25:04 I0304 06:25:04.122 8 wren-ai-service:64] Registering provider: wren_ui
2025-03-04 14:25:04 I0304 06:25:04.123 8 wren-ai-service:64] Registering provider: wren_ibis
2025-03-04 14:25:04 I0304 06:25:04.123 8 wren-ai-service:64] Registering provider: wren_engine
2025-03-04 14:25:04 I0304 06:25:04.123 8 wren-ai-service:40] Imported Provider: src.providers.engine.wren
2025-03-04 14:25:04 I0304 06:25:04.125 8 wren-ai-service:40] Imported Provider: src.providers.llm
2025-03-04 14:25:04 I0304 06:25:04.133 8 wren-ai-service:64] Registering provider: azure_openai_llm
2025-03-04 14:25:04 I0304 06:25:04.133 8 wren-ai-service:40] Imported Provider: src.providers.llm.azure_openai
2025-03-04 14:25:04 I0304 06:25:04.134 8 wren-ai-service:64] Registering provider: litellm_llm
2025-03-04 14:25:04 I0304 06:25:04.134 8 wren-ai-service:40] Imported Provider: src.providers.llm.litellm
2025-03-04 14:25:04 I0304 06:25:04.137 8 wren-ai-service:64] Registering provider: ollama_llm
2025-03-04 14:25:04 I0304 06:25:04.138 8 wren-ai-service:40] Imported Provider: src.providers.llm.ollama
2025-03-04 14:25:04 I0304 06:25:04.195 8 wren-ai-service:64] Registering provider: openai_llm
2025-03-04 14:25:04 I0304 06:25:04.195 8 wren-ai-service:40] Imported Provider: src.providers.llm.openai
2025-03-04 14:25:04 I0304 06:25:04.196 8 wren-ai-service:40] Imported Provider: src.providers.loader
2025-03-04 14:25:04 ERROR:    Traceback (most recent call last):
2025-03-04 14:25:04   File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 693, in lifespan
2025-03-04 14:25:04     async with self.lifespan_context(app) as maybe_state:
2025-03-04 14:25:04   File "/usr/local/lib/python3.12/contextlib.py", line 204, in __aenter__
2025-03-04 14:25:04     return await anext(self.gen)
2025-03-04 14:25:04            ^^^^^^^^^^^^^^^^^^^^^
2025-03-04 14:25:04   File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
2025-03-04 14:25:04     async with original_context(app) as maybe_original_state:
2025-03-04 14:25:04   File "/usr/local/lib/python3.12/contextlib.py", line 204, in __aenter__
2025-03-04 14:25:04     return await anext(self.gen)
2025-03-04 14:25:04            ^^^^^^^^^^^^^^^^^^^^^
2025-03-04 14:25:04   File "/src/__main__.py", line 31, in lifespan
2025-03-04 14:25:04     pipe_components = generate_components(settings.components)
2025-03-04 14:25:04                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-04 14:25:04   File "/src/providers/__init__.py", line 332, in generate_components
2025-03-04 14:25:04     config = transform(configs)
2025-03-04 14:25:04              ^^^^^^^^^^^^^^^^^^
2025-03-04 14:25:04   File "/src/providers/__init__.py", line 294, in transform
2025-03-04 14:25:04     converted = processor(entry)
2025-03-04 14:25:04                 ^^^^^^^^^^^^^^^^
2025-03-04 14:25:04   File "/src/providers/__init__.py", line 78, in llm_processor
2025-03-04 14:25:04     "kwargs": model["kwargs"],
2025-03-04 14:25:04               ~~~~~^^^^^^^^^^
2025-03-04 14:25:04 KeyError: 'kwargs'
2025-03-04 14:25:04 
2025-03-04 14:25:04 ERROR:    Application startup failed. Exiting.

Image

@yuzhi-jiang yuzhi-jiang added the bug Something isn't working label Mar 4, 2025
@wwwy3y3
Copy link
Member

wwwy3y3 commented Mar 4, 2025

hi @yuzhi-jiang thanks for reporting.

As for the first subissue you mentioned here, cannot connect to postgres with password contains #, I think will be resolved by #1281 , which will soon be released.

@paopa could you check the config yaml here ? see what's going on.

@paopa
Copy link
Member

paopa commented Mar 4, 2025

Hi @yuzhi-jiang, I noticed the error is due to leaking the kwargs for llm. If you don't want specified kwargs for llm, at least leave kwargs: {} in the model section. Thank you!

e.g.

models:
- api_base: https://api.openai.com/v1
  api_key_name: LLM_OPENAI_API_KEY
  kwargs: {}
  model: gpt-4o-mini-2024-07-18

@yuzhi-jiang
Copy link
Author

hi @yuzhi-jiang thanks for reporting.

As for the first subissue you mentioned here, cannot connect to postgres with password contains #, I think will be resolved by #1281 , which will soon be released.

@paopa could you check the config yaml here ? see what's going on.
好的感谢

@yuzhi-jiang
Copy link
Author

Hi @yuzhi-jiang, I noticed the error is due to leaking the kwargs for llm. If you don't want specified kwargs for llm, at least leave kwargs: {} in the model section. Thank you!

e.g.

models:

你好,我按要求补上了 kwargs: {} ,但测试还是有些别的问题,AuthenticationError是LLM_OLLAMA_API_KEY=xxx不行吗,因为ollama没有设置密码

{
    "errors": [
        {
            "locations": [
                {
                    "line": 2,
                    "column": 3
                }
            ],
            "path": [
                "createAskingTask"
            ],
            "message": "Cannot read properties of null (reading 'hash')",
            "extensions": {
                "code": "INTERNAL_SERVER_ERROR",
                "message": "Cannot read properties of null (reading 'hash')",
                "shortMessage": "Internal server error"
            }
        }
    ],
    "data": null
}

==========
log:

 File "/app/.venv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 356, in exception_type
2025-03-04 19:44:09     raise AuthenticationError(
2025-03-04 19:44:09 litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-04 19:44:09 -------------------------------------------------------------------
2025-03-04 19:44:09 Oh no an error! Need help with Hamilton?
2025-03-04 19:44:09 Join our slack and ask for help! https://join.slack.com/t/hamilton-opensource/shared_invite/zt-2niepkra8-DGKGf_tTYhXuJWBTXtIs4g
2025-03-04 19:44:09 -------------------------------------------------------------------
2025-03-04 19:44:09 
2025-03-04 19:44:09 E0304 11:44:09.878 8 wren-ai-service:132] Request 1e7597a1-ec64-4fe1-b52f-2b9c9a2d940a: Error validating question: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

@paopa
Copy link
Member

paopa commented Mar 4, 2025

Hi @yuzhi-jiang, I noticed the error is due to leaking the kwargs for llm. If you don't want specified kwargs for llm, at least leave kwargs: {} in the model section. Thank you!
e.g.
models:

你好,我按要求补上了 kwargs: {} ,但测试还是有些别的问题,AuthenticationError是LLM_OLLAMA_API_KEY=xxx不行吗,因为ollama没有设置密码

{
    "errors": [
        {
            "locations": [
                {
                    "line": 2,
                    "column": 3
                }
            ],
            "path": [
                "createAskingTask"
            ],
            "message": "Cannot read properties of null (reading 'hash')",
            "extensions": {
                "code": "INTERNAL_SERVER_ERROR",
                "message": "Cannot read properties of null (reading 'hash')",
                "shortMessage": "Internal server error"
            }
        }
    ],
    "data": null
}

========== log:

 File "/app/.venv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 356, in exception_type
2025-03-04 19:44:09     raise AuthenticationError(
2025-03-04 19:44:09 litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-04 19:44:09 -------------------------------------------------------------------
2025-03-04 19:44:09 Oh no an error! Need help with Hamilton?
2025-03-04 19:44:09 Join our slack and ask for help! https://join.slack.com/t/hamilton-opensource/shared_invite/zt-2niepkra8-DGKGf_tTYhXuJWBTXtIs4g
2025-03-04 19:44:09 -------------------------------------------------------------------
2025-03-04 19:44:09 
2025-03-04 19:44:09 E0304 11:44:09.878 8 wren-ai-service:132] Request 1e7597a1-ec64-4fe1-b52f-2b9c9a2d940a: Error validating question: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

Right. I think you could remove api_key_name: LLM_OPENAI_API_KEY in both the llm and embedder sections, and give it a try again. Thank you!

@yuzhi-jiang
Copy link
Author

Hi @yuzhi-jiang, I noticed the error is due to leaking the kwargs for llm. If you don't want specified kwargs for llm, at least leave kwargs: {} in the model section. Thank you!
e.g.
models:

你好,我按要求补上了 kwargs: {} ,但测试还是有些别的问题,AuthenticationError是LLM_OLLAMA_API_KEY=xxx不行吗,因为ollama没有设置密码

{
    "errors": [
        {
            "locations": [
                {
                    "line": 2,
                    "column": 3
                }
            ],
            "path": [
                "createAskingTask"
            ],
            "message": "Cannot read properties of null (reading 'hash')",
            "extensions": {
                "code": "INTERNAL_SERVER_ERROR",
                "message": "Cannot read properties of null (reading 'hash')",
                "shortMessage": "Internal server error"
            }
        }
    ],
    "data": null
}

========== log:

 File "/app/.venv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 356, in exception_type
2025-03-04 19:44:09     raise AuthenticationError(
2025-03-04 19:44:09 litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-04 19:44:09 -------------------------------------------------------------------
2025-03-04 19:44:09 Oh no an error! Need help with Hamilton?
2025-03-04 19:44:09 Join our slack and ask for help! https://join.slack.com/t/hamilton-opensource/shared_invite/zt-2niepkra8-DGKGf_tTYhXuJWBTXtIs4g
2025-03-04 19:44:09 -------------------------------------------------------------------
2025-03-04 19:44:09 
2025-03-04 19:44:09 E0304 11:44:09.878 8 wren-ai-service:132] Request 1e7597a1-ec64-4fe1-b52f-2b9c9a2d940a: Error validating question: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

Right. I think you could remove api_key_name: LLM_OPENAI_API_KEY in both the llm and embedder sections, 和 give it a try again. Thank you!

你好,今天试了移除配置 api_key_name: LLM_OPENAI_API_KEY 但是似乎还是一样的报错

litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-05 18:03:00 -------------------------------------------------------------------
2025-03-05 18:03:00 Oh no an error! Need help with Hamilton?
2025-03-05 18:03:00 Join our slack and ask for help! https://join.slack.com/t/hamilton-opensource/shared_invite/zt-2niepkra8-DGKGf_tTYhXuJWBTXtIs4g
2025-03-05 18:03:00 -------------------------------------------------------------------
2025-03-05 18:03:00 
2025-03-05 18:03:00 E0305 10:03:00.181 9 wren-ai-service:60] An error occurred during question recommendation generation: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

type: llm
provider: litellm_llm
models:
- api_base: http://127.0.0.1:11434/v1  # change this to your ollama host, api_base should be <ollama_url>/v1

  model: openai/deepseek-r1:14b  # openai/<ollama_model_name>
  timeout: 600
  kwargs: {}

---
type: embedder
provider: litellm_embedder
models:
- model: openai/bge-m3:latest  # put your ollama embedder model name here, openai/<ollama_model_name>
  api_base: http://127.0.0.1:11434/v1  # change this to your ollama host, api_base should be <ollama_url>/v1

  timeout: 600

@paopa
Copy link
Member

paopa commented Mar 5, 2025

Hi @yuzhi-jiang, can you change 127.0.0.1 to host.docker.internal for the api_base property? I think using 127.0.0.1 cannot be connected from the container.

@yuzhi-jiang
Copy link
Author

host.docker.internal?
我不太明白,是指 http://localhost:11434/ 吗,我测试修改过本地的host: 127.0.0.1 local.docker,能够被ping通,但是无法连接上ollama

Hi @yuzhi-jiang, can you change 127.0.0.1 to host.docker.internal for the api_base property? I think using 127.0.0.1 cannot be connected from the container.

@paopa
Copy link
Member

paopa commented Mar 5, 2025

host.docker.internal? 我不太明白,是指 http://localhost:11434/ 吗,我测试修改过本地的host: 127.0.0.1 local.docker,能够被ping通,但是无法连接上ollama

Hi @yuzhi-jiang, can you change 127.0.0.1 to host.docker.internal for the api_base property? I think using 127.0.0.1 cannot be connected from the container.

Since the AI service is a container and needs to access your Ollama, I’m not sure if the way you used it works. But you can connect to the host on your machine using host.docker.internal. Check out this link for more details: https://docs.docker.com/desktop/features/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host

@yuzhi-jiang
Copy link
Author

host.docker.internal? 我不太明白,是指 http://localhost:11434/ 吗,我测试修改过本地的host: 127.0.0.1 local.docker,能够被ping通,但是无法连接上ollama

Hi @yuzhi-jiang, can you change 127.0.0.1 to host.docker.internal for the api_base property? I think using 127.0.0.1 cannot be connected from the container.

Since the AI service is a container and needs to access your Ollama, I’m not sure if the way you used it works. But you can connect to the host on your machine using host.docker.internal. Check out this link for more details: https://docs.docker.com/desktop/features/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host

我理解你的意思了,是 AI service的网络问题是吧,明天我会试试,感谢你的回答

@yuzhi-jiang
Copy link
Author

yuzhi-jiang commented Mar 6, 2025

host.docker.internal? 我不太明白,是指 http://localhost:11434/ 吗,我测试修改过本地的host: 127.0.0.1 local.docker,能够被ping通,但是无法连接上ollama

Hi @yuzhi-jiang, can you change 127.0.0.1 to host.docker.internal for the api_base property? I think using 127.0.0.1 cannot be connected from the container.

Since the AI service is a container and needs to access your Ollama, I’m not sure if the way you used it works. But you can connect to the host on your machine using host.docker.internal. Check out this link for more details: https://docs.docker.com/desktop/features/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host

最新问题:
网络现在是通了,llm模型现在是可以访问到ollama servre了,但是出现了一个新的问题,或者bug?

ollama 已经可以收到请求:

Image

问题

1.当我使用如下配置的embedder模型

type: embedder
provider: litellm_embedder
models:
- model: openai/nomic-embed-text

错误信息是:

Using Embedding Model: openai/nomic-embed-text
2025-03-06 09:17:51 I0306 01:17:51.078 8 wren-ai-service:15] initializing provider: litellm_llm
2025-03-06 09:17:51 I0306 01:17:51.078 8 wren-ai-service:91] Getting provider: litellm_llm from {'qdrant': <class 'src.providers.document_store.qdrant.QdrantProvider'>, 'azure_openai_embedder': <class 'src.providers.embedder.azure_openai.AzureOpenAIEmbedderProvider'>, 'litellm_embedder': <class 'src.providers.embedder.litellm.LitellmEmbedderProvider'>, 'ollama_embedder': <class 'src.providers.embedder.ollama.OllamaEmbedderProvider'>, 'openai_embedder': <class 'src.providers.embedder.openai.OpenAIEmbedderProvider'>, 'wren_ui': <class 'src.providers.engine.wren.WrenUI'>, 'wren_ibis': <class 'src.providers.engine.wren.WrenIbis'>, 'wren_engine': <class 'src.providers.engine.wren.WrenEngine'>, 'azure_openai_llm': <class 'src.providers.llm.azure_openai.AzureOpenAILLMProvider'>, 'litellm_llm': <class 'src.providers.llm.litellm.LitellmLLMProvider'>, 'ollama_llm': <class 'src.providers.llm.ollama.OllamaLLMProvider'>, 'openai_llm': <class 'src.providers.llm.openai.OpenAILLMProvider'>}
2025-03-06 09:17:51 I0306 01:17:51.078 8 wren-ai-service:15] initializing provider: qdrant
2025-03-06 09:17:51 I0306 01:17:51.078 8 wren-ai-service:91] Getting provider: qdrant from {'qdrant': <class 'src.providers.document_store.qdrant.QdrantProvider'>, 'azure_openai_embedder': <class 'src.providers.embedder.azure_openai.AzureOpenAIEmbedderProvider'>, 'litellm_embedder': <class 'src.providers.embedder.litellm.LitellmEmbedderProvider'>, 'ollama_embedder': <class 'src.providers.embedder.ollama.OllamaEmbedderProvider'>, 'openai_embedder': <class 'src.providers.embedder.openai.OpenAIEmbedderProvider'>, 'wren_ui': <class 'src.providers.engine.wren.WrenUI'>, 'wren_ibis': <class 'src.providers.engine.wren.WrenIbis'>, 'wren_engine': <class 'src.providers.engine.wren.WrenEngine'>, 'azure_openai_llm': <class 'src.providers.llm.azure_openai.AzureOpenAILLMProvider'>, 'litellm_llm': <class 'src.providers.llm.litellm.LitellmLLMProvider'>, 'ollama_llm': <class 'src.providers.llm.ollama.OllamaLLMProvider'>, 'openai_llm': <class 'src.providers.llm.openai.OpenAILLMProvider'>}
2025-03-06 09:17:51 I0306 01:17:51.078 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 09:17:51 /src/providers/document_store/qdrant.py:143: UserWarning: Qdrant client version 1.13.2 is incompatible with server version 1.11.0. Major versions should match and minor version difference must not exceed 1. Set check_version=False to skip version check.
2025-03-06 09:17:51   self.async_client = qdrant_client.AsyncQdrantClient(
2025-03-06 09:17:51 /app/.venv/lib/python3.12/site-packages/haystack_integrations/document_stores/qdrant/document_store.py:264: UserWarning: Qdrant client version 1.13.2 is incompatible with server version 1.11.0. Major versions should match and minor version difference must not exceed 1. Set check_version=False to skip version check.
2025-03-06 09:17:51   self._client = qdrant_client.QdrantClient(
2025-03-06 09:17:51 I0306 01:17:51.561 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 09:17:52 I0306 01:17:52.048 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 09:17:52 I0306 01:17:52.542 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 09:17:53 I0306 01:17:53.044 8 wren-ai-service:15] initializing provider: wren_ui
2025-03-06 09:17:53 I0306 01:17:53.045 8 wren-ai-service:91] Getting provider: wren_ui from {'qdrant': <class 'src.providers.document_store.qdrant.QdrantProvider'>, 'azure_openai_embedder': <class 'src.providers.embedder.azure_openai.AzureOpenAIEmbedderProvider'>, 'litellm_embedder': <class 'src.providers.embedder.litellm.LitellmEmbedderProvider'>, 'ollama_embedder': <class 'src.providers.embedder.ollama.OllamaEmbedderProvider'>, 'openai_embedder': <class 'src.providers.embedder.openai.OpenAIEmbedderProvider'>, 'wren_ui': <class 'src.providers.engine.wren.WrenUI'>, 'wren_ibis': <class 'src.providers.engine.wren.WrenIbis'>, 'wren_engine': <class 'src.providers.engine.wren.WrenEngine'>, 'azure_openai_llm': <class 'src.providers.llm.azure_openai.AzureOpenAILLMProvider'>, 'litellm_llm': <class 'src.providers.llm.litellm.LitellmLLMProvider'>, 'ollama_llm': <class 'src.providers.llm.ollama.OllamaLLMProvider'>, 'openai_llm': <class 'src.providers.llm.openai.OpenAILLMProvider'>}
2025-03-06 09:17:53 I0306 01:17:53.045 8 wren-ai-service:24] Using Engine: wren_ui
2025-03-06 09:17:53 I0306 01:17:53.051 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 09:17:53 ERROR:    Traceback (most recent call last):
2025-03-06 09:17:53   File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 693, in lifespan
2025-03-06 09:17:53     async with self.lifespan_context(app) as maybe_state:
2025-03-06 09:17:53   File "/usr/local/lib/python3.12/contextlib.py", line 204, in __aenter__
2025-03-06 09:17:53     return await anext(self.gen)
2025-03-06 09:17:53            ^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:17:53   File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
2025-03-06 09:17:53     async with original_context(app) as maybe_original_state:
2025-03-06 09:17:53   File "/usr/local/lib/python3.12/contextlib.py", line 204, in __aenter__
2025-03-06 09:17:53     return await anext(self.gen)
2025-03-06 09:17:53            ^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:17:53   File "/src/__main__.py", line 32, in lifespan
2025-03-06 09:17:53     app.state.service_container = create_service_container(pipe_components, settings)
2025-03-06 09:17:53                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:17:53   File "/src/globals.py", line 71, in create_service_container
2025-03-06 09:17:53     "db_schema": indexing.DBSchema(
2025-03-06 09:17:53                  ^^^^^^^^^^^^^^^^^^
2025-03-06 09:17:53   File "/src/pipelines/indexing/db_schema.py", line 346, in __init__
2025-03-06 09:17:53     "embedder": embedder_provider.get_document_embedder(),
2025-03-06 09:17:53                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:17:53 AttributeError: 'NoneType' object has no attribute 'get_document_embedder'
2025-03-06 09:17:53 
2025-03-06 09:17:53 ERROR:    Application startup failed. Exiting.

2.当我是使用

type: embedder
provider: litellm_embedder
models:
- model: openai/bge-m3:latest

错误信息就变成了AuthenticationError:
···
The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-06 09:28:36
2025-03-06 09:28:36 During handling of the above exception, another exception occurred:
2025-03-06 09:28:36
2025-03-06 09:28:36 Traceback (most recent call last):
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/main.py", line 3147, in aembedding
2025-03-06 09:28:36 response = await init_response # type: ignore
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai/openai.py", line 1111, in aembedding
2025-03-06 09:28:36 raise OpenAIError(
2025-03-06 09:28:36 litellm.llms.openai.common_utils.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-06 09:28:36
2025-03-06 09:28:36 During handling of the above exception, another exception occurred:
2025-03-06 09:28:36
2025-03-06 09:28:36 Traceback (most recent call last):
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 122, in new_fn
2025-03-06 09:28:36 await fn(**fn_kwargs) if asyncio.iscoroutinefunction(fn) else fn(**fn_kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 219, in async_wrapper
2025-03-06 09:28:36 self._handle_exception(observation, e)
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 517, in _handle_exception
2025-03-06 09:28:36 raise e
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 217, in async_wrapper
2025-03-06 09:28:36 result = await func(*args, **kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/src/pipelines/indexing/table_description.py", line 95, in embedding
2025-03-06 09:28:36 return await embedder.run(documents=chunk["documents"])
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
2025-03-06 09:28:36 ret = await target(*args, **kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/src/providers/embedder/litellm.py", line 144, in run
2025-03-06 09:28:36 embeddings, meta = await self._embed_batch(
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/src/providers/embedder/litellm.py", line 106, in _embed_batch
2025-03-06 09:28:36 response = await aembedding(
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/utils.py", line 1358, in wrapper_async
2025-03-06 09:28:36 raise e
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/utils.py", line 1217, in wrapper_async
2025-03-06 09:28:36 result = await original_function(*args, **kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/main.py", line 3163, in aembedding
2025-03-06 09:28:36 raise exception_type(
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2190, in exception_type
2025-03-06 09:28:36 raise e
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 356, in exception_type
2025-03-06 09:28:36 raise AuthenticationError(
2025-03-06 09:28:36 litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-06 09:28:36
Calculating embeddings: 0%| | 0/3 [00:00<?, ?it/s]I0306 01:28:36.884 8 wren-ai-service:32] Project ID: None, Cleaning documents in view_questions
2025-03-06 09:28:36
2025-03-06 09:28:36 Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new
2025-03-06 09:28:36 LiteLLM.Info: If you need to debug this error, use `litellm._turn_on_debug()'.
2025-03-06 09:28:36
2025-03-06 09:28:36
Calculating embeddings: 0%| | 0/3 [00:00<?, ?it/s]
2025-03-06 09:28:36
2025-03-06 09:28:36 ********************************************************************************
2025-03-06 09:28:36 > embedding [src.pipelines.indexing.db_schema.embedding()] encountered an error<
2025-03-06 09:28:36 > Node inputs:
2025-03-06 09:28:36 {'chunk': "<Task finished name='Task-10' coro=<AsyncGraphAdap...",
2025-03-06 09:28:36 'embedder': '<src.providers.embedder.litellm.AsyncDocumentEmbed...'}
2025-03-06 09:28:36 ********************************************************************************
2025-03-06 09:28:36 Traceback (most recent call last):
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai/openai.py", line 1058, in aembedding
2025-03-06 09:28:36 openai_aclient: AsyncOpenAI = self._get_openai_client( # type: ignore
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai/openai.py", line 355, in _get_openai_client
2025-03-06 09:28:36 _new_client: Union[OpenAI, AsyncOpenAI] = AsyncOpenAI(
2025-03-06 09:28:36 ^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/openai/_client.py", line 337, in init
2025-03-06 09:28:36 raise OpenAIError(
2025-03-06 09:28:36 openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-06 09:28:36
2025-03-06 09:28:36 During handling of the above exception, another exception occurred:
2025-03-06 09:28:36
2025-03-06 09:28:36 Traceback (most recent call last):
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/main.py", line 3147, in aembedding
2025-03-06 09:28:36 response = await init_response # type: ignore
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai/openai.py", line 1111, in aembedding
2025-03-06 09:28:36 raise OpenAIError(
2025-03-06 09:28:36 litellm.llms.openai.common_utils.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-06 09:28:36
2025-03-06 09:28:36 During handling of the above exception, another exception occurred:
2025-03-06 09:28:36
2025-03-06 09:28:36 Traceback (most recent call last):
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 122, in new_fn
2025-03-06 09:28:36 await fn(**fn_kwargs) if asyncio.iscoroutinefunction(fn) else fn(**fn_kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 219, in async_wrapper
2025-03-06 09:28:36 self._handle_exception(observation, e)
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 517, in _handle_exception
2025-03-06 09:28:36 raise e
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 217, in async_wrapper
2025-03-06 09:28:36 result = await func(*args, **kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/src/pipelines/indexing/db_schema.py", line 312, in embedding
2025-03-06 09:28:36 return await embedder.run(documents=chunk["documents"])
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
2025-03-06 09:28:36 ret = await target(*args, **kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/src/providers/embedder/litellm.py", line 144, in run
2025-03-06 09:28:36 embeddings, meta = await self._embed_batch(
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/src/providers/embedder/litellm.py", line 106, in _embed_batch
2025-03-06 09:28:36 response = await aembedding(
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/utils.py", line 1358, in wrapper_async
2025-03-06 09:28:36 raise e
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/utils.py", line 1217, in wrapper_async
2025-03-06 09:28:36 result = await original_function(*args, **kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/main.py", line 3163, in aembedding
2025-03-06 09:28:36 raise exception_type(
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2190, in exception_type
2025-03-06 09:28:36 raise e
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 356, in exception_type
2025-03-06 09:28:36 raise AuthenticationError(
2025-03-06 09:28:36 litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-06 09:28:36 -------------------------------------------------------------------
2025-03-06 09:28:36 Oh no an error! Need help with Hamilton?
2025-03-06 09:28:36 Join our slack and ask for help! https://join.slack.com/t/hamilton-opensource/shared_invite/zt-2niepkra8-DGKGf_tTYhXuJWBTXtIs4g
2025-03-06 09:28:36 -------------------------------------------------------------------
2025-03-06 09:28:36
2025-03-06 09:28:36 E0306 01:28:36.900 8 wren-ai-service:98] Failed to prepare semantics: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-06 09:28:36 Traceback (most recent call last):
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai/openai.py", line 1058, in aembedding
2025-03-06 09:28:36 openai_aclient: AsyncOpenAI = self._get_openai_client( # type: ignore
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai/openai.py", line 355, in _get_openai_client
2025-03-06 09:28:36 _new_client: Union[OpenAI, AsyncOpenAI] = AsyncOpenAI(
2025-03-06 09:28:36 ^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/openai/_client.py", line 337, in init
2025-03-06 09:28:36 raise OpenAIError(
2025-03-06 09:28:36 openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-06 09:28:36
2025-03-06 09:28:36 During handling of the above exception, another exception occurred:
2025-03-06 09:28:36
2025-03-06 09:28:36 Traceback (most recent call last):
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/main.py", line 3147, in aembedding
2025-03-06 09:28:36 response = await init_response # type: ignore
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai/openai.py", line 1111, in aembedding
2025-03-06 09:28:36 raise OpenAIError(
2025-03-06 09:28:36 litellm.llms.openai.common_utils.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-06 09:28:36
2025-03-06 09:28:36 During handling of the above exception, another exception occurred:
2025-03-06 09:28:36
2025-03-06 09:28:36 Traceback (most recent call last):
2025-03-06 09:28:36 File "/src/web/v1/services/semantics_preparation.py", line 90, in prepare_semantics
2025-03-06 09:28:36 await asyncio.gather(*tasks)
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 219, in async_wrapper
2025-03-06 09:28:36 self._handle_exception(observation, e)
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 517, in _handle_exception
2025-03-06 09:28:36 raise e
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 217, in async_wrapper
2025-03-06 09:28:36 result = await func(*args, **kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/src/pipelines/indexing/table_description.py", line 151, in run
2025-03-06 09:28:36 return await self._pipe.execute(
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 375, in execute
2025-03-06 09:28:36 raise e
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 366, in execute
2025-03-06 09:28:36 outputs = await self.raw_execute(_final_vars, overrides, display_graph, inputs=inputs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 326, in raw_execute
2025-03-06 09:28:36 raise e
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 321, in raw_execute
2025-03-06 09:28:36 results = await await_dict_of_tasks(task_dict)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 23, in await_dict_of_tasks
2025-03-06 09:28:36 coroutines_gathered = await asyncio.gather(*coroutines)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 36, in process_value
2025-03-06 09:28:36 return await val
2025-03-06 09:28:36 ^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 91, in new_fn
2025-03-06 09:28:36 fn_kwargs = await await_dict_of_tasks(task_dict)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 23, in await_dict_of_tasks
2025-03-06 09:28:36 coroutines_gathered = await asyncio.gather(*coroutines)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 36, in process_value
2025-03-06 09:28:36 return await val
2025-03-06 09:28:36 ^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 91, in new_fn
2025-03-06 09:28:36 fn_kwargs = await await_dict_of_tasks(task_dict)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 23, in await_dict_of_tasks
2025-03-06 09:28:36 coroutines_gathered = await asyncio.gather(*coroutines)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 36, in process_value
2025-03-06 09:28:36 return await val
2025-03-06 09:28:36 ^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 122, in new_fn
2025-03-06 09:28:36 await fn(**fn_kwargs) if asyncio.iscoroutinefunction(fn) else fn(**fn_kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 219, in async_wrapper
2025-03-06 09:28:36 self._handle_exception(observation, e)
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 517, in _handle_exception
2025-03-06 09:28:36 raise e
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 217, in async_wrapper
2025-03-06 09:28:36 result = await func(*args, **kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/src/pipelines/indexing/table_description.py", line 95, in embedding
2025-03-06 09:28:36 return await embedder.run(documents=chunk["documents"])
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
2025-03-06 09:28:36 ret = await target(*args, **kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/src/providers/embedder/litellm.py", line 144, in run
2025-03-06 09:28:36 embeddings, meta = await self._embed_batch(
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/src/providers/embedder/litellm.py", line 106, in _embed_batch
2025-03-06 09:28:36 response = await aembedding(
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/utils.py", line 1358, in wrapper_async
2025-03-06 09:28:36 raise e
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/utils.py", line 1217, in wrapper_async
2025-03-06 09:28:36 result = await original_function(*args, **kwargs)
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/main.py", line 3163, in aembedding
2025-03-06 09:28:36 raise exception_type(
2025-03-06 09:28:36 ^^^^^^^^^^^^^^^
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2190, in exception_type
2025-03-06 09:28:36 raise e
2025-03-06 09:28:36 File "/app/.venv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 356, in exception_type
2025-03-06 09:28:36 raise AuthenticationError(
2025-03-06 09:28:36 litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
2025-03-06 09:28:36 -------------------------------------------------------------------
2025-03-06 09:28:36 Oh no an error! Need help with Hamilton?
2025-03-06 09:28:36 Join our slack and ask for help! https://join.slack.com/t/hamilton-opensource/shared_invite/zt-2niepkra8-DGKGf_tTYhXuJWBTXtIs4g
2025-03-06 09:28:36 -------------------------------------------------------------------
2025-03-06 09:28:36
2025-03-06 09:28:36 W0306 01:28:36.918 8 wren-ai-service:261] Calling QdrantDocumentStore.write_documents() with empty list
2025-03-06 09:28:36 W0306 01:28:36.923 8 wren-ai-service:261] Calling QdrantDocumentStore.write_documents() with empty list
2025-03-06 09:28:37 INFO: 172.19.0.5:56076 - "GET /v1/semantics-preparations/b24b4523491303777a6559a348394ded844925f5/status HTTP/1.1" 200 OK
2025-03-06 09:28:37 INFO: 172.19.0.5:56086 - "POST /v1/question-recommendations HTTP/1.1" 200 OK
2025-03-06 09:28:37 I0306 01:28:37.886 8 wren-ai-service:154] Request c413d709-8537-4f26-b62f-3a36b978ff8a: Generate Question Recommendation pipeline is running...
2025-03-06 09:28:37 I0306 01:28:37.907 8 wren-ai-service:263] Question Recommendation pipeline is running...
2025-03-06 09:28:37 Forcing deployment: {'data': {'deploy': {'status': 'FAILED', 'error': 'Wren AI Error: deployment hash:b24b4523491303777a6559a348394ded844925f5, [object Object]'}}}
···

@paopa
Copy link
Member

paopa commented Mar 6, 2025

For the first question, I think the error might be because you forgot to update the pipeline setting in the config.yaml to match the current embedding model.

e.g.

- name: db_schema_indexing
  embedder: litellm_embedder.openai/bge-m3:latest
  document_store: qdrant
- name: historical_question_indexing
  embedder: litellm_embedder.openai/bge-m3:latest
  ...

@paopa
Copy link
Member

paopa commented Mar 6, 2025

For the second question, could you share the current config.yaml you’re using? It looks like you might be missing an API key for the OpenAI-compatible endpoint.

Or, if you prefer, you can refer to my Ollama config example.

models:
- alias: demo
  api_base: http://localhost:11434
  kwargs:
    n: 1
    temperature: 0
  model: ollama/phi4
provider: litellm_llm
timeout: 120
type: llm
---
models:
- alias: demo
  api_base: http://localhost:11434
  model: ollama/nomic-embed-text:latest
  timeout: 120
provider: litellm_embedder
type: embedder

I’ve made a couple of changes. I’ve updated the model with the prefix ollama and removed the /v1 from the api_base.

@yuzhi-jiang
Copy link
Author

For the first question, I think the error might be because you forgot to update the pipeline setting in the config.yaml to match the current embedding model.

e.g.

- name: db_schema_indexing
  embedder: litellm_embedder.openai/bge-m3:latest
  document_store: qdrant
- name: historical_question_indexing
  embedder: litellm_embedder.openai/bge-m3:latest
  ...

是的,第一个和第二个应该是同一个问题的
目前我完整配置如下(确定可以容器连接上ollama了):

config.yml

type: llm
provider: litellm_llm
models:
- api_base: http://192.168.177.95:11434/v1  # change this to your ollama host, api_base should be <ollama_url>/v1
  api_key_name: LLM_OLLAMA_API_KEY
  model: openai/deepseek-r1:14b
  timeout: 600
  kwargs:
    n: 1
    temperature: 0

---
type: embedder
provider: litellm_embedder
models:
- model: ollama/nomic-embed-text:latest
  api_base: http://192.168.177.95:11434
  api_key_name: EMBEDDER_OLLAMA_API_KEY
  timeout: 600

---
type: engine
provider: wren_ui
endpoint: http://wren-ui:3000

---
type: document_store
provider: qdrant
location: http://qdrant:6333
embedding_model_dim: 768
timeout: 120
recreate_index: true

---
type: pipeline
pipes:
  - name: db_schema_indexing
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: historical_question_indexing
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: table_description_indexing
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: db_schema_retrieval
    llm: litellm_llm.openai/deepseek-r1:14b
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: historical_question_retrieval
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: sql_generation
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_correction
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: followup_sql_generation
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_summary
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_answer
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_breakdown
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_expansion
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_explanation
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: semantics_description
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: relationship_recommendation
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: question_recommendation
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: question_recommendation_db_schema_retrieval
    llm: litellm_llm.openai/deepseek-r1:14b
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: question_recommendation_sql_generation
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: chart_generation
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: chart_adjustment
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: intent_classification
    llm: litellm_llm.openai/deepseek-r1:14b
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: data_assistance
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_pairs_indexing
    document_store: qdrant
    embedder: litellm_embedder.openai/nomic-embed-text:latest
  - name: sql_pairs_deletion
    document_store: qdrant
    embedder: litellm_embedder.openai/nomic-embed-text:latest
  - name: sql_pairs_retrieval
    document_store: qdrant
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: preprocess_sql_data
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_executor
    engine: wren_ui
  - name: sql_question_generation
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_generation_reasoning
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_regeneration
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui

---
settings:
  column_indexing_batch_size: 50
  table_retrieval_size: 10
  table_column_retrieval_size: 100
  allow_using_db_schemas_without_pruning: false
  query_cache_maxsize: 1000
  query_cache_ttl: 3600
  langfuse_host: https://cloud.langfuse.com
  langfuse_enable: true
  logging_level: DEBUG
  development: false

.env

COMPOSE_PROJECT_NAME=wrenai
PLATFORM=linux/amd64

PROJECT_DIR=.

# service port
WREN_ENGINE_PORT=8080
WREN_ENGINE_SQL_PORT=7432
WREN_AI_SERVICE_PORT=5555
WREN_UI_PORT=3000
IBIS_SERVER_PORT=8000
WREN_UI_ENDPOINT=http://wren-ui:${WREN_UI_PORT}

# ai service settings
QDRANT_HOST=qdrant
SHOULD_FORCE_DEPLOY=1

# vendor keys
LLM_OPENAI_API_KEY=sks
EMBEDDER_OPENAI_API_KEY=sks
LLM_AZURE_OPENAI_API_KEY=sks
EMBEDDER_AZURE_OPENAI_API_KEY=sks
QDRANT_API_KEY=sks
LLM_OLLAMA_API_KEY=random
EMBEDDER_OLLAMA_API_KEY=random

# version
# CHANGE THIS TO THE LATEST VERSION
WREN_PRODUCT_VERSION=0.15.3
WREN_ENGINE_VERSION=0.13.1
WREN_AI_SERVICE_VERSION=0.15.7
IBIS_SERVER_VERSION=0.13.1
WREN_UI_VERSION=0.20.1
WREN_BOOTSTRAP_VERSION=0.1.5

# user id (uuid v4)
USER_UUID=

# for other services
POSTHOG_API_KEY=phc_nhF32aj4xHXOZb0oqr2cn4Oy9uiWzz6CCP4KZmRq9aE
POSTHOG_HOST=https://app.posthog.com
TELEMETRY_ENABLED=true
# this is for telemetry to know the model, i think ai-service might be able to provide a endpoint to get the information
GENERATION_MODEL=gpt-4o-mini
LANGFUSE_SECRET_KEY=
LANGFUSE_PUBLIC_KEY=

# the port exposes to the host
# OPTIONAL: change the port if you have a conflict
HOST_PORT=3000
AI_SERVICE_FORWARD_PORT=5555

# Wren UI
EXPERIMENTAL_ENGINE_RUST_VERSION=false

ai service log:


Getting provider: litellm_embedder from {'qdrant': <class 'src.providers.document_store.qdrant.QdrantProvider'>, 'azure_openai_embedder': <class 'src.providers.embedder.azure_openai.AzureOpenAIEmbedderProvider'>, 'litellm_embedder': <class 'src.providers.embedder.litellm.LitellmEmbedderProvider'>, 'ollama_embedder': <class 'src.providers.embedder.ollama.OllamaEmbedderProvider'>, 'openai_embedder': <class 'src.providers.embedder.openai.OpenAIEmbedderProvider'>, 'wren_ui': <class 'src.providers.engine.wren.WrenUI'>, 'wren_ibis': <class 'src.providers.engine.wren.WrenIbis'>, 'wren_engine': <class 'src.providers.engine.wren.WrenEngine'>, 'azure_openai_llm': <class 'src.providers.llm.azure_openai.AzureOpenAILLMProvider'>, 'litellm_llm': <class 'src.providers.llm.litellm.LitellmLLMProvider'>, 'ollama_llm': <class 'src.providers.llm.ollama.OllamaLLMProvider'>, 'openai_llm': <class 'src.providers.llm.openai.OpenAILLMProvider'>}
2025-03-06 12:27:26 I0306 04:27:26.661 8 wren-ai-service:176] Initializing LitellmEmbedder provider with API base: http://192.168.177.95:11434/v1
2025-03-06 12:27:26 I0306 04:27:26.661 8 wren-ai-service:179] Using Embedding Model: ollama/nomic-embed-text:latest
2025-03-06 12:27:26 I0306 04:27:26.662 8 wren-ai-service:15] initializing provider: litellm_llm
2025-03-06 12:27:26 I0306 04:27:26.662 8 wren-ai-service:91] Getting provider: litellm_llm from {'qdrant': <class 'src.providers.document_store.qdrant.QdrantProvider'>, 'azure_openai_embedder': <class 'src.providers.embedder.azure_openai.AzureOpenAIEmbedderProvider'>, 'litellm_embedder': <class 'src.providers.embedder.litellm.LitellmEmbedderProvider'>, 'ollama_embedder': <class 'src.providers.embedder.ollama.OllamaEmbedderProvider'>, 'openai_embedder': <class 'src.providers.embedder.openai.OpenAIEmbedderProvider'>, 'wren_ui': <class 'src.providers.engine.wren.WrenUI'>, 'wren_ibis': <class 'src.providers.engine.wren.WrenIbis'>, 'wren_engine': <class 'src.providers.engine.wren.WrenEngine'>, 'azure_openai_llm': <class 'src.providers.llm.azure_openai.AzureOpenAILLMProvider'>, 'litellm_llm': <class 'src.providers.llm.litellm.LitellmLLMProvider'>, 'ollama_llm': <class 'src.providers.llm.ollama.OllamaLLMProvider'>, 'openai_llm': <class 'src.providers.llm.openai.OpenAILLMProvider'>}
2025-03-06 12:27:26 I0306 04:27:26.662 8 wren-ai-service:15] initializing provider: qdrant
2025-03-06 12:27:26 I0306 04:27:26.662 8 wren-ai-service:91] Getting provider: qdrant from {'qdrant': <class 'src.providers.document_store.qdrant.QdrantProvider'>, 'azure_openai_embedder': <class 'src.providers.embedder.azure_openai.AzureOpenAIEmbedderProvider'>, 'litellm_embedder': <class 'src.providers.embedder.litellm.LitellmEmbedderProvider'>, 'ollama_embedder': <class 'src.providers.embedder.ollama.OllamaEmbedderProvider'>, 'openai_embedder': <class 'src.providers.embedder.openai.OpenAIEmbedderProvider'>, 'wren_ui': <class 'src.providers.engine.wren.WrenUI'>, 'wren_ibis': <class 'src.providers.engine.wren.WrenIbis'>, 'wren_engine': <class 'src.providers.engine.wren.WrenEngine'>, 'azure_openai_llm': <class 'src.providers.llm.azure_openai.AzureOpenAILLMProvider'>, 'litellm_llm': <class 'src.providers.llm.litellm.LitellmLLMProvider'>, 'ollama_llm': <class 'src.providers.llm.ollama.OllamaLLMProvider'>, 'openai_llm': <class 'src.providers.llm.openai.OpenAILLMProvider'>}
2025-03-06 12:27:26 I0306 04:27:26.663 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 12:27:26 /src/providers/document_store/qdrant.py:143: UserWarning: Qdrant client version 1.13.2 is incompatible with server version 1.11.0. Major versions should match and minor version difference must not exceed 1. Set check_version=False to skip version check.
2025-03-06 12:27:26   self.async_client = qdrant_client.AsyncQdrantClient(
2025-03-06 12:27:26 /app/.venv/lib/python3.12/site-packages/haystack_integrations/document_stores/qdrant/document_store.py:264: UserWarning: Qdrant client version 1.13.2 is incompatible with server version 1.11.0. Major versions should match and minor version difference must not exceed 1. Set check_version=False to skip version check.
2025-03-06 12:27:26   self._client = qdrant_client.QdrantClient(
2025-03-06 12:27:27 I0306 04:27:27.297 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 12:27:27 I0306 04:27:27.896 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 12:27:28 I0306 04:27:28.443 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 12:27:28 I0306 04:27:28.978 8 wren-ai-service:15] initializing provider: wren_ui
2025-03-06 12:27:28 I0306 04:27:28.978 8 wren-ai-service:91] Getting provider: wren_ui from {'qdrant': <class 'src.providers.document_store.qdrant.QdrantProvider'>, 'azure_openai_embedder': <class 'src.providers.embedder.azure_openai.AzureOpenAIEmbedderProvider'>, 'litellm_embedder': <class 'src.providers.embedder.litellm.LitellmEmbedderProvider'>, 'ollama_embedder': <class 'src.providers.embedder.ollama.OllamaEmbedderProvider'>, 'openai_embedder': <class 'src.providers.embedder.openai.OpenAIEmbedderProvider'>, 'wren_ui': <class 'src.providers.engine.wren.WrenUI'>, 'wren_ibis': <class 'src.providers.engine.wren.WrenIbis'>, 'wren_engine': <class 'src.providers.engine.wren.WrenEngine'>, 'azure_openai_llm': <class 'src.providers.llm.azure_openai.AzureOpenAILLMProvider'>, 'litellm_llm': <class 'src.providers.llm.litellm.LitellmLLMProvider'>, 'ollama_llm': <class 'src.providers.llm.ollama.OllamaLLMProvider'>, 'openai_llm': <class 'src.providers.llm.openai.OpenAILLMProvider'>}
2025-03-06 12:27:28 I0306 04:27:28.978 8 wren-ai-service:24] Using Engine: wren_ui
2025-03-06 12:26:18 Waiting for qdrant to start...
2025-03-06 12:26:20 qdrant has started.
2025-03-06 12:26:20 Waiting for wren-ai-service to start...
2025-03-06 12:27:20 Timeout: wren-ai-service did not start within 60 seconds
2025-03-06 12:27:21 Waiting for qdrant to start...
2025-03-06 12:27:21 qdrant has started.
2025-03-06 12:27:21 Waiting for wren-ai-service to start...
2025-03-06 12:28:21 Timeout: wren-ai-service did not start within 60 seconds
2025-03-06 12:28:22 Waiting for qdrant to start...
2025-03-06 12:28:22 qdrant has started.
2025-03-06 12:28:22 Waiting for wren-ai-service to start...
2025-03-06 12:27:28 I0306 04:27:28.985 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 12:27:29 ERROR:    Traceback (most recent call last):
2025-03-06 12:27:29   File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 693, in lifespan
2025-03-06 12:27:29     async with self.lifespan_context(app) as maybe_state:
2025-03-06 12:27:29   File "/usr/local/lib/python3.12/contextlib.py", line 204, in __aenter__
2025-03-06 12:27:29     return await anext(self.gen)
2025-03-06 12:27:29            ^^^^^^^^^^^^^^^^^^^^^
2025-03-06 12:27:29   File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
2025-03-06 12:27:29     async with original_context(app) as maybe_original_state:
2025-03-06 12:27:29   File "/usr/local/lib/python3.12/contextlib.py", line 204, in __aenter__
2025-03-06 12:27:29     return await anext(self.gen)
2025-03-06 12:27:29            ^^^^^^^^^^^^^^^^^^^^^
2025-03-06 12:27:29   File "/src/__main__.py", line 32, in lifespan
2025-03-06 12:27:29     app.state.service_container = create_service_container(pipe_components, settings)
2025-03-06 12:27:29                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 12:27:29   File "/src/globals.py", line 71, in create_service_container
2025-03-06 12:27:29     "db_schema": indexing.DBSchema(
2025-03-06 12:27:29                  ^^^^^^^^^^^^^^^^^^
2025-03-06 12:27:29   File "/src/pipelines/indexing/db_schema.py", line 346, in __init__
2025-03-06 12:27:29     "embedder": embedder_provider.get_document_embedder(),
2025-03-06 12:27:29                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 12:27:29 AttributeError: 'NoneType' object has no attribute 'get_document_embedder'
2025-03-06 12:27:29 
2025-03-06 12:27:29 ERROR:    Application startup failed. Exiting

@jonathanyb
Copy link

For the first question, I think the error might be because you forgot to update the pipeline setting in the config.yaml to match the current embedding model.
e.g.

- name: db_schema_indexing
  embedder: litellm_embedder.openai/bge-m3:latest
  document_store: qdrant
- name: historical_question_indexing
  embedder: litellm_embedder.openai/bge-m3:latest
  ...

是的,第一个和第二个应该是同一个问题的 目前我完整配置如下(确定可以容器连接上ollama了):

config.yml

type: llm
provider: litellm_llm
models:
- api_base: http://192.168.177.95:11434/v1  # change this to your ollama host, api_base should be <ollama_url>/v1
  api_key_name: LLM_OLLAMA_API_KEY
  model: openai/deepseek-r1:14b
  timeout: 600
  kwargs:
    n: 1
    temperature: 0

---
type: embedder
provider: litellm_embedder
models:
- model: ollama/nomic-embed-text:latest
  api_base: http://192.168.177.95:11434
  api_key_name: EMBEDDER_OLLAMA_API_KEY
  timeout: 600

---
type: engine
provider: wren_ui
endpoint: http://wren-ui:3000

---
type: document_store
provider: qdrant
location: http://qdrant:6333
embedding_model_dim: 768
timeout: 120
recreate_index: true

---
type: pipeline
pipes:
  - name: db_schema_indexing
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: historical_question_indexing
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: table_description_indexing
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: db_schema_retrieval
    llm: litellm_llm.openai/deepseek-r1:14b
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: historical_question_retrieval
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: sql_generation
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_correction
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: followup_sql_generation
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_summary
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_answer
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_breakdown
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_expansion
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: sql_explanation
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: semantics_description
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: relationship_recommendation
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: question_recommendation
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: question_recommendation_db_schema_retrieval
    llm: litellm_llm.openai/deepseek-r1:14b
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: question_recommendation_sql_generation
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui
  - name: chart_generation
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: chart_adjustment
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: intent_classification
    llm: litellm_llm.openai/deepseek-r1:14b
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: data_assistance
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_pairs_indexing
    document_store: qdrant
    embedder: litellm_embedder.openai/nomic-embed-text:latest
  - name: sql_pairs_deletion
    document_store: qdrant
    embedder: litellm_embedder.openai/nomic-embed-text:latest
  - name: sql_pairs_retrieval
    document_store: qdrant
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: preprocess_sql_data
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_executor
    engine: wren_ui
  - name: sql_question_generation
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_generation_reasoning
    llm: litellm_llm.openai/deepseek-r1:14b
  - name: sql_regeneration
    llm: litellm_llm.openai/deepseek-r1:14b
    engine: wren_ui

---
settings:
  column_indexing_batch_size: 50
  table_retrieval_size: 10
  table_column_retrieval_size: 100
  allow_using_db_schemas_without_pruning: false
  query_cache_maxsize: 1000
  query_cache_ttl: 3600
  langfuse_host: https://cloud.langfuse.com
  langfuse_enable: true
  logging_level: DEBUG
  development: false

.env

COMPOSE_PROJECT_NAME=wrenai
PLATFORM=linux/amd64

PROJECT_DIR=.

# service port
WREN_ENGINE_PORT=8080
WREN_ENGINE_SQL_PORT=7432
WREN_AI_SERVICE_PORT=5555
WREN_UI_PORT=3000
IBIS_SERVER_PORT=8000
WREN_UI_ENDPOINT=http://wren-ui:${WREN_UI_PORT}

# ai service settings
QDRANT_HOST=qdrant
SHOULD_FORCE_DEPLOY=1

# vendor keys
LLM_OPENAI_API_KEY=sks
EMBEDDER_OPENAI_API_KEY=sks
LLM_AZURE_OPENAI_API_KEY=sks
EMBEDDER_AZURE_OPENAI_API_KEY=sks
QDRANT_API_KEY=sks
LLM_OLLAMA_API_KEY=random
EMBEDDER_OLLAMA_API_KEY=random

# version
# CHANGE THIS TO THE LATEST VERSION
WREN_PRODUCT_VERSION=0.15.3
WREN_ENGINE_VERSION=0.13.1
WREN_AI_SERVICE_VERSION=0.15.7
IBIS_SERVER_VERSION=0.13.1
WREN_UI_VERSION=0.20.1
WREN_BOOTSTRAP_VERSION=0.1.5

# user id (uuid v4)
USER_UUID=

# for other services
POSTHOG_API_KEY=phc_nhF32aj4xHXOZb0oqr2cn4Oy9uiWzz6CCP4KZmRq9aE
POSTHOG_HOST=https://app.posthog.com
TELEMETRY_ENABLED=true
# this is for telemetry to know the model, i think ai-service might be able to provide a endpoint to get the information
GENERATION_MODEL=gpt-4o-mini
LANGFUSE_SECRET_KEY=
LANGFUSE_PUBLIC_KEY=

# the port exposes to the host
# OPTIONAL: change the port if you have a conflict
HOST_PORT=3000
AI_SERVICE_FORWARD_PORT=5555

# Wren UI
EXPERIMENTAL_ENGINE_RUST_VERSION=false

ai service log:


Getting provider: litellm_embedder from {'qdrant': <class 'src.providers.document_store.qdrant.QdrantProvider'>, 'azure_openai_embedder': <class 'src.providers.embedder.azure_openai.AzureOpenAIEmbedderProvider'>, 'litellm_embedder': <class 'src.providers.embedder.litellm.LitellmEmbedderProvider'>, 'ollama_embedder': <class 'src.providers.embedder.ollama.OllamaEmbedderProvider'>, 'openai_embedder': <class 'src.providers.embedder.openai.OpenAIEmbedderProvider'>, 'wren_ui': <class 'src.providers.engine.wren.WrenUI'>, 'wren_ibis': <class 'src.providers.engine.wren.WrenIbis'>, 'wren_engine': <class 'src.providers.engine.wren.WrenEngine'>, 'azure_openai_llm': <class 'src.providers.llm.azure_openai.AzureOpenAILLMProvider'>, 'litellm_llm': <class 'src.providers.llm.litellm.LitellmLLMProvider'>, 'ollama_llm': <class 'src.providers.llm.ollama.OllamaLLMProvider'>, 'openai_llm': <class 'src.providers.llm.openai.OpenAILLMProvider'>}
2025-03-06 12:27:26 I0306 04:27:26.661 8 wren-ai-service:176] Initializing LitellmEmbedder provider with API base: http://192.168.177.95:11434/v1
2025-03-06 12:27:26 I0306 04:27:26.661 8 wren-ai-service:179] Using Embedding Model: ollama/nomic-embed-text:latest
2025-03-06 12:27:26 I0306 04:27:26.662 8 wren-ai-service:15] initializing provider: litellm_llm
2025-03-06 12:27:26 I0306 04:27:26.662 8 wren-ai-service:91] Getting provider: litellm_llm from {'qdrant': <class 'src.providers.document_store.qdrant.QdrantProvider'>, 'azure_openai_embedder': <class 'src.providers.embedder.azure_openai.AzureOpenAIEmbedderProvider'>, 'litellm_embedder': <class 'src.providers.embedder.litellm.LitellmEmbedderProvider'>, 'ollama_embedder': <class 'src.providers.embedder.ollama.OllamaEmbedderProvider'>, 'openai_embedder': <class 'src.providers.embedder.openai.OpenAIEmbedderProvider'>, 'wren_ui': <class 'src.providers.engine.wren.WrenUI'>, 'wren_ibis': <class 'src.providers.engine.wren.WrenIbis'>, 'wren_engine': <class 'src.providers.engine.wren.WrenEngine'>, 'azure_openai_llm': <class 'src.providers.llm.azure_openai.AzureOpenAILLMProvider'>, 'litellm_llm': <class 'src.providers.llm.litellm.LitellmLLMProvider'>, 'ollama_llm': <class 'src.providers.llm.ollama.OllamaLLMProvider'>, 'openai_llm': <class 'src.providers.llm.openai.OpenAILLMProvider'>}
2025-03-06 12:27:26 I0306 04:27:26.662 8 wren-ai-service:15] initializing provider: qdrant
2025-03-06 12:27:26 I0306 04:27:26.662 8 wren-ai-service:91] Getting provider: qdrant from {'qdrant': <class 'src.providers.document_store.qdrant.QdrantProvider'>, 'azure_openai_embedder': <class 'src.providers.embedder.azure_openai.AzureOpenAIEmbedderProvider'>, 'litellm_embedder': <class 'src.providers.embedder.litellm.LitellmEmbedderProvider'>, 'ollama_embedder': <class 'src.providers.embedder.ollama.OllamaEmbedderProvider'>, 'openai_embedder': <class 'src.providers.embedder.openai.OpenAIEmbedderProvider'>, 'wren_ui': <class 'src.providers.engine.wren.WrenUI'>, 'wren_ibis': <class 'src.providers.engine.wren.WrenIbis'>, 'wren_engine': <class 'src.providers.engine.wren.WrenEngine'>, 'azure_openai_llm': <class 'src.providers.llm.azure_openai.AzureOpenAILLMProvider'>, 'litellm_llm': <class 'src.providers.llm.litellm.LitellmLLMProvider'>, 'ollama_llm': <class 'src.providers.llm.ollama.OllamaLLMProvider'>, 'openai_llm': <class 'src.providers.llm.openai.OpenAILLMProvider'>}
2025-03-06 12:27:26 I0306 04:27:26.663 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 12:27:26 /src/providers/document_store/qdrant.py:143: UserWarning: Qdrant client version 1.13.2 is incompatible with server version 1.11.0. Major versions should match and minor version difference must not exceed 1. Set check_version=False to skip version check.
2025-03-06 12:27:26   self.async_client = qdrant_client.AsyncQdrantClient(
2025-03-06 12:27:26 /app/.venv/lib/python3.12/site-packages/haystack_integrations/document_stores/qdrant/document_store.py:264: UserWarning: Qdrant client version 1.13.2 is incompatible with server version 1.11.0. Major versions should match and minor version difference must not exceed 1. Set check_version=False to skip version check.
2025-03-06 12:27:26   self._client = qdrant_client.QdrantClient(
2025-03-06 12:27:27 I0306 04:27:27.297 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 12:27:27 I0306 04:27:27.896 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 12:27:28 I0306 04:27:28.443 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 12:27:28 I0306 04:27:28.978 8 wren-ai-service:15] initializing provider: wren_ui
2025-03-06 12:27:28 I0306 04:27:28.978 8 wren-ai-service:91] Getting provider: wren_ui from {'qdrant': <class 'src.providers.document_store.qdrant.QdrantProvider'>, 'azure_openai_embedder': <class 'src.providers.embedder.azure_openai.AzureOpenAIEmbedderProvider'>, 'litellm_embedder': <class 'src.providers.embedder.litellm.LitellmEmbedderProvider'>, 'ollama_embedder': <class 'src.providers.embedder.ollama.OllamaEmbedderProvider'>, 'openai_embedder': <class 'src.providers.embedder.openai.OpenAIEmbedderProvider'>, 'wren_ui': <class 'src.providers.engine.wren.WrenUI'>, 'wren_ibis': <class 'src.providers.engine.wren.WrenIbis'>, 'wren_engine': <class 'src.providers.engine.wren.WrenEngine'>, 'azure_openai_llm': <class 'src.providers.llm.azure_openai.AzureOpenAILLMProvider'>, 'litellm_llm': <class 'src.providers.llm.litellm.LitellmLLMProvider'>, 'ollama_llm': <class 'src.providers.llm.ollama.OllamaLLMProvider'>, 'openai_llm': <class 'src.providers.llm.openai.OpenAILLMProvider'>}
2025-03-06 12:27:28 I0306 04:27:28.978 8 wren-ai-service:24] Using Engine: wren_ui
2025-03-06 12:26:18 Waiting for qdrant to start...
2025-03-06 12:26:20 qdrant has started.
2025-03-06 12:26:20 Waiting for wren-ai-service to start...
2025-03-06 12:27:20 Timeout: wren-ai-service did not start within 60 seconds
2025-03-06 12:27:21 Waiting for qdrant to start...
2025-03-06 12:27:21 qdrant has started.
2025-03-06 12:27:21 Waiting for wren-ai-service to start...
2025-03-06 12:28:21 Timeout: wren-ai-service did not start within 60 seconds
2025-03-06 12:28:22 Waiting for qdrant to start...
2025-03-06 12:28:22 qdrant has started.
2025-03-06 12:28:22 Waiting for wren-ai-service to start...
2025-03-06 12:27:28 I0306 04:27:28.985 8 wren-ai-service:368] Using Qdrant Document Store with Embedding Model Dimension: 768
2025-03-06 12:27:29 ERROR:    Traceback (most recent call last):
2025-03-06 12:27:29   File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 693, in lifespan
2025-03-06 12:27:29     async with self.lifespan_context(app) as maybe_state:
2025-03-06 12:27:29   File "/usr/local/lib/python3.12/contextlib.py", line 204, in __aenter__
2025-03-06 12:27:29     return await anext(self.gen)
2025-03-06 12:27:29            ^^^^^^^^^^^^^^^^^^^^^
2025-03-06 12:27:29   File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
2025-03-06 12:27:29     async with original_context(app) as maybe_original_state:
2025-03-06 12:27:29   File "/usr/local/lib/python3.12/contextlib.py", line 204, in __aenter__
2025-03-06 12:27:29     return await anext(self.gen)
2025-03-06 12:27:29            ^^^^^^^^^^^^^^^^^^^^^
2025-03-06 12:27:29   File "/src/__main__.py", line 32, in lifespan
2025-03-06 12:27:29     app.state.service_container = create_service_container(pipe_components, settings)
2025-03-06 12:27:29                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 12:27:29   File "/src/globals.py", line 71, in create_service_container
2025-03-06 12:27:29     "db_schema": indexing.DBSchema(
2025-03-06 12:27:29                  ^^^^^^^^^^^^^^^^^^
2025-03-06 12:27:29   File "/src/pipelines/indexing/db_schema.py", line 346, in __init__
2025-03-06 12:27:29     "embedder": embedder_provider.get_document_embedder(),
2025-03-06 12:27:29                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 12:27:29 AttributeError: 'NoneType' object has no attribute 'get_document_embedder'
2025-03-06 12:27:29 
2025-03-06 12:27:29 ERROR:    Application startup failed. Exiting

@yuzhi-jiang 这个问题我已经解决,直接修改源代码

@paopa
Copy link
Member

paopa commented Mar 6, 2025

2025-03-06 12:27:29 "embedder": embedder_provider.get_document_embedder(),
2025-03-06 12:27:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 12:27:29 AttributeError: 'NoneType' object has no attribute 'get_document_embedder'

I noticed that the naming issue for the embedder is inconsistent. I think you can modify all instances of ‘openai’ to ‘ollama’ to fix this in the following pipeline section.

config.yml

type: llm
provider: litellm_llm
models:
- api_base: http://192.168.177.95:11434/v1  # change this to your ollama host, api_base should be <ollama_url>/v1
  api_key_name: LLM_OLLAMA_API_KEY
  model: openai/deepseek-r1:14b
  timeout: 600
  kwargs:
    n: 1
    temperature: 0

---
type: embedder
provider: litellm_embedder
models:
- model: ollama/nomic-embed-text:latest
  api_base: http://192.168.177.95:11434
  api_key_name: EMBEDDER_OLLAMA_API_KEY
  timeout: 600


---
type: pipeline
pipes:
  - name: db_schema_indexing
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: historical_question_indexing
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: table_description_indexing
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: db_schema_retrieval
    llm: litellm_llm.openai/deepseek-r1:14b
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: historical_question_retrieval
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: sql_generation

vendor keys

LLM_OPENAI_API_KEY=sks
EMBEDDER_OPENAI_API_KEY=sks
LLM_AZURE_OPENAI_API_KEY=sks
EMBEDDER_AZURE_OPENAI_API_KEY=sks
QDRANT_API_KEY=sks

By the way, I think you should either remove the QDRANT_API_KEY or blank it out. If you leave it in, it might cause other authentication errors.

@yuzhi-jiang
Copy link
Author

2025-03-06 12:27:29 "embedder": embedder_provider.get_document_embedder(),
2025-03-06 12:27:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-06 12:27:29 AttributeError: 'NoneType' object has no attribute 'get_document_embedder'

I noticed that the naming issue for the embedder is inconsistent. I think you can modify all instances of ‘openai’ to ‘ollama’ to fix this in the following pipeline section.

config.yml

type: llm
provider: litellm_llm
models:
- api_base: http://192.168.177.95:11434/v1  # change this to your ollama host, api_base should be <ollama_url>/v1
  api_key_name: LLM_OLLAMA_API_KEY
  model: openai/deepseek-r1:14b
  timeout: 600
  kwargs:
    n: 1
    temperature: 0

---
type: embedder
provider: litellm_embedder
models:
- model: ollama/nomic-embed-text:latest
  api_base: http://192.168.177.95:11434
  api_key_name: EMBEDDER_OLLAMA_API_KEY
  timeout: 600


---
type: pipeline
pipes:
  - name: db_schema_indexing
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: historical_question_indexing
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: table_description_indexing
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: db_schema_retrieval
    llm: litellm_llm.openai/deepseek-r1:14b
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: historical_question_retrieval
    embedder: litellm_embedder.openai/nomic-embed-text:latest
    document_store: qdrant
  - name: sql_generation

vendor keys

LLM_OPENAI_API_KEY=sks
EMBEDDER_OPENAI_API_KEY=sks
LLM_AZURE_OPENAI_API_KEY=sks
EMBEDDER_AZURE_OPENAI_API_KEY=sks
QDRANT_API_KEY=sks

By the way, I think you should either remove the QDRANT_API_KEY or blank it out. If you leave it in, it might cause other authentication errors.
好的,那么其他的key是不是也需要移除呢,因为按照惯性逻辑,配置的取值,应该是文件config决定的,所以我不太理解为什么会干扰

I noticed that the naming issue for the embedder is inconsistent. I think you can modify all instances of ‘openai’ to ‘ollama’ to fix this in the following pipeline section.

感谢提出,不过你能否根据我的配置修改,以防我认识错误,避免多次错误修改

@paopa
Copy link
Member

paopa commented Mar 6, 2025

@yuzhi-jiang, the config I think will be like the following, and I also noticed you're using deepseek-r1:14b, and I think the model may not be good at responding to the structure output. Refer to #1121 (comment) you need to change a model from my opinion.

  • config.yaml
type: llm
provider: litellm_llm
models:
- api_base: http://192.168.177.95:11434
  model: ollama/deepseek-r1:14b
  timeout: 600
  kwargs:
    n: 1
    temperature: 0

---
type: embedder
provider: litellm_embedder
models:
- model: ollama/nomic-embed-text:latest
  api_base: http://192.168.177.95:11434
  timeout: 600

---
type: engine
provider: wren_ui
endpoint: http://wren-ui:3000

---
type: document_store
provider: qdrant
location: http://qdrant:6333
embedding_model_dim: 768
timeout: 120
recreate_index: true

---
type: pipeline
pipes:
  - name: db_schema_indexing
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: historical_question_indexing
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: table_description_indexing
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: db_schema_retrieval
    llm: litellm_llm.ollama/deepseek-r1:14b
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: historical_question_retrieval
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: sql_generation
    llm: litellm_llm.ollama/deepseek-r1:14b
    engine: wren_ui
  - name: sql_correction
    llm: litellm_llm.ollama/deepseek-r1:14b
    engine: wren_ui
  - name: followup_sql_generation
    llm: litellm_llm.ollama/deepseek-r1:14b
    engine: wren_ui
  - name: sql_summary
    llm: litellm_llm.ollama/deepseek-r1:14b
  - name: sql_answer
    llm: litellm_llm.ollama/deepseek-r1:14b
    engine: wren_ui
  - name: sql_breakdown
    llm: litellm_llm.ollama/deepseek-r1:14b
    engine: wren_ui
  - name: sql_expansion
    llm: litellm_llm.ollama/deepseek-r1:14b
    engine: wren_ui
  - name: sql_explanation
    llm: litellm_llm.ollama/deepseek-r1:14b
  - name: semantics_description
    llm: litellm_llm.ollama/deepseek-r1:14b
  - name: relationship_recommendation
    llm: litellm_llm.ollama/deepseek-r1:14b
    engine: wren_ui
  - name: question_recommendation
    llm: litellm_llm.ollama/deepseek-r1:14b
  - name: question_recommendation_db_schema_retrieval
    llm: litellm_llm.ollama/deepseek-r1:14b
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: question_recommendation_sql_generation
    llm: litellm_llm.ollama/deepseek-r1:14b
    engine: wren_ui
  - name: chart_generation
    llm: litellm_llm.ollama/deepseek-r1:14b
  - name: chart_adjustment
    llm: litellm_llm.ollama/deepseek-r1:14b
  - name: intent_classification
    llm: litellm_llm.ollama/deepseek-r1:14b
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: data_assistance
    llm: litellm_llm.ollama/deepseek-r1:14b
  - name: sql_pairs_indexing
    document_store: qdrant
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
  - name: sql_pairs_deletion
    document_store: qdrant
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
  - name: sql_pairs_retrieval
    document_store: qdrant
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    llm: litellm_llm.ollama/deepseek-r1:14b
  - name: preprocess_sql_data
    llm: litellm_llm.ollama/deepseek-r1:14b
  - name: sql_executor
    engine: wren_ui
  - name: sql_question_generation
    llm: litellm_llm.ollama/deepseek-r1:14b
  - name: sql_generation_reasoning
    llm: litellm_llm.ollama/deepseek-r1:14b
  - name: sql_regeneration
    llm: litellm_llm.ollama/deepseek-r1:14b
    engine: wren_ui

---
settings:
  column_indexing_batch_size: 50
  table_retrieval_size: 10
  table_column_retrieval_size: 100
  allow_using_db_schemas_without_pruning: false
  query_cache_maxsize: 1000
  query_cache_ttl: 3600
  langfuse_host: https://cloud.langfuse.com
  langfuse_enable: true
  logging_level: DEBUG
  development: false
  • .env
COMPOSE_PROJECT_NAME=wrenai
PLATFORM=linux/amd64

PROJECT_DIR=.

# service port
WREN_ENGINE_PORT=8080
WREN_ENGINE_SQL_PORT=7432
WREN_AI_SERVICE_PORT=5555
WREN_UI_PORT=3000
IBIS_SERVER_PORT=8000
WREN_UI_ENDPOINT=http://wren-ui:${WREN_UI_PORT}

# ai service settings
QDRANT_HOST=qdrant
SHOULD_FORCE_DEPLOY=1

# vendor keys
LLM_OPENAI_API_KEY=sks
EMBEDDER_OPENAI_API_KEY=sks
LLM_AZURE_OPENAI_API_KEY=sks
EMBEDDER_AZURE_OPENAI_API_KEY=sks
LLM_OLLAMA_API_KEY=random
EMBEDDER_OLLAMA_API_KEY=random

# version
# CHANGE THIS TO THE LATEST VERSION
WREN_PRODUCT_VERSION=0.15.3
WREN_ENGINE_VERSION=0.13.1
WREN_AI_SERVICE_VERSION=0.15.7
IBIS_SERVER_VERSION=0.13.1
WREN_UI_VERSION=0.20.1
WREN_BOOTSTRAP_VERSION=0.1.5

# user id (uuid v4)
USER_UUID=

# for other services
POSTHOG_API_KEY=phc_nhF32aj4xHXOZb0oqr2cn4Oy9uiWzz6CCP4KZmRq9aE
POSTHOG_HOST=https://app.posthog.com
TELEMETRY_ENABLED=true
# this is for telemetry to know the model, i think ai-service might be able to provide a endpoint to get the information
GENERATION_MODEL=gpt-4o-mini
LANGFUSE_SECRET_KEY=
LANGFUSE_PUBLIC_KEY=

# the port exposes to the host
# OPTIONAL: change the port if you have a conflict
HOST_PORT=3000
AI_SERVICE_FORWARD_PORT=5555

# Wren UI
EXPERIMENTAL_ENGINE_RUST_VERSION=false

@yuzhi-jiang
Copy link
Author

@paopa 好的我马上试试,不知道你认为ollama跑的什么模型合适,我可以马上pull,我目前还有空间,但是显存不太够,所以大概只能流畅运行14b左右的模型

@yuzhi-jiang
Copy link
Author

@paopa 好的我马上试试,不知道你认为ollama跑的什么模型合适,我可以马上pull,我目前还有空间,但是显存不太够,所以大概只能流畅运行14b左右的模型

现在ai service 不报错了,页面请求无反馈,所以我目前的目标是能使用,以至于性能和准确度的问题才能在申请更多的显存
Image

{
    "data": {
        "getProjectRecommendationQuestions": {
            "status": "GENERATING",
            "questions": [],
            "error": null,
            "__typename": "RecommendedQuestionsTask"
        }
    }
}

@jonathanyb
Copy link

@yuzhi-jiang Do you see if the background server reported this error? I'm stuck here right now
orjson.JSONDecodeError: unexpected character: line 1 column 1 (char 0)c

@paopa
Copy link
Member

paopa commented Mar 6, 2025

Hi @yuzhi-jiang, @jonathanyb, I tried to use ollama_chat prefix instead of ollama for llm model, then it doesn’t show the json decode error again. I think you guys can give it a try. And also created a PR #1371 to fix the example config. But on my machine, it’s inference very slow tho.

e.g.

model: ollama_chat/phi4:14b

@yuzhi-jiang
Copy link
Author

@yuzhi-jiang 你看看后台服务器是不是报了这个错,我现在就卡在这里 orjson.JSONDecodeError:unexpected character:line 1 column 1(char 0)c

是的,可能是模型返回问题?
@paopa
当我使用模型

  model: ollama_chat/phi4:14b

报错:

2025-03-07 09:07:29 ERROR:    Traceback (most recent call last):
2025-03-07 09:07:29   File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 693, in lifespan
2025-03-07 09:07:29     async with self.lifespan_context(app) as maybe_state:
2025-03-07 09:07:29   File "/usr/local/lib/python3.12/contextlib.py", line 204, in __aenter__
2025-03-07 09:07:29     return await anext(self.gen)
2025-03-07 09:07:29            ^^^^^^^^^^^^^^^^^^^^^
2025-03-07 09:07:29   File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
2025-03-07 09:07:29     async with original_context(app) as maybe_original_state:
2025-03-07 09:07:29   File "/usr/local/lib/python3.12/contextlib.py", line 204, in __aenter__
2025-03-07 09:07:29     return await anext(self.gen)
2025-03-07 09:07:29            ^^^^^^^^^^^^^^^^^^^^^
2025-03-07 09:07:29   File "/src/__main__.py", line 32, in lifespan
2025-03-07 09:07:29     app.state.service_container = create_service_container(pipe_components, settings)
2025-03-07 09:07:29                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-07 09:07:29   File "/src/globals.py", line 63, in create_service_container
2025-03-07 09:07:29     "semantics_description": generation.SemanticsDescription(
2025-03-07 09:07:29                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-07 09:07:29   File "/src/pipelines/generation/semantics_description.py", line 197, in __init__
2025-03-07 09:07:29     "generator": llm_provider.get_generator(
2025-03-07 09:07:29                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-07 09:07:29 AttributeError: 'NoneType' object has no attribute 'get_generator'

当我使用

  model: ollama/phi4:14b

则是页面提出问题后报错:

2025-03-07 09:02:02 I0307 01:02:02.830 10 wren-ai-service:267] db_schemas token count is greater than 100,000, so we will prune columns
2025-03-07 09:02:13 
2025-03-07 09:02:13 ********************************************************************************
2025-03-07 09:02:13 > construct_retrieval_results [src.pipelines.retrieval.retrieval.construct_retrieval_results()] encountered an error<
2025-03-07 09:02:13 > Node inputs:
2025-03-07 09:02:13 {'check_using_db_schemas_without_pruning': "<Task finished name='Task-409' "
2025-03-07 09:02:13                                            'coro=<AsyncGraphAda...',
2025-03-07 09:02:13  'construct_db_schemas': "<Task finished name='Task-408' "
2025-03-07 09:02:13                          'coro=<AsyncGraphAda...',
2025-03-07 09:02:13  'dbschema_retrieval': "<Task finished name='Task-407' coro=<AsyncGraphAda...",
2025-03-07 09:02:13  'filter_columns_in_tables': "<Task finished name='Task-411' "
2025-03-07 09:02:13                              'coro=<AsyncGraphAda...'}
2025-03-07 09:02:13 ********************************************************************************
2025-03-07 09:02:13 Traceback (most recent call last):
2025-03-07 09:02:13   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 122, in new_fn
2025-03-07 09:02:13     await fn(**fn_kwargs) if asyncio.iscoroutinefunction(fn) else fn(**fn_kwargs)
2025-03-07 09:02:13                                                                   ^^^^^^^^^^^^^^^
2025-03-07 09:02:13   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 256, in sync_wrapper
2025-03-07 09:02:13     self._handle_exception(observation, e)
2025-03-07 09:02:13   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 517, in _handle_exception
2025-03-07 09:02:13     raise e
2025-03-07 09:02:13   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 254, in sync_wrapper
2025-03-07 09:02:13     result = func(*args, **kwargs)
2025-03-07 09:02:13              ^^^^^^^^^^^^^^^^^^^^^
2025-03-07 09:02:13   File "/src/pipelines/retrieval/retrieval.py", line 306, in construct_retrieval_results
2025-03-07 09:02:13     columns_and_tables_needed = orjson.loads(
2025-03-07 09:02:13                                 ^^^^^^^^^^^^^
2025-03-07 09:02:13 orjson.JSONDecodeError: unexpected character: line 1 column 1 (char 0)

当前我的config.yaml:

type: llm
provider: litellm_llm
models:
- api_base: http://192.168.177.95:11434
  model: ollama/phi4:14b
  timeout: 600
  kwargs:
    n: 1
    temperature: 0

---
type: embedder
provider: litellm_embedder
models:
- model: ollama/nomic-embed-text:latest
  api_base: http://192.168.177.95:11434
  timeout: 600

---
type: engine
provider: wren_ui
endpoint: http://wren-ui:3000

---
type: document_store
provider: qdrant
location: http://qdrant:6333
embedding_model_dim: 768
timeout: 120
recreate_index: true

---
type: pipeline
pipes:
  - name: db_schema_indexing
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: historical_question_indexing
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: table_description_indexing
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: db_schema_retrieval
    llm: litellm_llm.ollama/phi4:14b
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: historical_question_retrieval
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: sql_generation
    llm: litellm_llm.ollama/phi4:14b
    engine: wren_ui
  - name: sql_correction
    llm: litellm_llm.ollama/phi4:14b
    engine: wren_ui
  - name: followup_sql_generation
    llm: litellm_llm.ollama/phi4:14b
    engine: wren_ui
  - name: sql_summary
    llm: litellm_llm.ollama/phi4:14b
  - name: sql_answer
    llm: litellm_llm.ollama/phi4:14b
    engine: wren_ui
  - name: sql_breakdown
    llm: litellm_llm.ollama/phi4:14b
    engine: wren_ui
  - name: sql_expansion
    llm: litellm_llm.ollama/phi4:14b
    engine: wren_ui
  - name: sql_explanation
    llm: litellm_llm.ollama/phi4:14b
  - name: semantics_description
    llm: litellm_llm.ollama/phi4:14b
  - name: relationship_recommendation
    llm: litellm_llm.ollama/phi4:14b
    engine: wren_ui
  - name: question_recommendation
    llm: litellm_llm.ollama/phi4:14b
  - name: question_recommendation_db_schema_retrieval
    llm: litellm_llm.ollama/phi4:14b
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: question_recommendation_sql_generation
    llm: litellm_llm.ollama/phi4:14b
    engine: wren_ui
  - name: chart_generation
    llm: litellm_llm.ollama/phi4:14b
  - name: chart_adjustment
    llm: litellm_llm.ollama/phi4:14b
  - name: intent_classification
    llm: litellm_llm.ollama/phi4:14b
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    document_store: qdrant
  - name: data_assistance
    llm: litellm_llm.ollama/phi4:14b
  - name: sql_pairs_indexing
    document_store: qdrant
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
  - name: sql_pairs_deletion
    document_store: qdrant
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
  - name: sql_pairs_retrieval
    document_store: qdrant
    embedder: litellm_embedder.ollama/nomic-embed-text:latest
    llm: litellm_llm.ollama/phi4:14b
  - name: preprocess_sql_data
    llm: litellm_llm.ollama/phi4:14b
  - name: sql_executor
    engine: wren_ui
  - name: sql_question_generation
    llm: litellm_llm.ollama/phi4:14b
  - name: sql_generation_reasoning
    llm: litellm_llm.ollama/phi4:14b
  - name: sql_regeneration
    llm: litellm_llm.ollama/phi4:14b
    engine: wren_ui


@paopa
Copy link
Member

paopa commented Mar 7, 2025

Hey @yuzhi-jiang, I know it’s a bit of a hassle, but for your config, you need to change all ollama/phi4:14b to ollama_chat/phi4:14b in your config.yaml. btw, I’ve simplified the pipeline management in PR #1371, so if you want to easily switch between llm and embedding model, you can take a look the PR.

here is the version i've added the alias to simplify the pipe management.

type: llm
provider: litellm_llm
models:
- api_base: http://192.168.177.95:11434
  model: ollama_chat/phi4:14b
  alias: default
  timeout: 600
  kwargs:
    n: 1
    temperature: 0

---
type: embedder
provider: litellm_embedder
models:
- model: ollama/nomic-embed-text:latest
  api_base: http://192.168.177.95:11434
  alias: default
  timeout: 600

---
type: engine
provider: wren_ui
endpoint: http://wren-ui:3000

---
type: document_store
provider: qdrant
location: http://qdrant:6333
embedding_model_dim: 768
timeout: 120
recreate_index: true

---
type: pipeline
pipes:
  - name: db_schema_indexing
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: historical_question_indexing
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: table_description_indexing
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: db_schema_retrieval
    llm: litellm_llm.default
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: historical_question_retrieval
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: sql_generation
    llm: litellm_llm.default
    engine: wren_ui
  - name: sql_correction
    llm: litellm_llm.default
    engine: wren_ui
  - name: followup_sql_generation
    llm: litellm_llm.default
    engine: wren_ui
  - name: sql_summary
    llm: litellm_llm.default
  - name: sql_answer
    llm: litellm_llm.default
    engine: wren_ui
  - name: sql_breakdown
    llm: litellm_llm.default
    engine: wren_ui
  - name: sql_expansion
    llm: litellm_llm.default
    engine: wren_ui
  - name: sql_explanation
    llm: litellm_llm.default
  - name: semantics_description
    llm: litellm_llm.default
  - name: relationship_recommendation
    llm: litellm_llm.default
    engine: wren_ui
  - name: question_recommendation
    llm: litellm_llm.default
  - name: question_recommendation_db_schema_retrieval
    llm: litellm_llm.default
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: question_recommendation_sql_generation
    llm: litellm_llm.default
    engine: wren_ui
  - name: chart_generation
    llm: litellm_llm.default
  - name: chart_adjustment
    llm: litellm_llm.default
  - name: intent_classification
    llm: litellm_llm.default
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: data_assistance
    llm: litellm_llm.default
  - name: sql_pairs_indexing
    document_store: qdrant
    embedder: litellm_embedder.default
  - name: sql_pairs_deletion
    document_store: qdrant
    embedder: litellm_embedder.default
  - name: sql_pairs_retrieval
    document_store: qdrant
    embedder: litellm_embedder.default
    llm: litellm_llm.default
  - name: preprocess_sql_data
    llm: litellm_llm.default
  - name: sql_executor
    engine: wren_ui
  - name: sql_question_generation
    llm: litellm_llm.default
  - name: sql_generation_reasoning
    llm: litellm_llm.default
  - name: sql_regeneration
    llm: litellm_llm.default
    engine: wren_ui


@yuzhi-jiang
Copy link
Author

@paopa 感谢你帮我修改配置,我使用了你建议的最新配置,但我依然遇到如下错误,我注意到wrenai在3天前有更新,我是否需要更新docker image 的version?

Image

@paopa
Copy link
Member

paopa commented Mar 7, 2025

Hi @yuzhi-jiang, could you check again to make sure the config is correct? The message indicates that it cannot map to your LLM provider instance for the semantics description object. It might be a typo or something else, as I don’t have this issue with the same config. You could also try restarting the AI service to see if that helps.

  - name: semantics_description
    llm: litellm_llm.default

@paopa 感谢你帮我修改配置,我使用了你建议的最新配置,但我依然遇到如下错误,我注意到wrenai在3天前有更新,我是否需要更新docker image 的version?

Image

I don’t think it matters much with the new release, but I’d love for you to try the latest version. If you have a chance, please let us know what you think. Your feedback is super valuable to us and helps us make this project even better. Thanks a bunch!

@yuzhi-jiang
Copy link
Author

@yuzhi-jiang,我知道这有点麻烦,但是对于您的配置,您需要在 config.yaml 中将所有内容更改为。顺便说一句,我在 PR #1371 中简化了管道管理ollama/phi4:14b因此如果您想轻松地在 llm 和嵌入模型之间切换,您可以查看 PR。ollama_chat/phi4:14b

这是我添加别名以简化管道管理的版本。

type: llm
provider: litellm_llm
models:
- api_base: http://192.168.177.95:11434
  model: ollama_chat/phi4:14b
  alias: default
  timeout: 600
  kwargs:
    n: 1
    temperature: 0

---
type: embedder
provider: litellm_embedder
models:
- model: ollama/nomic-embed-text:latest
  api_base: http://192.168.177.95:11434
  alias: default
  timeout: 600

---
type: engine
provider: wren_ui
endpoint: http://wren-ui:3000

---
type: document_store
provider: qdrant
location: http://qdrant:6333
embedding_model_dim: 768
timeout: 120
recreate_index: true

---
type: pipeline
pipes:
  - name: db_schema_indexing
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: historical_question_indexing
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: table_description_indexing
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: db_schema_retrieval
    llm: litellm_llm.default
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: historical_question_retrieval
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: sql_generation
    llm: litellm_llm.default
    engine: wren_ui
  - name: sql_correction
    llm: litellm_llm.default
    engine: wren_ui
  - name: followup_sql_generation
    llm: litellm_llm.default
    engine: wren_ui
  - name: sql_summary
    llm: litellm_llm.default
  - name: sql_answer
    llm: litellm_llm.default
    engine: wren_ui
  - name: sql_breakdown
    llm: litellm_llm.default
    engine: wren_ui
  - name: sql_expansion
    llm: litellm_llm.default
    engine: wren_ui
  - name: sql_explanation
    llm: litellm_llm.default
  - name: semantics_description
    llm: litellm_llm.default
  - name: relationship_recommendation
    llm: litellm_llm.default
    engine: wren_ui
  - name: question_recommendation
    llm: litellm_llm.default
  - name: question_recommendation_db_schema_retrieval
    llm: litellm_llm.default
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: question_recommendation_sql_generation
    llm: litellm_llm.default
    engine: wren_ui
  - name: chart_generation
    llm: litellm_llm.default
  - name: chart_adjustment
    llm: litellm_llm.default
  - name: intent_classification
    llm: litellm_llm.default
    embedder: litellm_embedder.default
    document_store: qdrant
  - name: data_assistance
    llm: litellm_llm.default
  - name: sql_pairs_indexing
    document_store: qdrant
    embedder: litellm_embedder.default
  - name: sql_pairs_deletion
    document_store: qdrant
    embedder: litellm_embedder.default
  - name: sql_pairs_retrieval
    document_store: qdrant
    embedder: litellm_embedder.default
    llm: litellm_llm.default
  - name: preprocess_sql_data
    llm: litellm_llm.default
  - name: sql_executor
    engine: wren_ui
  - name: sql_question_generation
    llm: litellm_llm.default
  - name: sql_generation_reasoning
    llm: litellm_llm.default
  - name: sql_regeneration
    llm: litellm_llm.default
    engine: wren_ui

@paopa 你好,经过我检查,如果不算配置错误,应该不算拼写问题,我copy以上配置的,为了方便展示,我做了diff
观察到全都是replace,应该是没有配置错误的
如下

Image

@yuzhi-jiang
Copy link
Author

I don’t think it matters much with the new release, but I’d love for you to try the latest version. If you have a chance, please let us know what you think. Your feedback is super valuable to us and helps us make this project even better. Thanks a bunch!

我认为config.yaml,或许可以简化,或者加一层,或许在代码中是之间读取这个config.yaml,但是对于不熟知的用户来说,却会造成一定的使用门槛,配置中写的规则(比如必填 ollama_url/v1)似乎可以不必遵守,我认为应该以用户最简配置为主,如果是customModel,则只需要填写modelname,base_url,api_key即可了

@paopa
Copy link
Member

paopa commented Mar 7, 2025

Hey @yuzhi-jiang, if the files are the same, I’m not sure why the error occurred. Maybe you could try stopping the container and restarting it again?

Thanks for the suggestion! Actually, we’ve found a lot of community members on GitHub and Discord who are having trouble setting up the config. We’ve already raised an issue about it and added it to our backlog. We’ll plan how to solve it better!

@paopa
Copy link
Member

paopa commented Mar 7, 2025

Hi @yuzhi-jiang, I got a same issue with you from other community member. Can you give Wren AI 0.15.4 a try? We just released it this week, and I’ve been using it and it’s working well with the config!

@yuzhi-jiang
Copy link
Author

@paopa 你好,我今天使用了 0.15.4 ,修改了env中的部分配置,其他没修改

WREN_PRODUCT_VERSION=0.15.4
WREN_ENGINE_VERSION=0.14.3
WREN_AI_SERVICE_VERSION=0.15.18
IBIS_SERVER_VERSION=0.14.3
WREN_UI_VERSION=0.20.2
WREN_BOOTSTRAP_VERSION=0.1.5

依旧有报错

2025-03-10 09:08:07 E0310 01:08:07.510 8 wren-ai-service:503] ask pipeline - OTHERS: unexpected character: line 1 column 1 (char 0)
2025-03-10 09:08:07 Traceback (most recent call last):
2025-03-10 09:08:07   File "/src/web/v1/services/ask.py", line 307, in ask
2025-03-10 09:08:07     retrieval_result = await self._pipelines["retrieval"].run(
2025-03-10 09:08:07                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 219, in async_wrapper
2025-03-10 09:08:07     self._handle_exception(observation, e)
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 520, in _handle_exception
2025-03-10 09:08:07     raise e
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 217, in async_wrapper
2025-03-10 09:08:07     result = await func(*args, **kwargs)
2025-03-10 09:08:07              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/src/pipelines/retrieval/retrieval.py", line 488, in run
2025-03-10 09:08:07     return await self._pipe.execute(
2025-03-10 09:08:07            ^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 375, in execute
2025-03-10 09:08:07     raise e
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 366, in execute
2025-03-10 09:08:07     outputs = await self.raw_execute(_final_vars, overrides, display_graph, inputs=inputs)
2025-03-10 09:08:07               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 326, in raw_execute
2025-03-10 09:08:07     raise e
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 321, in raw_execute
2025-03-10 09:08:07     results = await await_dict_of_tasks(task_dict)
2025-03-10 09:08:07               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 23, in await_dict_of_tasks
2025-03-10 09:08:07     coroutines_gathered = await asyncio.gather(*coroutines)
2025-03-10 09:08:07                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 36, in process_value
2025-03-10 09:08:07     return await val
2025-03-10 09:08:07            ^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 122, in new_fn
2025-03-10 09:08:07     await fn(**fn_kwargs) if asyncio.iscoroutinefunction(fn) else fn(**fn_kwargs)
2025-03-10 09:08:07                                                                   ^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 256, in sync_wrapper
2025-03-10 09:08:07     self._handle_exception(observation, e)
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 520, in _handle_exception
2025-03-10 09:08:07     raise e
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 254, in sync_wrapper
2025-03-10 09:08:07     result = func(*args, **kwargs)
2025-03-10 09:08:07              ^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/src/pipelines/retrieval/retrieval.py", line 337, in construct_retrieval_results
2025-03-10 09:08:07     columns_and_tables_needed = orjson.loads(
2025-03-10 09:08:07                                 ^^^^^^^^^^^^^
2025-03-10 09:08:07 orjson.JSONDecodeError: unexpected character: line 1 column 1 (char 0)

@paopa
Copy link
Member

paopa commented Mar 10, 2025

@paopa 你好,我今天使用了 0.15.4 ,修改了env中的部分配置,其他没修改

WREN_PRODUCT_VERSION=0.15.4
WREN_ENGINE_VERSION=0.14.3
WREN_AI_SERVICE_VERSION=0.15.18
IBIS_SERVER_VERSION=0.14.3
WREN_UI_VERSION=0.20.2
WREN_BOOTSTRAP_VERSION=0.1.5

依旧有报错

2025-03-10 09:08:07 E0310 01:08:07.510 8 wren-ai-service:503] ask pipeline - OTHERS: unexpected character: line 1 column 1 (char 0)
2025-03-10 09:08:07 Traceback (most recent call last):
2025-03-10 09:08:07   File "/src/web/v1/services/ask.py", line 307, in ask
2025-03-10 09:08:07     retrieval_result = await self._pipelines["retrieval"].run(
2025-03-10 09:08:07                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 219, in async_wrapper
2025-03-10 09:08:07     self._handle_exception(observation, e)
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 520, in _handle_exception
2025-03-10 09:08:07     raise e
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 217, in async_wrapper
2025-03-10 09:08:07     result = await func(*args, **kwargs)
2025-03-10 09:08:07              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/src/pipelines/retrieval/retrieval.py", line 488, in run
2025-03-10 09:08:07     return await self._pipe.execute(
2025-03-10 09:08:07            ^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 375, in execute
2025-03-10 09:08:07     raise e
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 366, in execute
2025-03-10 09:08:07     outputs = await self.raw_execute(_final_vars, overrides, display_graph, inputs=inputs)
2025-03-10 09:08:07               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 326, in raw_execute
2025-03-10 09:08:07     raise e
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 321, in raw_execute
2025-03-10 09:08:07     results = await await_dict_of_tasks(task_dict)
2025-03-10 09:08:07               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 23, in await_dict_of_tasks
2025-03-10 09:08:07     coroutines_gathered = await asyncio.gather(*coroutines)
2025-03-10 09:08:07                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 36, in process_value
2025-03-10 09:08:07     return await val
2025-03-10 09:08:07            ^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 122, in new_fn
2025-03-10 09:08:07     await fn(**fn_kwargs) if asyncio.iscoroutinefunction(fn) else fn(**fn_kwargs)
2025-03-10 09:08:07                                                                   ^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 256, in sync_wrapper
2025-03-10 09:08:07     self._handle_exception(observation, e)
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 520, in _handle_exception
2025-03-10 09:08:07     raise e
2025-03-10 09:08:07   File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 254, in sync_wrapper
2025-03-10 09:08:07     result = func(*args, **kwargs)
2025-03-10 09:08:07              ^^^^^^^^^^^^^^^^^^^^^
2025-03-10 09:08:07   File "/src/pipelines/retrieval/retrieval.py", line 337, in construct_retrieval_results
2025-03-10 09:08:07     columns_and_tables_needed = orjson.loads(
2025-03-10 09:08:07                                 ^^^^^^^^^^^^^
2025-03-10 09:08:07 orjson.JSONDecodeError: unexpected character: line 1 column 1 (char 0)

Hey! I can't reproduce this issue with the above config. Can you check the container version for the Wren AI service is correct or is the config.yaml correct? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants
@wwwy3y3 @yuzhi-jiang @paopa @jonathanyb and others