Skip to content

Commit 8695e65

Browse files
Cast response to correct type
1 parent ec9d5b9 commit 8695e65

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

guardrails/applications/text2sql.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from string import Template
55
from typing import Callable, Dict, Optional, Type, cast
66

7+
from guardrails.classes import OT, ValidationOutcome
78
from guardrails.document_store import DocumentStoreBase, EphemeralDocumentStore
89
from guardrails.embedding import EmbeddingBase, OpenAIEmbedding
910
from guardrails.guard import Guard
@@ -199,6 +200,7 @@ def __call__(self, text: str) -> Optional[str]:
199200
},
200201
**self.llm_api_kwargs,
201202
)
203+
response = cast(ValidationOutcome[OT], response)
202204
validated_output: Dict = cast(Dict, response.validated_output)
203205
output = validated_output["generated_sql"]
204206
except TypeError:

0 commit comments

Comments
 (0)