Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
model changed to Haiku 3.5 for query re=write
Browse files233 unmodified lines234235236237238239240241242243244245233 unmodified linesif(query == ""):query = st.session_state.input_rekog_labelif(st.session_state.input_is_rewrite_query == 'enabled'):res = invoke_models.invoke_llm_model( prompt_.format(query=query,schema = schema) ,False)inter_query = res[7:-3].replace('\\"',"'").replace("\n","")query_struct = StructuredQueryOutputParser.from_components().parse(inter_query)opts = OpenSearchTranslator()result_query_llm = opts.visit_structured_query(query_struct)[1]['filter']draft_new_query = {'bool':{'should':[],'must':[]}}if('bool' in result_query_llm and ('must' in result_query_llm['bool'] or 'should' in result_query_llm['bool'])):#draft_new_query['bool']['should'] = []233 unmodified lines234235236237238239240241242243244245246247248249250233 unmodified linesif(query == ""):query = st.session_state.input_rekog_labelif(st.session_state.input_is_rewrite_query == 'enabled'):import timestart = time.time()res = invoke_models.invoke_llm_model( prompt_.format(query=query,schema = schema) ,False)print(f"Claude latency: {time.time() - start:.2f} sec")inter_query = res[7:-3].replace('\\"',"'").replace("\n","")start = time.time()query_struct = StructuredQueryOutputParser.from_components().parse(inter_query)opts = OpenSearchTranslator()result_query_llm = opts.visit_structured_query(query_struct)[1]['filter']print(f"Langchain latency: {time.time() - start:.2f} sec")draft_new_query = {'bool':{'should':[],'must':[]}}if('bool' in result_query_llm and ('must' in result_query_llm['bool'] or 'should' in result_query_llm['bool'])):#draft_new_query['bool']['should'] = []
semantic_search/query_rewrite.py+5