Find answers from the community

Updated 4 months ago

hey guys cant find any documentation for

At a glance
hey guys, cant find any documentation for SQLTableRetrieverQueryEngine. i want to change the model to "gpt-3.5-turbo-16k-0613" but cant seem to insert this as a paramater:

Here's code (copied from https://gpt-index.readthedocs.io/en/latest/examples/index_structs/struct_indices/duckdb_sql_query.html#advanced-text-to-sql-with-our-sqltableretrieverqueryengine):

query_engine = SQLTableRetrieverQueryEngine(
sql_database,
obj_index.as_retriever(similarity_top_k=1),
)


just for reference i was able to do the same with the engine using the following code:

llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo-16k-0613", max_tokens=512, verbose = True))
service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor)

query_engine = NLSQLTableQueryEngine(
sql_database=sql_database,
tables=tables_selected,
service_context=service_context,
)
L
p
9 comments
I would just set a global service context (there's two spots to pass it in this case, global is just easier)

Plain Text
from llama_index import set_global_service_context

set_global_service_context(service_context)
oh! brilliant!!!
thanks a ton!
whats the best way to read and earn about all this ... can't seem to find detailed documentation
If our docs aren't enough, tbh I would just read source code lol

But tbh I think the docs are not bad
thanks! i think the confusion was more since is used NLSQLTableQueryEngine where i put the service_context inside the call itself:

query_engine = NLSQLTableQueryEngine(
sql_database=sql_database,
tables=tables_selected,
service_context=service_context,
)
So had a feeling that the same would work for SQLTableRetrieverQueryEngine, so got a bit confused
All good now!!! Thnaks again
Add a reply
Sign up and join the conversation on Discord