When using the demo for testing, an error occurred: "columns_and_tables_needed = orjson.loads orjson.JSONDecodeError: unexpected character: line 1 column 1".
My question is 'Information of the three individuals with the highest salaries' The log content is as follows:
I0319 06:15:48.781 8 wren-ai-service:298] db_schemas token count is greater than 100,000, so we will prune columns
INFO: 172.25.0.3:57886 - "GET /v1/asks/21ad676d-2688-4764-a9c2-f11255ddab8d/result HTTP/1.1" 200 OK
********************************************************************************
> construct_retrieval_results [src.pipelines.retrieval.retrieval.construct_retrieval_results()] encountered an error<
> Node inputs:
{'check_using_db_schemas_without_pruning': "<Task finished name='Task-581' "
'coro=<AsyncGraphAda...',
'construct_db_schemas': "<Task finished name='Task-580' "
'coro=<AsyncGraphAda...',
'dbschema_retrieval': "<Task finished name='Task-579' coro=<AsyncGraphAda...",
'filter_columns_in_tables': "<Task finished name='Task-583' "
'coro=<AsyncGraphAda...'}
********************************************************************************
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 122, in new_fn
await fn(**fn_kwargs) if asyncio.iscoroutinefunction(fn) else fn(**fn_kwargs)
^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 256, in sync_wrapper
self._handle_exception(observation, e)
File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 520, in _handle_exception
raise e
File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 254, in sync_wrapper
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/src/pipelines/retrieval/retrieval.py", line 334, in construct_retrieval_results
columns_and_tables_needed = orjson.loads(
^^^^^^^^^^^^^
orjson.JSONDecodeError: unexpected character: line 1 column 1 (char 0)
-------------------------------------------------------------------
Oh no an error! Need help with Hamilton?
Join our slack and ask for help! https://join.slack.com/t/hamilton-opensource/shared_invite/zt-2niepkra8-DGKGf_tTYhXuJWBTXtIs4g
-------------------------------------------------------------------
E0319 06:15:50.792 8 wren-ai-service:529] ask pipeline - OTHERS: unexpected character: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/src/web/v1/services/ask.py", line 318, in ask
retrieval_result = await self._pipelines["retrieval"].run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 219, in async_wrapper
self._handle_exception(observation, e)
File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 520, in _handle_exception
raise e
File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 217, in async_wrapper
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/pipelines/retrieval/retrieval.py", line 485, in run
return await self._pipe.execute(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 375, in execute
raise e
File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 366, in execute
outputs = await self.raw_execute(_final_vars, overrides, display_graph, inputs=inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 326, in raw_execute
raise e
File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 321, in raw_execute
results = await await_dict_of_tasks(task_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 23, in await_dict_of_tasks
coroutines_gathered = await asyncio.gather(*coroutines)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 36, in process_value
return await val
^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/hamilton/async_driver.py", line 122, in new_fn
await fn(**fn_kwargs) if asyncio.iscoroutinefunction(fn) else fn(**fn_kwargs)
^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 256, in sync_wrapper
self._handle_exception(observation, e)
File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 520, in _handle_exception
raise e
File "/app/.venv/lib/python3.12/site-packages/langfuse/decorators/langfuse_decorator.py", line 254, in sync_wrapper
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/src/pipelines/retrieval/retrieval.py", line 334, in construct_retrieval_results
columns_and_tables_needed = orjson.loads(
^^^^^^^^^^^^^
orjson.JSONDecodeError: unexpected character: line 1 column 1 (char 0)
The.env configuration is as follows:
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=
# version
# CHANGE THIS TO THE LATEST VERSION
WREN_PRODUCT_VERSION=0.16.0
WREN_ENGINE_VERSION=0.14.5
WREN_AI_SERVICE_VERSION=0.16.2
IBIS_SERVER_VERSION=0.14.5
WREN_UI_VERSION=0.21.0
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
LLM_OLLAMA_API_KEY=random
EMBEDDER_OLLAMA_API_KEY=random
EMBEDDER_OLLAMA_URL=http://132.120.139.194:11434
LLM_OLLAMA_URL=http://132.120.132.44:11434
OPENAI_API_KEY=dummy-key
The config configuration is as follows:
type: llm
provider: litellm_llm
timeout: 120
models:
- model: openai/qwen2.5:7b
api_base: http://132.120.132.44:11434/v1
api_key_name: LLM_OLLAMA_API_KEY
kwargs:
temperature: 0
n: 1
# for better consistency of llm response, refer: https://platform.openai.com/docs/api-reference/chat/create#chat-create-seed
# seed: 0
# max_tokens: 4096
- model: gpt-4o-2024-08-06
api_base: https://api.openai.com/v1
api_key_name: LLM_OPENAI_API_KEY
kwargs:
temperature: 0
n: 1
# for better consistency of llm response, refer: https://platform.openai.com/docs/api-reference/chat/create#chat-create-seed
seed: 0
max_tokens: 4096
- model: o3-mini-2025-01-31
api_base: https://api.openai.com/v1
api_key_name: LLM_OPENAI_API_KEY
kwargs:
n: 1
seed: 0
max_completion_tokens: 4096
reasoning_effort: low
---
type: embedder
provider: litellm_embedder
models:
- model: openai/bge-m3:567m-fp16
api_base: http://132.120.139.194:11434/v1
api_key_name: EMBEDDER_OLLAMA_API_KEY
timeout: 120
---
type: engine
provider: wren_ui
endpoint: http://wren-ui:3000
---
type: document_store
provider: qdrant
location: http://qdrant:6333
embedding_model_dim: 1024
timeout: 120
recreate_index: true
---
type: pipeline
pipes:
- name: db_schema_indexing
embedder: litellm_embedder.openai/bge-m3:567m-fp16
document_store: qdrant
- name: historical_question_indexing
embedder: litellm_embedder.openai/bge-m3:567m-fp16
document_store: qdrant
- name: table_description_indexing
embedder: litellm_embedder.openai/bge-m3:567m-fp16
document_store: qdrant
- name: db_schema_retrieval
llm: litellm_llm.openai/qwen2.5:7b
embedder: litellm_embedder.openai/bge-m3:567m-fp16
document_store: qdrant
- name: historical_question_retrieval
embedder: litellm_embedder.openai/bge-m3:567m-fp16
document_store: qdrant
- name: sql_generation
llm: litellm_llm.openai/qwen2.5:7b
engine: wren_ui
- name: sql_correction
llm: litellm_llm.openai/qwen2.5:7b
engine: wren_ui
- name: followup_sql_generation
llm: litellm_llm.openai/qwen2.5:7b
engine: wren_ui
- name: sql_summary
llm: litellm_llm.openai/qwen2.5:7b
- name: sql_answer
llm: litellm_llm.openai/qwen2.5:7b
- name: sql_breakdown
llm: litellm_llm.openai/qwen2.5:7b
engine: wren_ui
- name: sql_expansion
llm: litellm_llm.openai/qwen2.5:7b
engine: wren_ui
- name: semantics_description
llm: litellm_llm.openai/qwen2.5:7b
- name: relationship_recommendation
llm: litellm_llm.openai/qwen2.5:7b
engine: wren_ui
- name: question_recommendation
llm: litellm_llm.openai/qwen2.5:7b
- name: question_recommendation_db_schema_retrieval
llm: litellm_llm.openai/qwen2.5:7b
embedder: litellm_embedder.openai/bge-m3:567m-fp16
document_store: qdrant
- name: question_recommendation_sql_generation
llm: litellm_llm.openai/qwen2.5:7b
engine: wren_ui
- name: intent_classification
llm: litellm_llm.openai/qwen2.5:7b
embedder: litellm_embedder.openai/bge-m3:567m-fp16
document_store: qdrant
- name: data_assistance
llm: litellm_llm.openai/qwen2.5:7b
- name: sql_pairs_indexing
document_store: qdrant
embedder: litellm_embedder.openai/bge-m3:567m-fp16
- name: sql_pairs_retrieval
document_store: qdrant
embedder: litellm_embedder.openai/bge-m3:567m-fp16
llm: litellm_llm.openai/qwen2.5:7b
- name: preprocess_sql_data
llm: litellm_llm.openai/qwen2.5:7b
- name: sql_executor
engine: wren_ui
- name: chart_generation
llm: litellm_llm.openai/qwen2.5:7b
- name: chart_adjustment
llm: litellm_llm.openai/qwen2.5:7b
- name: sql_question_generation
llm: litellm_llm.openai/qwen2.5:7b
- name: sql_generation_reasoning
llm: litellm_llm.openai/qwen2.5:7b
- name: sql_regeneration
llm: litellm_llm.openai/qwen2.5:7b
engine: wren_ui
---
settings:
engine_timeout: 30
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
@wxp2023 you could setup langfuse through this doc first: https://docs.getwren.ai/oss/ai_service/guide/langfuse_setup in simple words, the error message means that your llm generates malformed json output. After you setup langfuse, you could check the error details yourself.
@cyyeh could you help me check this config.yaml ,when I use deepseek model. error followes:
--config.yaml--- type: llm provider: litellm_llm models:
put DEEPSEEK_API_KEY=<your_api_key> in ~/.wrenai/.env
- api_base: https://api.deepseek.com/v1 model: deepseek/deepseek-reasoner alias: default timeout: 120 kwargs: n: 1 temperature: 0 response_format: type: text
- api_base: https://api.deepseek.com/v1 model: deepseek/deepseek-chat timeout: 120 kwargs: n: 1 temperature: 0 response_format: type: text
- api_base: https://api.deepseek.com/v1 model: deepseek/deepseek-coder timeout: 120 kwargs: n: 1 temperature: 0 response_format: type: json_object
type: embedder provider: litellm_embedder models:
- model: deepseek/deepseek-r1-distill-qwen-14b # put your embedding model name here, if it is not openai embedding model, should be
/<model_name> alias: default api_base: https://api.deepseek.com/v1 # change this according to your embedding model timeout: 120
type: engine provider: wren_ui endpoint: http://wren-ui:3000
type: engine provider: wren_ibis endpoint: http://wren-ibis:8000
type: document_store provider: qdrant location: http://qdrant:6333 embedding_model_dim: 3072 # put your embedding model dimension here 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: 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_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: followup_sql_generation_reasoning llm: litellm_llm.default
- name: sql_regeneration llm: litellm_llm.default engine: wren_ui
- name: instructions_indexing embedder: litellm_embedder.default document_store: qdrant
- name: instructions_retrieval embedder: litellm_embedder.default document_store: qdrant
- name: sql_functions_retrieval engine: wren_ibis document_store: qdrant
- name: project_meta_indexing document_store: qdrant
settings: column_indexing_batch_size: 50 table_retrieval_size: 10 table_column_retrieval_size: 100 allow_using_db_schemas_without_pruning: false # if you want to use db schemas without pruning, set this to true. It will be faster allow_intent_classification: true allow_sql_generation_reasoning: true query_cache_maxsize: 1000 query_cache_ttl: 3600 langfuse_host: https://cloud.langfuse.com langfuse_enable: true logging_level: DEBUG development: true historical_question_retrieval_similarity_threshold: 0.9 sql_pairs_similarity_threshold: 0.7 sql_pairs_retrieval_max_size: 10 instructions_similarity_threshold: 0.7 instructions_top_k: 10