8000 Testing tools by jameslong · Pull Request #7 · jameslong/vancouver · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Testing tools #7

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

Merged
merged 12 commits into from
Jun 11, 2025
Merged

Testing tools #7

merged 12 commits into from
Jun 11, 2025

Conversation

jameslong
Copy link
Owner
@jameslong jameslong commented Jun 11, 2025

This pull request introduces several enhancements and refactors to the Vancouver library, focusing on improving tool configuration, response handling, and test coverage. Key changes include dynamic tool assignment, updates to response structures, and the addition of comprehensive test modules for tools and their responses.

Tool Configuration and Routing Updates:

  • Updated config.ex and router.ex to allow dynamic tool assignment via the tools option, enabling more flexible routing configurations (README.md, lib/vancouver/router.ex). [1] [2]
  • Modified Vancouver.Plugs.Dispatch to retrieve tools from conn.assigns instead of application environment, improving request-specific tool handling (lib/vancouver/plugs/dispatch.ex).

Response Structure Refactors:

  • Refactored response structures in Vancouver.Tool to use string keys instead of atom keys for JSON compatibility (lib/vancouver/tool.ex). [1] [2] [3] [4]

New Tool and Testing Utilities:

  • Added Vancouver.Tools.TestResponse, a tool for testing various response types such as audio, text, image, and error responses (lib/vancouver/tools/test_response.ex).
  • Introduced Vancouver.ToolTest, a utility module providing helper functions for testing tool responses (lib/vancouver/test/tool_test.ex).

Test Suite Enhancements:

  • Added comprehensive tests for TestResponse and CalculateSum tools, ensuring correctness of tool responses under various scenarios (test/vancouver/tools/test_response_test.exs, test/vancouver/tools/calculate_sum_test.exs). [1] [2]
  • Included tests for Vancouver.ToolTest utilities to validate their behavior and error handling (test/vancouver/test/tool_test.exs).

These changes collectively improve the flexibility, reliability, and testability of the Vancouver library.

@jameslong jameslong self-assigned this Jun 11, 2025
@jameslong jameslong requested a review from Copilot June 11, 2025 21:11
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces testing utilities for tool modules, updates JSON response formatting in the core Vancouver.Tool, and modifies the router/dispatch pipeline to pass tool lists via assigns.

  • Add ExUnit tests for TestResponse and CalculateSum tools and shared test helpers in ToolTest
  • Change all send_* functions in Vancouver.Tool to emit string keys for JSON compatibility
  • Update router to use copy_opts_to_assign and read tool list from conn.assigns

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/vancouver/tools/test_response_test.exs Add tests for Vancouver.Tools.TestResponse responses
test/vancouver/tools/calculate_sum_test.exs Add basic test for Vancouver.Tools.CalculateSum running sum logic
test/vancouver/test/tool_test.exs Add shared helper functions and assertions for tool call and outputs
lib/vancouver/tools/test_response.ex Implement TestResponse tool with various response types
lib/vancouver/tool.ex Change JSON payload keys from atoms to strings in all send_* funcs
lib/vancouver/router.ex Use copy_opts_to_assign for passing router opts and compact DSL
lib/vancouver/plugs/pipeline.ex Minor formatting tweak in pipeline builder
lib/vancouver/plugs/dispatch.ex Read tool list from conn.assigns instead of application env
README.md Update config and routing example to pass tools via forward
Comments suppressed due to low confidence (2)

test/vancouver/test/tool_test.exs:1

  • [nitpick] The test module is named Vancouver.Test.ToolTest but the implementation module is Vancouver.ToolTest; consider renaming the test module (and its path) to Vancouver.ToolTest for consistency.
defmodule Vancouver.Test.ToolTest do

test/vancouver/tools/test_response_test.exs:48

  • The test uses JSON.encode! but there's no alias or import for JSON; add alias JSON or use the proper JSON module (e.g., Jason) to avoid undefined module errors.
|> conn("/", JSON.encode!(body))

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jameslong jameslong merged commit 3c3f331 into main Jun 11, 2025
@jameslong jameslong deleted the testing_tools branch June 11, 2025 21:30
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.

1 participant
0