Find answers from the community

Updated 6 days ago

Printing The Prompt That Goes To The Llm

Hey I am trying to use llama index with SQLTableRetrieverQueryEngine
how can i print the prompt that finallly goes to the llm
c
W
L
9 comments
class SQLTableRetrieverQueryEngine(BaseSQLTableQueryEngine):
"""SQL Table retriever query engine."""

def init(
self,
sql_database: SQLDatabase,
table_retriever: ObjectRetriever[SQLTableSchema],
rows_retrievers: Optional[dict[str, BaseRetriever]] = None,
llm: Optional[LLM] = None,
text_to_sql_prompt: Optional[BasePromptTemplate] = None,
context_query_kwargs: Optional[dict] = None,
synthesize_response: bool = True,
response_synthesis_prompt: Optional[BasePromptTemplate] = None,
refine_synthesis_prompt: Optional[BasePromptTemplate] = None,
context_str_prefix: Optional[str] = None,
sql_only: bool = False,
callback_manager: Optional[CallbackManager] = None,
kwargs: Any, ) -> None: """Initialize params.""" self._sql_retriever = NLSQLRetriever( sql_database, llm=llm, text_to_sql_prompt=text_to_sql_prompt, context_query_kwargs=context_query_kwargs, table_retriever=table_retriever, rows_retrievers=rows_retrievers, context_str_prefix=context_str_prefix, sql_only=sql_only, callback_manager=callback_manager, verbose=kwargs.get("verbose", False), ) super().init( synthesize_response=synthesize_response, response_synthesis_prompt=response_synthesis_prompt, refine_synthesis_prompt=refine_synthesis_prompt, llm=llm, callback_manager=callback_manager, kwargs,
)

@property
def sql_retriever(self) -> NLSQLRetriever:
"""Get SQL retriever."""
return self._sql_retriever
@Logan M Hey can u check the code above am not able to undersatnd how these parameters are being used query is generated by llm or who? and where are the embeddings being used?
I would suggest that you go through the docs and code for understand the code flow
am not able to get it thats the issue
You'll have to dig the code base
Embeddings are used in the retrievers. @WhiteFang_Jr is right though, if you want a deeper understanding, reading the source code is honestly super productive
i just want to know llm are used generating the sql or not?
Add a reply
Sign up and join the conversation on Discord