Skip to content

[BUG] failed while using graphiti-core-0.24.x Integrated with Zhipu AI Model(GLM-4.6) #1123

@sparkychen

Description

@sparkychen

Bug Description

hi all,
I got an error during using graphiti-core-0.24.x via Zhipu AI model(GLM-4.6~.4.7), but I got well done when running the same code using aliyun qwen3 series models.
My code as below:

uv add -u langchain
uv add graphiti-core

import os
from config import settings
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
from graphiti_core.driver.neo4j_driver import Neo4jDriver
from graphiti_core import Graphiti
from graphiti_core.llm_client.config import LLMConfig
from graphiti_core.llm_client.openai_generic_client import OpenAIGenericClient
from graphiti_core.embedder.openai import OpenAIEmbedder, OpenAIEmbedderConfig
from graphiti_core.cross_encoder.openai_reranker_client import OpenAIRerankerClient, CrossEncoderClient
from graphiti_core.cross_encoder.bge_reranker_client import BGERerankerClient
from openai import AsyncOpenAI
from dotenv import load_dotenv

load_dotenv()

ZHIPUAI_BASE_URL = os.getenv("ZHIPUAI_BASE_URL")
ZHIPUAI_API_KEY = os.getenv("ZHIPUAI_API_KEY")
ZHIPUAI_MODEL = os.getenv("ZHIPUAI_MODEL")
ZHIPUAI_EMBEDDING_MODEL = os.getenv("ZHIPUAI_EMBEDDING_MODEL")
ZHIPUAI_RERANK_MODEL = os.getenv("ZHIPUAI_RERANK_MODEL")
ZHIPUAI_TEMPERATURE = os.getenv("ZHIPUAI_TEMPERATURE")


neo4j_driver = Neo4jDriver(
    uri=settings.NEO4J_URI, 
    user=settings.NEO4J_USER, 
    password=settings.NEO4J_PASSWORD, 
    database=settings.NEO4J_DATABASE,
)

llm_config = LLMConfig(
    api_key=ZHIPUAI_API_KEY,
    model=ZHIPUAI_MODEL,
    # small_model=LLM_MODEL,
    base_url=ZHIPUAI_BASE_URL,
    max_tokens=8192,
    temperature=0.75
)
llm_client = OpenAIGenericClient(config=llm_config)
embedder_config = OpenAIEmbedderConfig(api_key=ZHIPUAI_API_KEY, base_url=ZHIPUAI_BASE_URL, embedding_model=ZHIPUAI_EMBEDDING_MODEL, embedding_dim=1024)
embedder = OpenAIEmbedder(config=embedder_config)
cross_encoder = OpenAIRerankerClient(
    config=LLMConfig(
        api_key=ZHIPUAI_API_KEY,
        model=ZHIPUAI_RERANK_MODEL,
        base_url=ZHIPUAI_BASE_URL), 
    client=llm_client,
)

graphiti = Graphiti(
    graph_driver=neo4j_driver,
    llm_client=llm_client,
    embedder=embedder,
    cross_encoder=cross_encoder,
    max_coroutines=20
)

try:
    resp1 = await graphiti.add_episode(
        name="用户咨询记录",
        episode_body="王强在2025-10-26日来电,表示对Xiaomi 17 pro max的续航能力、散热、音质和摄影功能非常感兴趣,他的预算是5000-7000元。",
        source=EpisodeType.text,
        source_description="客户服务对话记录",
        reference_time=datetime.now(timezone.utc)
    )
    # print(f"成功添加片段: {resp1}")
except EntityTypeValidationError as e:
    print(f"数据验证失败: {e.message}")
    traceback.print_exc()

Environment

  • Graphiti Version: 0.24.3
  • Python Version:3.11.14
  • Operating System:Ubuntu 24.04
  • Database Backend: Neo4j 5.26
  • LLM Provider & Model: Zhipu AI GLM-4.6

Installation Method

  • pip install
  • [ *] uv add
  • Development installation (git clone)

Error Messages/Traceback

error message like this:
2025-12-23 21:43:18 - graphiti_core.llm_client.openai_generic_client - ERROR - Error in generating LLM response: Expecting value: line 1 column 1 (char 0)
2025-12-23 21:43:18 - graphiti_core.llm_client.openai_generic_client - WARNING - Retrying after application error (attempt 1/2): Expecting value: line 1 column 1 (char 0)
2025-12-23 21:43:35 - graphiti_core.llm_client.openai_generic_client - ERROR - Error in generating LLM response: Expecting value: line 1 column 1 (char 0)
2025-12-23 21:43:35 - graphiti_core.llm_client.openai_generic_client - WARNING - Retrying after application error (attempt 2/2): Expecting value: line 1 column 1 (char 0)
2025-12-23 21:43:50 - graphiti_core.llm_client.openai_generic_client - ERROR - Error in generating LLM response: Expecting value: line 1 column 1 (char 0)
2025-12-23 21:43:50 - graphiti_core.llm_client.openai_generic_client - ERROR - Max retries (2) exceeded. Last error: Expecting value: line 1 column 1 (char 0)
处理过程中出现错误: Expecting value: line 1 column 1 (char 0)

Configuration

# Relevant configuration or initialization code

Additional Context

  • Does this happen consistently or intermittently?
  • Which component are you using? (core library, REST server, MCP server)
  • Any recent changes to your environment?
  • Related issues or similar problems you've encountered?

Possible Solution

If you have ideas about what might be causing the issue or how to fix it, please share them here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions