UnboundLocalError: local variable 'default_template' referenced before assignment
... ... query_wrapper_prompt = "[INST] {query_str} [/INST]" embed_model='local:BAAI/bge-base-en' server_url = os.getenv('TGIS_SERVER_URL', 'http://localhost') # Get server url from env else default server_port = os.getenv('TGIS_SERVER_PORT', '8049') # Get server port from env else default inference_server_url=f"{server_url}:{server_port}/" tgis_predictor = LangChainLLM( llm=HuggingFaceTextGenInference( inference_server_url=inference_server_url, max_new_tokens=256, temperature=temperature, repetition_penalty=repetition_penalty, server_kwargs={}, ), ) service_context = ServiceContext.from_defaults(chunk_size=1024, llm=tgis_predictor, embed_model=embed_model, query_wrapper_prompt=query_wrapper_prompt)
query_wrapper_prompt = Prompt("[INST] {query_str} [/INST]") ... service_context = ServiceContext.from_defaults(chunk_size=1024, llm=tgis_predictor, query_wrapper_prompt=query_wrapper_prompt, # system_prompt=system_prompt, embed_model=embed_model)
UnboundLocalError: local variable 'default_template' referenced before assignment
query_prompt
AND system_prompt
when declaring the service_context
, I don't get the errorservice_context = ServiceContext.from_defaults(chunk_size=1024, llm=tgis_predictor, query_wrapper_prompt=query_wrapper_prompt, system_prompt=system_prompt, embed_model=embed_model)
service_context = ServiceContext.from_defaults(chunk_size=1024, llm=tgis_predictor, query_wrapper_prompt=query_wrapper_prompt, embed_model=embed_model)