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

tests: start adding e2e tests #55

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

tests: start adding e2e tests #55

wants to merge 3 commits into from

Conversation

sd2k
Copy link
Collaborator

@sd2k sd2k commented Mar 21, 2025

Very WIP.

Comment on lines +60 to +134
response = await acompletion(
model=model,
messages=messages,
tools=tools,
)

# Check that there's a tool call.
assert isinstance(response, ModelResponse)
messages.extend(
await assert_and_handle_tool_call(response, mcp_client, "list_datasources")
)

# Call the LLM including the tool call result.
response = await acompletion(
model=model,
messages=messages,
tools=tools,
)

# Check that there's a tool call.
assert isinstance(response, ModelResponse)
messages.extend(
await assert_and_handle_tool_call(
response,
mcp_client,
"list_loki_label_names",
{"datasourceUid": "loki"},
)
)

# Call the LLM including the tool call result.
response = await acompletion(
model=model,
messages=messages,
tools=tools,
)

# Check that there's a tool call.
assert isinstance(response, ModelResponse)
messages.extend(
await assert_and_handle_tool_call(
response,
mcp_client,
"list_loki_label_values",
{"datasourceUid": "loki", "labelName": "container"},
)
)

# Call the LLM including the tool call result.
response = await acompletion(
model=model,
messages=messages,
tools=tools,
)

# Check that there's another tool call.
assert isinstance(response, ModelResponse)
messages.extend(
await assert_and_handle_tool_call(
response,
mcp_client,
"query_loki_logs",
{
"datasourceUid": "loki",
"logql": 'container="grafana"',
},
)
)

# Call the LLM including the tool call result.
response = await acompletion(
model=model,
messages=messages,
tools=tools,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be in the final test really, I just wanted to see how well stuff worked. If the model gets there without needing to call these exact tools then that's fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant