Find answers from the community

Updated 2 years ago

hey I wanted to build a tools

hey, I wanted to build a tools
where we call open ai directly to open ai without any context (no source is utilized)
the tool will used inside query_engine_tools parameter of RouterQueryEngine
can you please help
cc: @ravitheja @Logan M @jerryjliu0
S
L
5 comments
is this correct way
GPTVectorStoreIndex.from_documents([], service_context=service_context)
should I attach custom prompt too?
Plain Text
openai = GPTVectorStoreIndex.from_documents([], service_context=ServiceContext.from_defaults())
openai = openai.as_query_engine()
response = openai.query("tell me about narendra modi")

the above does not work. it gives None. 😣

can you please guide me how to build a q/a query_engine_tool for answering quesitons without context
which I can pass it query_engine_tools parameter of RouterQueryEngine
@Siddhant Saurabh you'll just want to use the raw openai completion endpoint.

Openai has many docs for this πŸ‘
Update: was able to build a basic agnet tool framework using RouterQueryEngine

hey, wanted to know if we can pass custom prompt in router_query_engine.query() for passing chat_history for better selction.
if yes, is it a good idea to pass chathistory and have custom prompt in router_query_engine.query
You'll have to set both the text_qa_template and the refine_template into the "as_query_engine()" call

It's up to you if you want to do that. Just need to be careful that the history doesn't get too big
Add a reply
Sign up and join the conversation on Discord