Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update docs #658

Merged
merged 1 commit into from
Feb 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/evaluation/tutorials/testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ class Grade(TypedDict):
score: Annotated[
bool,
...,
"Return True if the answer is fully frounded in the source documents, otherwise False.",
"Return True if the answer is fully grounded in the source documents, otherwise False.",
]

judge_llm = init_chat_model("gpt-4o").with_structured_output(Grade)
Expand All @@ -644,7 +644,7 @@ def test_grounded_in_source_info() -> None:
result = agent.invoke({"messages": [{"role": "user", "content": query}]})

# Grab all the search calls made by the LLM
search_results = "\n\n".join(
search_results = "\\n\\n".join(
msg.content
for msg in result["messages"]
if msg.type == "tool" and msg.name == search_tool.name
Expand All @@ -666,8 +666,8 @@ def test_grounded_in_source_info() -> None:
"Return False if the ANSWER is not grounded in the DOCUMENTS."
)
answer_and_docs = (
f"ANSWER: {result['structured_response'].get('text_answer', '')}\n"
f"DOCUMENTS:\n{search_results}"
f"ANSWER: {result['structured_response'].get('text_answer', '')}\\n"
f"DOCUMENTS:\\n{search_results}"
)

# Run the judge LLM
Expand Down Expand Up @@ -1100,7 +1100,7 @@ class Grade(TypedDict):
score: Annotated[
bool,
...,
"Return True if the answer is fully frounded in the source documents, otherwise False.",
"Return True if the answer is fully grounded in the source documents, otherwise False.",
]

judge_llm = init_chat_model("gpt-4o").with_structured_output(Grade)
Expand All @@ -1114,7 +1114,7 @@ def test_grounded_in_source_info() -> None:
result = agent.invoke({"messages": [{"role": "user", "content": query}]})

# Grab all the search calls made by the LLM
search_results = "\n\n".join(
search_results = "\\n\\n".join(
msg.content
for msg in result["messages"]
if msg.type == "tool" and msg.name == search_tool.name
Expand All @@ -1136,8 +1136,8 @@ def test_grounded_in_source_info() -> None:
"Return False if the ANSWER is not grounded in the DOCUMENTS."
)
answer_and_docs = (
f"ANSWER: {result['structured_response'].get('text_answer', '')}\n"
f"DOCUMENTS:\n{search_results}"
f"ANSWER: {result['structured_response'].get('text_answer', '')}\\n"
f"DOCUMENTS:\\n{search_results}"
)

# Run the judge LLM
Expand Down
Loading