|
17 | 17 | Response, |
18 | 18 | StreamingResponse, |
19 | 19 | ) |
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 | +) |
21 | 26 | from llama_index.core.chat_engine import CondenseQuestionChatEngine |
22 | 27 | from llama_index.core.ingestion import IngestionPipeline |
23 | 28 | from llama_index.core.llms import LLM |
@@ -85,20 +90,22 @@ class Config: |
85 | 90 |
|
86 | 91 | @field_validator("chat_engine", mode="before") |
87 | 92 | def chat_engine_from_ingestion_pipeline( |
88 | | - cls, chat_engine: Any, values: Dict[str, Any] |
| 93 | + cls, chat_engine: Any, info: ValidationInfo |
89 | 94 | ) -> Optional[CondenseQuestionChatEngine]: |
90 | 95 | """ |
91 | 96 | If chat_engine is not provided, create one from ingestion_pipeline. |
92 | 97 | """ |
93 | 98 | if chat_engine is not None: |
94 | 99 | return chat_engine |
95 | 100 |
|
96 | | - ingestion_pipeline = cast(IngestionPipeline, values["ingestion_pipeline"]) |
| 101 | + ingestion_pipeline = cast( |
| 102 | + IngestionPipeline, info.data.get("ingestion_pipeline") |
| 103 | + ) |
97 | 104 | if ingestion_pipeline.vector_store is None: |
98 | 105 | return None |
99 | 106 |
|
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")) |
102 | 109 |
|
103 | 110 | # get embed_model from transformations if possible |
104 | 111 | embed_model = None |
|
0 commit comments