Skip to content

Commit 0ab268b

Browse files
authored
fixed pydantic type error in cli chat (#20869)
1 parent 64c7138 commit 0ab268b

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

llama-index-cli/llama_index/cli/rag/base.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
Response,
1818
StreamingResponse,
1919
)
20-
from llama_index.core.bridge.pydantic import BaseModel, Field, field_validator
20+
from llama_index.core.bridge.pydantic import (
21+
BaseModel,
22+
Field,
23+
ValidationInfo,
24+
field_validator,
25+
)
2126
from llama_index.core.chat_engine import CondenseQuestionChatEngine
2227
from llama_index.core.ingestion import IngestionPipeline
2328
from llama_index.core.llms import LLM
@@ -85,20 +90,22 @@ class Config:
8590

8691
@field_validator("chat_engine", mode="before")
8792
def chat_engine_from_ingestion_pipeline(
88-
cls, chat_engine: Any, values: Dict[str, Any]
93+
cls, chat_engine: Any, info: ValidationInfo
8994
) -> Optional[CondenseQuestionChatEngine]:
9095
"""
9196
If chat_engine is not provided, create one from ingestion_pipeline.
9297
"""
9398
if chat_engine is not None:
9499
return chat_engine
95100

96-
ingestion_pipeline = cast(IngestionPipeline, values["ingestion_pipeline"])
101+
ingestion_pipeline = cast(
102+
IngestionPipeline, info.data.get("ingestion_pipeline")
103+
)
97104
if ingestion_pipeline.vector_store is None:
98105
return None
99106

100-
verbose = cast(bool, values["verbose"])
101-
llm = cast(LLM, values["llm"])
107+
verbose = cast(bool, info.data.get("verbose"))
108+
llm = cast(LLM, info.data.get("llm"))
102109

103110
# get embed_model from transformations if possible
104111
embed_model = None

llama-index-cli/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dev = [
2626

2727
[project]
2828
name = "llama-index-cli"
29-
version = "0.5.4"
29+
version = "0.5.5"
3030
description = "llama-index cli"
3131
authors = [{name = "llamaindex"}]
3232
requires-python = ">=3.10,<4.0"

0 commit comments

Comments
 (0)