From coding wise.
Currently we have below code works well for local server.
Now, we set up a remote server on k8s.
We want below code works for remote server.
From the arize-phoenix code. My understand is do below two change is ok, is this right?
session = px.launch_app()
->
session = px.launch_app(host='remote server host')
2.
px.Client ->
px.Client(endpoint="https://arize.zscaler.site/tracing/)
def submit(self):
# TODO: change to support local server and remote server based on the server set
session = px.launch_app()
LangChainInstrumentor().instrument()
ai_dresult = {}
question_num = 0
for question, human_answer in self.question_answer_pool.items():
ai_answer = self.chat_app_run(question)
ai_dresult[question] = ai_answer
question_num += 1
logger.info(f"The evaluation based on dataset:{self.dataset_id}. {question_num} questions to run")
# log the traces
logger.info(f"Getting input, output and reference from traces ...")
input_output_df = get_qa_with_reference(px.Client())
input_output_df["correct_answer"] = input_output_df["input"].apply(
lambda x: self.question_answer_pool[x])
input_output_df["ai_answer"] = input_output_df["input"].apply(
lambda x: ai_dresult[x])
retrieved_documents_df = get_retrieved_documents(px.Client())
if self.evaluators_qa_with_reference:
evaluations_list = self.evaluators_qa_with_reference.values()
logger.info(f"Running evaluations: {evaluations_list}")
df_results = []
names = []
for name in self.evaluators_qa_with_reference.values():
df_results.append(f"result_of_{name}")
names.append(name)
df_results = run_evals(
dataframe=input_output_df,
evaluators=self.evaluators_qa_with_reference.keys(),
provide_explanation=True,
)
logger.info(f"Log evaluation results to UI for: {evaluations_list}")
for index, df_result in enumerate(df_results):
px.Client().log_evaluations(
SpanEvaluations(eval_name=names[index], dataframe=df_result)
)