Skip to content

Commit

Permalink
Fix streamlit app errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hemajv committed Feb 29, 2024
1 parent 2e70c97 commit 15207d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def main(prompt_success: bool, prompt_diff: int, actual_doc: str):
help="Use Langchain Criteria based Eval to evaluate on cutsom criteria (this list can be updated based on what we are looking to see from the generated docs). Note this is language mo0del based evaluation and not always a true indication of the quality of the output that is generatged."
)

lc_score = eval_using_langchain(prompt, result)
lc_score = eval_using_langchain(result, prompt, actual_doc)
st.markdown(
f"Logical: {lc_score[0]['score']}",
help="Checks if the output is logical. Binary integer 0 to 1, where 1 would mean that the output is logical and 0 means it is not",
Expand Down Expand Up @@ -288,4 +288,4 @@ def main(prompt_success: bool, prompt_diff: int, actual_doc: str):
on_submit=store_feedback,
optional_text_label="Please tell us how we could make this more useful",
align="flex-start",
)
)
4 changes: 2 additions & 2 deletions app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def indicate_key_presence(env: str) -> str:
else:
return ""

def eval_using_langchain(prediction: str, query: str):
def eval_using_langchain(prediction: str, query: str, actual_doc: str):

evaluation = []
llm = ChatOpenAI(model="gpt-4", temperature=0)
Expand All @@ -256,7 +256,7 @@ def eval_using_langchain(prediction: str, query: str):

# 2
evaluator = load_evaluator("labeled_criteria", llm=llm, criteria="correctness")
eval_result = evaluator.evaluate_strings(prediction=generated_patch, input=prompt, reference=actual_doc)
eval_result = evaluator.evaluate_strings(prediction=prediction, input=query, reference=actual_doc)
evaluation.append(eval_result)

# 3
Expand Down

0 comments on commit 15207d9

Please sign in to comment.