Skip to content

feat: move tests to dedicated directory and update README structure#81

Merged
akshaydeo merged 1 commit intomainfrom
06-14-feat_tests_added_for_core-providers_in_root_dir
Jun 16, 2025
Merged

feat: move tests to dedicated directory and update README structure#81
akshaydeo merged 1 commit intomainfrom
06-14-feat_tests_added_for_core-providers_in_root_dir

Conversation

@Pratham-Mishra04
Copy link
Copy Markdown
Collaborator

Reorganize Test Structure and Update Project Layout

This PR reorganizes the test structure by moving all provider tests from the core module to a dedicated tests/core-providers directory. This change improves the project organization and separates test code from the core implementation.

Key changes:

  • Created a new tests/core-providers directory with comprehensive test suite for all supported providers
  • Added detailed documentation in tests/core-providers/README.md explaining how to run tests
  • Removed test dependencies from core/go.mod (godotenv, testify, etc.)
  • Updated README.md to include the new tests directory in the project structure
  • Expanded model lists in the example configuration
  • Fixed OpenAI router path from /openai/v1/chat/completions to /openai/chat/completions

The new test structure provides better organization and makes it easier to run tests for specific providers or scenarios. The comprehensive test suite covers all major functionality including chat completion, tool calling, image processing, and multi-turn conversations.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 14, 2025

Warning

Rate limit exceeded

@Pratham-Mishra04 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 20 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 1541d1b and a93c48d.

⛔ Files ignored due to path filters (2)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (45)
  • README.md (1 hunks)
  • core/go.mod (0 hunks)
  • core/tests/account.go (0 hunks)
  • core/tests/anthropic_test.go (0 hunks)
  • core/tests/azure_test.go (0 hunks)
  • core/tests/bedrock_test.go (0 hunks)
  • core/tests/cohere_test.go (0 hunks)
  • core/tests/e2e_tool_test.go (0 hunks)
  • core/tests/mistral_test.go (0 hunks)
  • core/tests/ollama_test.go (0 hunks)
  • core/tests/openai_test.go (0 hunks)
  • core/tests/setup.go (0 hunks)
  • core/tests/tests.go (0 hunks)
  • core/tests/vertex_test.go (0 hunks)
  • docs/providers.md (1 hunks)
  • tests/core-providers/README.md (1 hunks)
  • tests/core-providers/anthropic_test.go (1 hunks)
  • tests/core-providers/azure_test.go (1 hunks)
  • tests/core-providers/bedrock_test.go (1 hunks)
  • tests/core-providers/cohere_test.go (1 hunks)
  • tests/core-providers/config/account.go (1 hunks)
  • tests/core-providers/config/setup.go (1 hunks)
  • tests/core-providers/go.mod (1 hunks)
  • tests/core-providers/mistral_test.go (1 hunks)
  • tests/core-providers/ollama_test.go (1 hunks)
  • tests/core-providers/openai_test.go (1 hunks)
  • tests/core-providers/scenarios/automatic_function_calling.go (1 hunks)
  • tests/core-providers/scenarios/complete_end_to_end.go (1 hunks)
  • tests/core-providers/scenarios/end_to_end_tool_calling.go (1 hunks)
  • tests/core-providers/scenarios/image_base64.go (1 hunks)
  • tests/core-providers/scenarios/image_url.go (1 hunks)
  • tests/core-providers/scenarios/multi_turn_conversation.go (1 hunks)
  • tests/core-providers/scenarios/multiple_images.go (1 hunks)
  • tests/core-providers/scenarios/multiple_tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/provider_specific.go (1 hunks)
  • tests/core-providers/scenarios/simple_chat.go (1 hunks)
  • tests/core-providers/scenarios/text_completion.go (1 hunks)
  • tests/core-providers/scenarios/tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/utils.go (1 hunks)
  • tests/core-providers/tests.go (1 hunks)
  • tests/core-providers/vertex_test.go (1 hunks)
  • transports/README.md (1 hunks)
  • transports/bifrost-http/integrations/openai/router.go (1 hunks)
  • transports/bifrost-http/lib/config.go (1 hunks)
  • transports/config.example.json (3 hunks)

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive test suite for core AI providers, adding detailed test scenarios for OpenAI, Anthropic, Azure, Bedrock, Cohere, Vertex, Mistral, and Ollama.
    • Added extensive documentation for running, configuring, and troubleshooting provider tests.
    • Expanded configuration and utility support for multi-provider, multi-scenario testing, including image, tool call, and conversation flows.
  • Bug Fixes

    • Corrected environment variable names for Bedrock provider configuration in documentation and example files.
  • Refactor

    • Migrated and restructured provider integration tests and utilities to a new organized directory under tests/core-providers.
    • Updated and expanded supported model lists for OpenAI and Anthropic providers.
  • Chores

    • Updated dependencies and cleaned up Go module requirements.
    • Removed obsolete and redundant test files from the previous test structure.
      """

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive provider test suite with expanded scenarios for OpenAI, Anthropic, Azure, Bedrock, Cohere, and Vertex AI integrations.
    • Added detailed documentation for running and troubleshooting provider tests.
  • Bug Fixes

    • Corrected environment variable references for Bedrock secret access key in documentation and configuration examples.
    • Updated OpenAI chat completions endpoint path for improved compatibility.
  • Chores

    • Migrated and refactored provider tests into a new, organized directory structure.
    • Updated and expanded configuration examples for supported models across providers.
    • Removed legacy test files and outdated dependencies.

Walkthrough

This update restructures and enhances the Bifrost test suite by migrating and expanding provider integration tests from core/tests to a new, comprehensive tests/core-providers directory. It introduces scenario-based, modular tests for all supported AI providers, updates documentation, corrects configuration environment variables, and removes legacy test files and dependencies.

Changes

File(s) Change Summary
README.md, transports/README.md, docs/providers.md Updated documentation to reflect new test directory and corrected environment variable names for Bedrock secret access key.
core/go.mod Removed direct and indirect test dependencies (godotenv, testify, etc.).
core/tests/* Deleted legacy provider integration tests, test utilities, and test setup files.
transports/config.example.json, transports/bifrost-http/lib/config.go Corrected Bedrock secret access key environment variable from BEDROCK_ACCESS_KEY to AWS_SECRET_ACCESS_KEY and expanded OpenAI/Anthropic model lists.
transports/bifrost-http/integrations/openai/router.go Changed OpenAI chat completions route path from /openai/v1/chat/completions to /openai/chat/completions.
tests/core-providers/README.md Added detailed documentation for the new core providers test suite, including setup, scenarios, and troubleshooting.
tests/core-providers/go.mod Introduced a new Go module for the test suite with necessary dependencies and a replace directive for local development.
tests/core-providers/*_test.go Added scenario-based integration tests for OpenAI, Anthropic, Azure, Bedrock, Cohere, Vertex, Mistral, and Ollama providers.
tests/core-providers/config/account.go, config/setup.go Added comprehensive test account, configuration, and setup utilities supporting multiple providers and scenarios.
tests/core-providers/scenarios/*.go Introduced modular scenario test functions for text completion, chat, tool calls, image handling, end-to-end flows, and provider-specific features.
tests/core-providers/tests.go Added test orchestrator to run all scenarios and print a summary for each provider configuration.

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner
    participant Config
    participant BifrostClient
    participant ProviderAPI

    TestRunner->>Config: Load ComprehensiveTestConfig for Provider
    TestRunner->>BifrostClient: SetupTest() (returns client, ctx)
    loop For Each Scenario
        TestRunner->>BifrostClient: Build Request (scenario-specific)
        BifrostClient->>ProviderAPI: Send request (chat/text/image/tool call)
        ProviderAPI-->>BifrostClient: Return response
        BifrostClient-->>TestRunner: Pass response
        TestRunner->>TestRunner: Validate response/assertions
    end
    TestRunner->>TestRunner: Print Test Summary
Loading

Possibly related PRs

Suggested reviewers

  • danpiths
  • akshaydeo

Poem

In burrows deep, we test and leap,
Providers six, our code we keep.
Scenarios new, the tests now run,
With images, tools, and chats—what fun!
Configs tidy, docs anew,
This rabbit’s proud of all we do!
🐇✨
"""

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch 06-14-feat_tests_added_for_core-providers_in_root_dir
  • Post Copyable Unit Tests in Comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Collaborator Author

Pratham-Mishra04 commented Jun 14, 2025

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 37

🔭 Outside diff range comments (1)
README.md (1)

227-235: 🧹 Nitpick (assertive)

Out-of-date directory listing – core/tests is obsolete

The new test suite now lives under tests/ but the table still lists the old core/tests/ folder (line 227).
Leaving both will mislead contributors.

-│   ├── tests/            # Tests to make sure everything is in place
+│   ├── tests/            # (deprecated) legacy tests – will be removed
...
-├── tests/                # All test setups related to /core and /transports
+├── tests/                # All provider & transport tests (new home)

Please align both bullet points or remove the stale one.

♻️ Duplicate comments (3)
tests/core-providers/anthropic_test.go (1)

19-42: 🧹 Nitpick (assertive)

Avoid package shadowing (config).

Use a different variable name (cfg) and update the call to runAllComprehensiveTests.

tests/core-providers/openai_test.go (1)

19-42: 🧹 Nitpick (assertive)

Rename shadowing variable config to cfg.

tests/core-providers/azure_test.go (1)

19-42: 🧹 Nitpick (assertive)

Variable shadowing of config. Rename to cfg.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f230f29 and 2300230.

⛔ Files ignored due to path filters (2)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (38)
  • README.md (1 hunks)
  • core/go.mod (0 hunks)
  • core/tests/account.go (0 hunks)
  • core/tests/anthropic_test.go (0 hunks)
  • core/tests/azure_test.go (0 hunks)
  • core/tests/bedrock_test.go (0 hunks)
  • core/tests/cohere_test.go (0 hunks)
  • core/tests/e2e_tool_test.go (0 hunks)
  • core/tests/openai_test.go (0 hunks)
  • core/tests/setup.go (0 hunks)
  • core/tests/tests.go (0 hunks)
  • core/tests/vertex_test.go (0 hunks)
  • tests/core-providers/README.md (1 hunks)
  • tests/core-providers/anthropic_test.go (1 hunks)
  • tests/core-providers/azure_test.go (1 hunks)
  • tests/core-providers/bedrock_test.go (1 hunks)
  • tests/core-providers/cohere_test.go (1 hunks)
  • tests/core-providers/config/account.go (1 hunks)
  • tests/core-providers/config/setup.go (1 hunks)
  • tests/core-providers/go.mod (1 hunks)
  • tests/core-providers/openai_test.go (1 hunks)
  • tests/core-providers/scenarios/automatic_function_calling.go (1 hunks)
  • tests/core-providers/scenarios/complete_end_to_end.go (1 hunks)
  • tests/core-providers/scenarios/end_to_end_tool_calling.go (1 hunks)
  • tests/core-providers/scenarios/image_base64.go (1 hunks)
  • tests/core-providers/scenarios/image_url.go (1 hunks)
  • tests/core-providers/scenarios/multi_turn_conversation.go (1 hunks)
  • tests/core-providers/scenarios/multiple_images.go (1 hunks)
  • tests/core-providers/scenarios/multiple_tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/provider_specific.go (1 hunks)
  • tests/core-providers/scenarios/simple_chat.go (1 hunks)
  • tests/core-providers/scenarios/text_completion.go (1 hunks)
  • tests/core-providers/scenarios/tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/utils.go (1 hunks)
  • tests/core-providers/tests.go (1 hunks)
  • tests/core-providers/vertex_test.go (1 hunks)
  • transports/bifrost-http/integrations/openai/router.go (1 hunks)
  • transports/config.example.json (3 hunks)
💤 Files with no reviewable changes (11)
  • core/go.mod
  • core/tests/vertex_test.go
  • core/tests/openai_test.go
  • core/tests/azure_test.go
  • core/tests/cohere_test.go
  • core/tests/setup.go
  • core/tests/bedrock_test.go
  • core/tests/anthropic_test.go
  • core/tests/tests.go
  • core/tests/e2e_tool_test.go
  • core/tests/account.go
🧰 Additional context used
🧬 Code Graph Analysis (11)
tests/core-providers/scenarios/image_base64.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (3)
  • CreateImageMessage (81-99)
  • TestImageBase64 (69-69)
  • GetResultContent (113-129)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/cohere_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (42-50)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Cohere (43-43)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/azure_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (42-50)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Azure (40-40)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/scenarios/end_to_end_tool_calling.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (4)
  • CreateBasicChatMessage (72-79)
  • WeatherToolDefinition (9-29)
  • CreateToolMessage (101-111)
  • GetResultContent (113-129)
core/schemas/bifrost.go (7)
  • ModelParameters (80-94)
  • Tool (113-117)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • BifrostMessage (148-156)
  • AssistantMessage (221-226)
  • Function (106-110)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/tool_calls.go (5)
core/bifrost.go (2)
  • Bifrost (39-51)
  • ChatCompletionRequest (24-24)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (7)
  • BifrostMessage (148-156)
  • ModelParameters (80-94)
  • Tool (113-117)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • AssistantMessage (221-226)
  • Function (106-110)
tests/core-providers/scenarios/utils.go (3)
  • CreateBasicChatMessage (72-79)
  • WeatherToolDefinition (9-29)
  • GetResultContent (113-129)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/multiple_tool_calls.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (3)
  • CreateBasicChatMessage (72-79)
  • WeatherToolDefinition (9-29)
  • GetResultContent (113-129)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/image_url.go (5)
core/bifrost.go (2)
  • Bifrost (39-51)
  • ChatCompletionRequest (24-24)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (4)
  • BifrostMessage (148-156)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • ModelParameters (80-94)
tests/core-providers/scenarios/utils.go (3)
  • CreateImageMessage (81-99)
  • TestImageURL (68-68)
  • GetResultContent (113-129)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/multi_turn_conversation.go (5)
core/bifrost.go (2)
  • Bifrost (39-51)
  • ChatCompletionRequest (24-24)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (4)
  • BifrostMessage (148-156)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • ModelParameters (80-94)
tests/core-providers/scenarios/utils.go (2)
  • CreateBasicChatMessage (72-79)
  • GetResultContent (113-129)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/simple_chat.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (4)
  • BifrostMessage (148-156)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • ModelParameters (80-94)
tests/core-providers/scenarios/utils.go (2)
  • CreateBasicChatMessage (72-79)
  • GetResultContent (113-129)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/text_completion.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (3)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • ModelParameters (80-94)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/utils.go (1)
  • GetResultContent (113-129)
tests/core-providers/scenarios/utils.go (2)
core/schemas/bifrost.go (13)
  • Tool (113-117)
  • Function (106-110)
  • FunctionParameters (97-103)
  • BifrostMessage (148-156)
  • ModelChatMessageRoleUser (29-29)
  • MessageContent (158-161)
  • ContentBlock (209-213)
  • ContentBlockTypeText (205-205)
  • ContentBlockTypeImage (206-206)
  • ImageURLStruct (229-232)
  • ModelChatMessageRoleTool (32-32)
  • ToolMessage (216-218)
  • BifrostResponse (237-247)
core/utils.go (1)
  • Ptr (5-7)
🪛 LanguageTool
tests/core-providers/README.md

[grammar] ~20-~20: The word ‘replace’ is a verb. Did you mean the noun “replacement”?
Context: ... test your changes: 1. Uncomment the replace directive in `tests/core-providers/go...

(PREPOSITION_VERB)


[grammar] ~166-~166: This phrase is duplicated. You should probably use “Text Completion” only once.
Context: ...- Streaming Chat Completion - Streaming Text Completion - Text Completion with Parameters - Chat Completion with ...

(PHRASE_REPETITION)

🔇 Additional comments (11)
transports/bifrost-http/integrations/openai/router.go (1)

21-23: Endpoint prefix diverges from public docs & examples

The route was changed to /openai/chat/completions, but README.md (line 88) still shows /v1/chat/completions.
Either restore the /v1 prefix here or update every public reference (docs, SDKs, tests) to avoid 404s in production.

-Path: "/openai/chat/completions",
+Path: "/openai/v1/chat/completions",

If the new path is intentional, please remove the version prefix consistently and add a redirect for backward compatibility.

transports/config.example.json (1)

108-118: Azure deployment mapping incomplete

You added many GPT-4* model names but still map only gpt-4o to a deployment (line 131).
Requests for the other models will fail without "deployments" entries.

Consider generating the map automatically or documenting the need for per-model deployment IDs.

tests/core-providers/vertex_test.go (1)

37-40: Fallback model realism

Same fictional claude-3-7-sonnet-20250219 appears here. Tests that rely on real provider responses will fail. Update to an existing model or stub the network layer.

tests/core-providers/config/setup.go (1)

25-33: Comment claims to “load environment variables” but code doesn’t.

Either implement the loading (e.g. os.LookupEnv, dotenv, etc.) or drop the bullet from the doc-comment to keep documentation accurate.

tests/core-providers/scenarios/multiple_images.go (1)

38-42: Base64 image is injected via ImageURL.URL – verify provider expectations

Some providers distinguish between:

  • url – for remote images
  • b64_json / data: URIs – for inline images

Placing a data:image/...;base64, string in URL works only if the provider accepts data URIs.
If any target provider rejects this, expose a dedicated field (e.g., Base64Data) or send two separate requests.

tests/core-providers/scenarios/end_to_end_tool_calling.go (1)

59-65: ⚠️ Potential issue

Same pointer-dereference issue when deriving toolCallID.

-		if toolCall.ID != nil {
-			toolCallID = *toolCall.ID
-		} else {
-			toolCallID = *toolCall.Function.Name
-		}
+		if toolCall.ID != nil {
+			toolCallID = *toolCall.ID
+		} else {
+			toolCallID = toolCall.Function.Name
+		}

Likely an incorrect or invalid review comment.

tests/core-providers/scenarios/tool_calls.go (1)

53-55: ⚠️ Potential issue

Avoid nil check / pointer assert on a non-pointer Name field.

assert.NotNil on a string is always true. Use NotEmpty and drop the * operator.

-			assert.NotNil(t, toolCall.Function.Name)
-			assert.Equal(t, "get_weather", *toolCall.Function.Name)
+			assert.NotEmpty(t, toolCall.Function.Name)
+			assert.Equal(t, "get_weather", toolCall.Function.Name)

Likely an incorrect or invalid review comment.

tests/core-providers/scenarios/multi_turn_conversation.go (1)

15-74: Multi-turn conversation test looks solid

The scenario captures context carry-over correctly, checks both turns, and guards against empty responses. Nicely done.

tests/core-providers/README.md (1)

161-168: 🧹 Nitpick (assertive)

Duplicate bullet “Text Completion”

Streaming Text Completion is immediately followed by Text Completion with Parameters, making the preceding plain Text Completion bullet redundant.

-- Streaming Text Completion
-- Text Completion with Parameters
+- Streaming Text Completion with Parameters

Likely an incorrect or invalid review comment.

🧰 Tools
🪛 LanguageTool

[grammar] ~166-~166: This phrase is duplicated. You should probably use “Text Completion” only once.
Context: ...- Streaming Chat Completion - Streaming Text Completion - Text Completion with Parameters - Chat Completion with ...

(PHRASE_REPETITION)

tests/core-providers/config/account.go (2)

129-140: Bedrock meta-config lacks AccessKeyID

meta.BedrockMetaConfig usually expects both AccessKeyID and SecretAccessKey.
Supplying only the secret will fail SigV4 signing.

Please add:

-			MetaConfig: &meta.BedrockMetaConfig{
-				SecretAccessKey: os.Getenv("BEDROCK_ACCESS_KEY"),
-				Region:          bifrost.Ptr("us-east-1"),
-			},
+			MetaConfig: &meta.BedrockMetaConfig{
+				AccessKeyID:     os.Getenv("BEDROCK_ACCESS_KEY_ID"),
+				SecretAccessKey: os.Getenv("BEDROCK_ACCESS_KEY"),
+				Region:          bifrost.Ptr("us-east-1"),
+			},

…and fail fast if either env-var is absent.


194-327: Verify that all referenced model names are currently available

Models such as "claude-3-7-sonnet-20250219" and "gpt-4o-mini" have not been publicly announced at the time of writing and could be placeholders.
If these strings are incorrect, every integration test for the respective provider will fail at runtime.

Please double-check the catalogue for each provider or gate the config behind an env var that allows easy override.

Comment thread tests/core-providers/go.mod
Comment thread tests/core-providers/go.mod
Comment thread transports/config.example.json
Comment thread transports/config.example.json
Comment thread tests/core-providers/vertex_test.go Outdated
Comment thread tests/core-providers/scenarios/automatic_function_calling.go Outdated
Comment thread tests/core-providers/scenarios/utils.go
Comment thread tests/core-providers/scenarios/utils.go Outdated
Comment thread tests/core-providers/config/account.go
Comment thread tests/core-providers/config/account.go
@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 06-14-feat_tests_added_for_core-providers_in_root_dir branch from 2300230 to 33fdcfc Compare June 16, 2025 04:02
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 21

🔭 Outside diff range comments (1)
README.md (1)

223-235: 🧹 Nitpick (assertive)

Repository tree now lists two test locations – pick one to avoid confusion

core/tests is still shown while a new top-level tests/ folder is introduced. Having both in the diagram will mis-lead newcomers about the canonical place for tests.

-│   ├── tests/            # Tests to make sure everything is in place
+│   ├── tests/            # (legacy) will be removed in a future release-├── tests/                # All test setups related to /core and /transports
+├── tests/                # New unified test-suite for core + transports

Either remove the first entry or annotate the difference explicitly.

♻️ Duplicate comments (22)
tests/core-providers/config/setup.go (2)

1-1: Package comment still starts with “Package main”.
The earlier remark hasn’t been addressed; please change the first sentence to start with Package config to satisfy Go-doc conventions.


48-49: Hard-coded 300 × time.Second should be a named constant.
Defining a constant (e.g. comprehensiveTimeout := 5 * time.Minute) improves readability and discoverability.

tests/core-providers/scenarios/image_base64.go (2)

33-37: 🛠️ Refactor suggestion

Custom parameters are silently ignored – please merge them

The scenario discards config.CustomParams, so any caller-supplied provider-specific knobs (e.g. "image_input_type": "base64") never reach the API.

-			Params: &schemas.ModelParameters{
-				MaxTokens: bifrost.Ptr(200),
-			},
+			Params: mergeParams(
+				&schemas.ModelParameters{MaxTokens: bifrost.Ptr(200)},
+				config.CustomParams,
+			),

Implement mergeParams (or similar) that shallow-copies defaults and overlays the non-nil fields from config.CustomParams.
This pattern is used in several scenarios – consider adding it to a shared helper.


1-13: 🧹 Nitpick (assertive)

Variable shadowing of the imported config package

The parameter named config hides the imported alias config, making it impossible to call helpers from that package inside the function body and reducing readability.
Renaming the parameter (e.g. cfg) would remove the shadowing and align with the change already applied in bedrock_test.go.

tests/core-providers/scenarios/provider_specific.go (1)

29-36: 🛠️ Refactor suggestion

Partial overrides drop sensible defaults – merge instead of replace

Choosing between either config.CustomParams or hard-coded defaults means callers cannot override a single field (temperature, top_p, …) without losing the default MaxTokens.

-	var params *schemas.ModelParameters
-	if config.CustomParams != nil {
-		params = config.CustomParams
-	} else {
-		params = &schemas.ModelParameters{
-			MaxTokens: bifrost.Ptr(150),
-		}
-	}
+	params := mergeParams(
+		&schemas.ModelParameters{MaxTokens: bifrost.Ptr(150)},
+		config.CustomParams,
+	)

Same helper can be shared across scenarios.

tests/core-providers/scenarios/image_url.go (1)

48-50: 🧹 Nitpick (assertive)

Avoid duplicate allocations – compute lowerContent once

-	assert.True(t, strings.Contains(strings.ToLower(content), "ant") ||
-		strings.Contains(strings.ToLower(content), "insect"),
+	lowerContent := strings.ToLower(content)
+	assert.True(t, strings.Contains(lowerContent, "ant") ||
+		strings.Contains(lowerContent, "insect"),
tests/core-providers/scenarios/simple_chat.go (1)

39-41: Use require.NoErrorf instead of require.Nilf for error assertions
Idiomatic Go tests assert no error, not that the error is nil. This avoids confusion if the type of err ever changes.

-		require.Nilf(t, err, "Simple chat failed: %v", err)
+		require.NoErrorf(t, err, "Simple chat failed: %v", err)
tests/core-providers/scenarios/end_to_end_tool_calling.go (3)

44-46: Swap require.Nilf for require.NoErrorf
Same rationale as in previous reviews – clearer intent and idiomatic.

-		require.Nilf(t, err, "First request failed: %v", err)
+		require.NoErrorf(t, err, "First request failed: %v", err)

54-56: 🛠️ Refactor suggestion

Remove illegal pointer-dereference on Function.Name
Function.Name is a string, not *string; dereferencing will not compile and the preceding NotNil check is meaningless for a string.

-		require.NotNil(t, toolCall.Function.Name)
-		assert.Equal(t, "get_weather", *toolCall.Function.Name)
+		assert.NotEmpty(t, toolCall.Function.Name)
+		assert.Equal(t, "get_weather", toolCall.Function.Name)

60-65: 🛠️ Refactor suggestion

Fix toolCallID assignment – same pointer issue

-		} else {
-			toolCallID = *toolCall.Function.Name
+		} else {
+			toolCallID = toolCall.Function.Name
tests/core-providers/scenarios/tool_calls.go (1)

44-46: Prefer require.NoErrorf over require.Nilf

-		require.Nilf(t, err, "Tool calls failed: %v", err)
+		require.NoErrorf(t, err, "Tool calls failed: %v", err)
tests/core-providers/scenarios/complete_end_to_end.go (3)

40-41: Use require.NoErrorf for the first request

-		require.Nilf(t, err, "First end-to-end request failed: %v", err)
+		require.NoErrorf(t, err, "First end-to-end request failed: %v", err)

88-89: Use require.NoErrorf for the final request

-		require.Nilf(t, err, "Final end-to-end request failed: %v", err)
+		require.NoErrorf(t, err, "Final end-to-end request failed: %v", err)

61-62: 🛠️ Refactor suggestion

Remove bad pointer dereference on Function.Name

-					toolCallID = *toolCalls[0].Function.Name
+					toolCallID = toolCalls[0].Function.Name
tests/core-providers/scenarios/text_completion.go (1)

35-37: Replace require.Nilf with require.NoErrorf

-		require.Nilf(t, err, "Text completion failed: %v", err)
+		require.NoErrorf(t, err, "Text completion failed: %v", err)
tests/core-providers/scenarios/multiple_tool_calls.go (2)

27-30: 🛠️ Refactor suggestion

ParallelToolCalls flag missing & duplicated tool entries may be deduplicated by providers

Using the same WeatherToolDefinition twice does not guarantee ≥2 calls—several providers silently deduplicate identical tools. Prefer one instance plus ParallelToolCalls: bifrost.Ptr(true) to make intent explicit:

-	params := schemas.ModelParameters{
-		Tools:     &[]schemas.Tool{WeatherToolDefinition, WeatherToolDefinition},
-		MaxTokens: bifrost.Ptr(200),
-	}
+	params := schemas.ModelParameters{
+		Tools:             &[]schemas.Tool{WeatherToolDefinition},
+		ParallelToolCalls: bifrost.Ptr(true),
+		MaxTokens:         bifrost.Ptr(200),
+	}

48-58: ⚠️ Potential issue

Test silently passes when no tool calls are returned

If AssistantMessage.ToolCalls is nil, the test only logs a message. This hides real regressions. Fail fast instead:

-		} else {
-			t.Logf("No tool calls found, response: %s", GetResultContent(response))
+		} else {
+			t.Fatalf("expected ≥2 tool calls but got none – raw response: %s", GetResultContent(response))
 		}
tests/core-providers/scenarios/automatic_function_calling.go (1)

62-65: ⚠️ Potential issue

Absence of automatic function call should fail the test, not just log

The else branch still only logs; scenarios advertising automatic function calling must fail if no call is present.

-		} else {
-			t.Logf("❌ No automatic tool calls, response: %s", GetResultContent(response))
+		} else {
+			t.Fatalf("expected automatic tool call, got plain response: %s", GetResultContent(response))
 		}
tests/core-providers/scenarios/utils.go (2)

101-111: Use bifrost.Ptr for consistency when taking the address of toolCallID.

As previously noted, this should use bifrost.Ptr(toolCallID) instead of &toolCallID to maintain consistency with the rest of the codebase.


113-129: Use strings.Builder for more efficient string concatenation.

As previously noted, using += in a loop for string concatenation is inefficient. Consider using strings.Builder for better performance with multiple content blocks.

tests/core-providers/config/account.go (2)

52-105: Validate API keys and return errors for missing environment variables.

As previously noted, when environment variables are not set, os.Getenv returns empty strings which lead to confusing 401/403 errors during test execution. Add validation to check if keys are empty and return descriptive errors instead.


150-169: Make Azure API version configurable to avoid test brittleness.

As previously noted, the hardcoded preview API version "2024-08-01-preview" may be deprecated or changed by Azure, causing test failures. Consider reading from an environment variable with a default fallback.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2300230 and 33fdcfc.

⛔ Files ignored due to path filters (2)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (38)
  • README.md (1 hunks)
  • core/go.mod (0 hunks)
  • core/tests/account.go (0 hunks)
  • core/tests/anthropic_test.go (0 hunks)
  • core/tests/azure_test.go (0 hunks)
  • core/tests/bedrock_test.go (0 hunks)
  • core/tests/cohere_test.go (0 hunks)
  • core/tests/e2e_tool_test.go (0 hunks)
  • core/tests/openai_test.go (0 hunks)
  • core/tests/setup.go (0 hunks)
  • core/tests/tests.go (0 hunks)
  • core/tests/vertex_test.go (0 hunks)
  • tests/core-providers/README.md (1 hunks)
  • tests/core-providers/anthropic_test.go (1 hunks)
  • tests/core-providers/azure_test.go (1 hunks)
  • tests/core-providers/bedrock_test.go (1 hunks)
  • tests/core-providers/cohere_test.go (1 hunks)
  • tests/core-providers/config/account.go (1 hunks)
  • tests/core-providers/config/setup.go (1 hunks)
  • tests/core-providers/go.mod (1 hunks)
  • tests/core-providers/openai_test.go (1 hunks)
  • tests/core-providers/scenarios/automatic_function_calling.go (1 hunks)
  • tests/core-providers/scenarios/complete_end_to_end.go (1 hunks)
  • tests/core-providers/scenarios/end_to_end_tool_calling.go (1 hunks)
  • tests/core-providers/scenarios/image_base64.go (1 hunks)
  • tests/core-providers/scenarios/image_url.go (1 hunks)
  • tests/core-providers/scenarios/multi_turn_conversation.go (1 hunks)
  • tests/core-providers/scenarios/multiple_images.go (1 hunks)
  • tests/core-providers/scenarios/multiple_tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/provider_specific.go (1 hunks)
  • tests/core-providers/scenarios/simple_chat.go (1 hunks)
  • tests/core-providers/scenarios/text_completion.go (1 hunks)
  • tests/core-providers/scenarios/tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/utils.go (1 hunks)
  • tests/core-providers/tests.go (1 hunks)
  • tests/core-providers/vertex_test.go (1 hunks)
  • transports/bifrost-http/integrations/openai/router.go (1 hunks)
  • transports/config.example.json (3 hunks)
💤 Files with no reviewable changes (11)
  • core/tests/bedrock_test.go
  • core/tests/cohere_test.go
  • core/tests/openai_test.go
  • core/tests/vertex_test.go
  • core/tests/setup.go
  • core/tests/anthropic_test.go
  • core/go.mod
  • core/tests/e2e_tool_test.go
  • core/tests/account.go
  • core/tests/tests.go
  • core/tests/azure_test.go
🧰 Additional context used
🧠 Learnings (3)
transports/config.example.json (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: transports/config.example.json:36-42
Timestamp: 2025-06-16T03:55:30.922Z
Learning: Claude 3.7 Sonnet (claude-3-7-sonnet-20250219) is a valid Anthropic model released on February 24, 2025. It's their most intelligent model featuring hybrid reasoning capabilities and improved coding performance.
tests/core-providers/go.mod (2)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:38-38
Timestamp: 2025-06-16T03:54:47.985Z
Learning: The `core-providers-test` module in `tests/core-providers/` is an internal testing module that will never be consumed as a dependency by external projects, so the replace directive pointing to `../../core` is acceptable for local development and testing purposes.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:3-4
Timestamp: 2025-06-16T03:55:16.928Z
Learning: Go 1.24 was released in February 2025 and is stable and available for use in go.mod files.
tests/core-providers/scenarios/multiple_tool_calls.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#55
File: core/providers/anthropic.go:483-494
Timestamp: 2025-06-04T10:04:30.181Z
Learning: In the Anthropic provider (core/providers/anthropic.go), parallel tool calls support including the DisableParallelToolUse flag will be implemented in later commits as it's a relatively new feature that's not commonly used yet. The development approach prioritizes core functionality first.
🧬 Code Graph Analysis (13)
tests/core-providers/vertex_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (42-50)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Vertex (44-44)
  • Fallback (72-75)
  • Anthropic (41-41)
tests/core-providers/cohere_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (42-50)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Cohere (43-43)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/scenarios/image_url.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (3)
  • CreateImageMessage (81-99)
  • TestImageURL (68-68)
  • GetResultContent (113-129)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/azure_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (42-50)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Azure (40-40)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/scenarios/image_base64.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (3)
  • CreateImageMessage (81-99)
  • TestImageBase64 (69-69)
  • GetResultContent (113-129)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/multi_turn_conversation.go (5)
core/bifrost.go (1)
  • Bifrost (39-51)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (4)
  • BifrostMessage (148-156)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • ModelParameters (80-94)
tests/core-providers/scenarios/utils.go (2)
  • CreateBasicChatMessage (72-79)
  • GetResultContent (113-129)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/provider_specific.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (4)
  • BifrostMessage (148-156)
  • ModelParameters (80-94)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
tests/core-providers/scenarios/utils.go (2)
  • CreateBasicChatMessage (72-79)
  • GetResultContent (113-129)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/bedrock_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (42-50)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Bedrock (42-42)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/scenarios/complete_end_to_end.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (6)
  • CreateBasicChatMessage (72-79)
  • WeatherToolDefinition (9-29)
  • GetResultContent (113-129)
  • CreateToolMessage (101-111)
  • CreateImageMessage (81-99)
  • TestImageURL (68-68)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/end_to_end_tool_calling.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (4)
  • CreateBasicChatMessage (72-79)
  • WeatherToolDefinition (9-29)
  • CreateToolMessage (101-111)
  • GetResultContent (113-129)
core/schemas/bifrost.go (7)
  • ModelParameters (80-94)
  • Tool (113-117)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • BifrostMessage (148-156)
  • AssistantMessage (221-226)
  • Function (106-110)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/multiple_tool_calls.go (5)
core/bifrost.go (2)
  • Bifrost (39-51)
  • ChatCompletionRequest (24-24)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (7)
  • BifrostMessage (148-156)
  • ModelParameters (80-94)
  • Tool (113-117)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • AssistantMessage (221-226)
  • Function (106-110)
tests/core-providers/scenarios/utils.go (3)
  • CreateBasicChatMessage (72-79)
  • WeatherToolDefinition (9-29)
  • GetResultContent (113-129)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/text_completion.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (3)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • ModelParameters (80-94)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/utils.go (1)
  • GetResultContent (113-129)
tests/core-providers/scenarios/simple_chat.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (4)
  • BifrostMessage (148-156)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • ModelParameters (80-94)
tests/core-providers/scenarios/utils.go (2)
  • CreateBasicChatMessage (72-79)
  • GetResultContent (113-129)
core/utils.go (1)
  • Ptr (5-7)
🪛 LanguageTool
tests/core-providers/README.md

[grammar] ~20-~20: The word ‘replace’ is a verb. Did you mean the noun “replacement”?
Context: ... test your changes: 1. Uncomment the replace directive in `tests/core-providers/go...

(PREPOSITION_VERB)


[grammar] ~166-~166: This phrase is duplicated. You should probably use “Text Completion” only once.
Context: ...- Streaming Chat Completion - Streaming Text Completion - Text Completion with Parameters - Chat Completion with ...

(PHRASE_REPETITION)

🪛 markdownlint-cli2 (0.17.2)
tests/core-providers/README.md

275-275: Ordered list item prefix
Expected: 1; Actual: 3; Style: 1/1/1

(MD029, ol-prefix)


293-293: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


298-298: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

🔇 Additional comments (13)
tests/core-providers/go.mod (1)

38-38: Local replace directive is commented out – will tests compile against unpublished core changes?

If the PR introduces code in ../../core that isn’t yet tagged as v1.1.2, removing the active replace means go test ./... will fetch the older tag and silently miss your changes.

Double-check that v1.1.2 already contains the router/path updates and any new APIs used by the new tests; otherwise reinstate the replace or bump the version.

transports/config.example.json (1)

6-15: Verify model slugs – several are not yet publicly available

gpt-4o-mini, gpt-3.5-turbo-preview, and gpt-4-turbo-preview are not present in the current OpenAI catalog.
Listing non-existent models in an example config causes 400 errors for copy-paste adopters.

Please cross-check the official model list (or add a comment indicating they are hypothetical/pre-release).

tests/core-providers/scenarios/multiple_images.go (1)

1-13: Shadowing of config import

The imported alias config is hidden by the parameter of the same name, preventing use of helpers from the package and hurting readability.
[ suggest_nitpick ]

tests/core-providers/bedrock_test.go (1)

19-40: 👍 Clean fix – variable shadowing resolved and redundant return removed

The switch to testConfig eliminates the earlier shadowing issue, and the unnecessary return after t.Fatalf is gone. Looks good.

tests/core-providers/scenarios/tool_calls.go (1)

54-56: 🛠️ Refactor suggestion

Eliminate invalid * on Function.Name and assert emptiness

-			assert.NotNil(t, toolCall.Function.Name)
-			assert.Equal(t, "get_weather", *toolCall.Function.Name)
+			assert.NotEmpty(t, toolCall.Function.Name)
+			assert.Equal(t, "get_weather", toolCall.Function.Name)

Likely an incorrect or invalid review comment.

tests/core-providers/tests.go (1)

23-35:

Details

❓ Verification inconclusive

Consider sub-tests with t.Parallel() to regain go test parallelism

All scenarios are executed sequentially. Once the client becomes concurrency-safe, wrapping each call in

t.Run("ScenarioName", func(t *testing.T) {
	t.Parallel()
	scenarios.Run…()
})

can cut CI time substantially and isolates failures. If serial order is intentional, add a brief comment so future readers do not “fix” it inadvertently.


Parallelize test scenarios using sub-tests with t.Parallel()

All scenarios in tests/core-providers/tests.go (lines 23–35) currently run sequentially, preventing Go’s built-in test parallelism. Wrapping each call in a t.Run sub-test with t.Parallel() will:

  • Reduce overall CI time by running tests concurrently
  • Isolate failures to individual scenarios

If the existing serial order is intentional (e.g., due to shared state or rate limits), please add a brief comment above the block to explain why parallel execution is disabled.

Affected location:

  • tests/core-providers/tests.go (lines 23–35)

Suggested diff for each scenario (example for TextCompletion):

-   scenarios.RunTextCompletionTest(t, client, ctx, config)
+   t.Run("TextCompletion", func(t *testing.T) {
+       t.Parallel()
+       scenarios.RunTextCompletionTest(t, client, ctx, config)
+   })

Repeat similarly for the other Run…Test calls.

Ensure that client, ctx, and any shared resources are safe for concurrent use before enabling t.Parallel().

tests/core-providers/scenarios/utils.go (4)

9-65: Tool definitions look well-structured.

The JSON schema definitions for the test tools follow the proper format with appropriate parameter types, descriptions, and required fields.


68-69: Test image constants are appropriate.

The image URL from Wikipedia Commons and the base64-encoded data URL are suitable for testing image handling capabilities.


72-79: CreateBasicChatMessage implementation is correct.

The function properly creates a user message with string content using bifrost.Ptr for consistency.


81-99: CreateImageMessage correctly handles multimodal content.

The function properly constructs content blocks for text and image, using appropriate types and pointer handling.

tests/core-providers/config/account.go (3)

17-44: Type definitions are well-structured for comprehensive testing.

The TestScenarios flags and ComprehensiveTestConfig provide good granularity for controlling test execution across different providers and capabilities.


108-191: Provider configurations are well-structured and consistent.

The network settings, concurrency limits, and provider-specific metadata are appropriately configured for test scenarios.


194-327: Comprehensive provider test configurations with appropriate scenario flags.

The configurations accurately capture each provider's capabilities and limitations, with helpful comments explaining disabled features and proper fallback strategies.

Comment thread transports/bifrost-http/integrations/openai/router.go
Comment thread tests/core-providers/go.mod
Comment thread transports/config.example.json Outdated
Comment thread tests/core-providers/openai_test.go Outdated
Comment thread tests/core-providers/openai_test.go
Comment thread tests/core-providers/scenarios/image_url.go Outdated
Comment thread tests/core-providers/scenarios/image_url.go Outdated
Comment thread tests/core-providers/scenarios/multi_turn_conversation.go Outdated
Comment thread tests/core-providers/README.md
Comment thread tests/core-providers/README.md
@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 06-14-feat_tests_added_for_core-providers_in_root_dir branch from 33fdcfc to 23fe755 Compare June 16, 2025 04:35
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 19

♻️ Duplicate comments (9)
tests/core-providers/anthropic_test.go (1)

11-18: Add t.Parallel() for faster suites

Running provider suites in parallel materially reduces wall-clock time and is already recommended on earlier reviews.

tests/core-providers/openai_test.go (1)

11-18: Enable parallel execution

Same as other provider tests – add t.Parallel() immediately after the function starts.

tests/core-providers/azure_test.go (1)

11-18: Parallelise Azure test

Add t.Parallel() to keep parity with other suites.

tests/core-providers/cohere_test.go (1)

11-18: 🧹 Nitpick (assertive)

Mark test as parallel for faster suite execution

All other provider tests are marked t.Parallel(). Adding it here keeps execution consistent and shortens overall runtime.

 func TestCohere(t *testing.T) {
+	t.Parallel()
tests/core-providers/scenarios/multiple_images.go (1)

55-58: 🛠️ Refactor suggestion

Caller-supplied ModelParameters dropped

cfg.CustomParams (if provided) is ignored, so provider-specific flags (e.g. temperature, top-p) never reach the request.

-			Params: &schemas.ModelParameters{
-				MaxTokens: bifrost.Ptr(300),
-			},
+			Params: bifrost.MergeParams(
+				&schemas.ModelParameters{MaxTokens: bifrost.Ptr(300)},
+				cfg.CustomParams,
+			),

(Replace bifrost.MergeParams with whatever merge helper you use elsewhere.)

tests/core-providers/scenarios/image_url.go (1)

16-23: Same two issues previously reported remain:

  1. Parameter config shadows the imported package.
  2. config.CustomParams are still not merged into Params.

Please address or justify.

tests/core-providers/vertex_test.go (1)

11-18: Enable parallel execution

The earlier review noted this; it’s still missing.

 func TestVertex(t *testing.T) {
+	t.Parallel()
tests/core-providers/scenarios/multiple_tool_calls.go (1)

26-29: Identical tool definitions still risk provider de-duplication

This was raised previously; the slice still contains WeatherToolDefinition twice. Several providers collapse duplicate tools, so the assertion for ≥2 calls may still pass only by chance. Using two distinct tools (e.g., WeatherToolDefinition and CalculatorToolDefinition) makes the expectation deterministic without relying on ParallelToolCalls.

tests/core-providers/scenarios/multi_turn_conversation.go (1)

48-51: Duplicate first-turn message weakens the memory test

Repeating “My name is Alice. Remember this.” in messages2 re-feeds the name and makes it easier for models that don’t actually preserve context. Dropping the duplicate line gives a stricter assessment of conversation memory.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 33fdcfc and 23fe755.

⛔ Files ignored due to path filters (2)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (40)
  • README.md (1 hunks)
  • core/go.mod (0 hunks)
  • core/tests/account.go (0 hunks)
  • core/tests/anthropic_test.go (0 hunks)
  • core/tests/azure_test.go (0 hunks)
  • core/tests/bedrock_test.go (0 hunks)
  • core/tests/cohere_test.go (0 hunks)
  • core/tests/e2e_tool_test.go (0 hunks)
  • core/tests/openai_test.go (0 hunks)
  • core/tests/setup.go (0 hunks)
  • core/tests/tests.go (0 hunks)
  • core/tests/vertex_test.go (0 hunks)
  • docs/http-transport-api.md (1 hunks)
  • tests/core-providers/README.md (1 hunks)
  • tests/core-providers/anthropic_test.go (1 hunks)
  • tests/core-providers/azure_test.go (1 hunks)
  • tests/core-providers/bedrock_test.go (1 hunks)
  • tests/core-providers/cohere_test.go (1 hunks)
  • tests/core-providers/config/account.go (1 hunks)
  • tests/core-providers/config/setup.go (1 hunks)
  • tests/core-providers/go.mod (1 hunks)
  • tests/core-providers/openai_test.go (1 hunks)
  • tests/core-providers/scenarios/automatic_function_calling.go (1 hunks)
  • tests/core-providers/scenarios/complete_end_to_end.go (1 hunks)
  • tests/core-providers/scenarios/end_to_end_tool_calling.go (1 hunks)
  • tests/core-providers/scenarios/image_base64.go (1 hunks)
  • tests/core-providers/scenarios/image_url.go (1 hunks)
  • tests/core-providers/scenarios/multi_turn_conversation.go (1 hunks)
  • tests/core-providers/scenarios/multiple_images.go (1 hunks)
  • tests/core-providers/scenarios/multiple_tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/provider_specific.go (1 hunks)
  • tests/core-providers/scenarios/simple_chat.go (1 hunks)
  • tests/core-providers/scenarios/text_completion.go (1 hunks)
  • tests/core-providers/scenarios/tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/utils.go (1 hunks)
  • tests/core-providers/tests.go (1 hunks)
  • tests/core-providers/vertex_test.go (1 hunks)
  • transports/bifrost-http/integrations/openai/router.go (1 hunks)
  • transports/bifrost-http/main.go (1 hunks)
  • transports/config.example.json (2 hunks)
💤 Files with no reviewable changes (11)
  • core/go.mod
  • core/tests/vertex_test.go
  • core/tests/bedrock_test.go
  • core/tests/setup.go
  • core/tests/anthropic_test.go
  • core/tests/cohere_test.go
  • core/tests/openai_test.go
  • core/tests/azure_test.go
  • core/tests/tests.go
  • core/tests/account.go
  • core/tests/e2e_tool_test.go
🧰 Additional context used
🧠 Learnings (12)
tests/core-providers/go.mod (3)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:3-4
Timestamp: 2025-06-16T04:27:53.527Z
Learning: In Go module files, `go 1.24.1` (with patch version) can work fine in some setups, contrary to the general rule that go directives should only include major.minor versions.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:38-38
Timestamp: 2025-06-16T03:54:47.985Z
Learning: The `core-providers-test` module in `tests/core-providers/` is an internal testing module that will never be consumed as a dependency by external projects, so the replace directive pointing to `../../core` is acceptable for local development and testing purposes.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:3-4
Timestamp: 2025-06-16T03:55:16.928Z
Learning: Go 1.24 was released in February 2025 and is stable and available for use in go.mod files.
tests/core-providers/openai_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.401Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/scenarios/simple_chat.go (2)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.425Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.
transports/config.example.json (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: transports/config.example.json:36-42
Timestamp: 2025-06-16T03:55:30.922Z
Learning: Claude 3.7 Sonnet (claude-3-7-sonnet-20250219) is a valid Anthropic model released on February 24, 2025. It's their most intelligent model featuring hybrid reasoning capabilities and improved coding performance.
tests/core-providers/scenarios/image_base64.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/image_base64.go:33-36
Timestamp: 2025-06-16T04:10:27.584Z
Learning: Base64 image handling in Bifrost test scenarios does not require provider-specific parameters or custom ExtraParams - all providers handle base64 images uniformly without special configuration.
tests/core-providers/azure_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.401Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/scenarios/multiple_tool_calls.go (2)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#55
File: core/providers/anthropic.go:483-494
Timestamp: 2025-06-04T10:04:30.181Z
Learning: In the Anthropic provider (core/providers/anthropic.go), parallel tool calls support including the DisableParallelToolUse flag will be implemented in later commits as it's a relatively new feature that's not commonly used yet. The development approach prioritizes core functionality first.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/multiple_tool_calls.go:27-31
Timestamp: 2025-06-16T04:05:47.784Z
Learning: ParallelToolCalls parameter is not supported by many AI providers, so it should be avoided in cross-provider test suites to maintain compatibility across different providers.
tests/core-providers/scenarios/complete_end_to_end.go (3)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.406Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:57-62
Timestamp: 2025-06-16T04:14:25.004Z
Learning: In the Bifrost codebase, toolCalls[0].Function refers to a FunctionCall struct, and FunctionCall.Name is a pointer to string (*string) that requires dereferencing with the * operator to get the actual string value.
tests/core-providers/scenarios/end_to_end_tool_calling.go (3)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.406Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.425Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.
tests/core-providers/scenarios/text_completion.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
tests/core-providers/scenarios/tool_calls.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
tests/core-providers/config/account.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/config/account.go:55-101
Timestamp: 2025-06-16T04:25:00.785Z
Learning: In the Bifrost test account implementation, the user prefers to let Bifrost itself handle missing API key errors rather than adding early validation in the GetKeysForProvider method.
🧬 Code Graph Analysis (7)
tests/core-providers/config/setup.go (6)
core/bifrost.go (2)
  • Bifrost (39-51)
  • Init (186-249)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestAccount (44-44)
core/schemas/bifrost.go (1)
  • BifrostConfig (16-22)
core/schemas/account.go (1)
  • Account (14-27)
core/schemas/logger.go (2)
  • Logger (18-35)
  • LogLevelDebug (9-9)
core/logger.go (1)
  • NewDefaultLogger (22-26)
tests/core-providers/vertex_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Vertex (44-44)
  • Fallback (72-75)
  • Anthropic (41-41)
tests/core-providers/anthropic_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Anthropic (41-41)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/scenarios/multiple_tool_calls.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (7)
  • BifrostMessage (148-156)
  • ModelParameters (80-94)
  • Tool (113-117)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • AssistantMessage (221-226)
  • Function (106-110)
tests/core-providers/scenarios/utils.go (3)
  • CreateBasicChatMessage (74-81)
  • WeatherToolDefinition (11-31)
  • GetResultContent (115-132)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/complete_end_to_end.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (6)
  • CreateBasicChatMessage (74-81)
  • WeatherToolDefinition (11-31)
  • GetResultContent (115-132)
  • CreateToolMessage (103-113)
  • CreateImageMessage (83-101)
  • TestImageURL (70-70)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/text_completion.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (3)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • ModelParameters (80-94)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/utils.go (1)
  • GetResultContent (115-132)
tests/core-providers/scenarios/tool_calls.go (5)
core/bifrost.go (2)
  • Bifrost (39-51)
  • ChatCompletionRequest (24-24)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (7)
  • BifrostMessage (148-156)
  • ModelParameters (80-94)
  • Tool (113-117)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • AssistantMessage (221-226)
  • Function (106-110)
tests/core-providers/scenarios/utils.go (3)
  • CreateBasicChatMessage (74-81)
  • WeatherToolDefinition (11-31)
  • GetResultContent (115-132)
core/utils.go (1)
  • Ptr (5-7)
🪛 LanguageTool
tests/core-providers/README.md

[grammar] ~20-~20: The word ‘replace’ is a verb. Did you mean the noun “replacement”?
Context: ... test your changes: 1. Uncomment the replace directive in `tests/core-providers/go...

(PREPOSITION_VERB)


[grammar] ~166-~166: This phrase is duplicated. You should probably use “Text Completion” only once.
Context: ...- Streaming Chat Completion - Streaming Text Completion - Text Completion with Parameters - Chat Completion with ...

(PHRASE_REPETITION)

🪛 markdownlint-cli2 (0.17.2)
tests/core-providers/README.md

35-35: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


192-192: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


309-309: Bare URL used
null

(MD034, no-bare-urls)


310-310: Bare URL used
null

(MD034, no-bare-urls)


311-311: Bare URL used
null

(MD034, no-bare-urls)


312-312: Bare URL used
null

(MD034, no-bare-urls)

🔇 Additional comments (17)
docs/http-transport-api.md (1)

654-654: Example Go snippet updated
The Go example’s package was updated from main to tests to match the new test directory structure, improving consistency in documentation.

transports/bifrost-http/integrations/openai/router.go (1)

21-21: Route update approved
Changing the OpenAI chat completion endpoint to /openai/chat/completions aligns with the new test framework paths. Since backward compatibility isn’t required here, this update is acceptable.

tests/core-providers/go.mod (5)

1-2: Module path correct
The module declaration github.com/maximhq/bifrost/tests/core-providers accurately reflects the location of your test suite.


3-4: The Go version directive go 1.24.1 is acceptable in this internal test module context.


5-8: Test dependencies pinned
Requiring github.com/maximhq/bifrost/core v1.1.2 and github.com/stretchr/testify v1.10.0 ensures consistency in the test environment.


10-36: Indirect dependencies are auto-managed and do not require manual review.


38-38: Local replace directive is appropriate
As this module is used solely for internal testing, the replace github.com/maximhq/bifrost/core => ../../core directive correctly points to the local core module.

transports/config.example.json (2)

6-15: Double-check availability of certain OpenAI slugs

gpt-4o and gpt-4-vision-preview are still in limited / preview rollout and may 404 depending on the account.
Before merging, verify that all CI / staging environments have access or document that these slugs are optional.


35-41: Anthropic list LGTM

All listed Anthropic model identifiers are valid and spelled correctly, including the recently-added claude-3-7-sonnet-20250219.

tests/core-providers/anthropic_test.go (1)

37-40: Confirm fallback slug gpt-4o-mini exists

gpt-4o-mini is not part of OpenAI’s public catalog at the time of writing. If this is a private deployment alias, leave a comment; otherwise switch to an official slug (e.g. gpt-4o).

tests/core-providers/openai_test.go (1)

37-40: Fallback model sanity check

Ensure Anthropic fallback claude-3-7-sonnet-20250219 is indeed enabled for the test account; otherwise the suite will hard-fail when OpenAI is unavailable.

tests/core-providers/config/setup.go (1)

14-20: Nice touch: extracted timeout constant

Using TestTimeout improves discoverability and keeps magic numbers out of the flow.

tests/core-providers/azure_test.go (1)

37-40: Validate fallback slug

Same note as for the Anthropic test – verify that gpt-4o-mini is a reachable deployment; otherwise swap for an official model or remove.

tests/core-providers/scenarios/tool_calls.go (2)

49-56: Guard against an empty Function.Name to avoid false-positive success

assert.NotNil guarantees a non-nil pointer, but a zero-length string still passes subsequent equality checks. Add an explicit NotEmpty to strengthen the assertion and surface malformed tool calls early.

-   assert.NotNil(t, toolCall.Function.Name)
-   assert.Equal(t, "get_weather", *toolCall.Function.Name)
+   assert.NotNil(t, toolCall.Function.Name)
+   assert.NotEmpty(t, *toolCall.Function.Name)
+   assert.Equal(t, "get_weather", *toolCall.Function.Name)

57-62: 🧹 Nitpick (assertive)

Use require.Nilf consistently for the custom error type

You switched to require.NoError elsewhere after json.Unmarshal, but err remains a BifrostError. Stick with require.Nilf to keep the error-type semantics consistent with the codebase convention.

-   require.NoError(t, err)
+   require.Nilf(t, err, "json unmarshal failed: %v", err)
⛔ Skipped due to learnings
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.406Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.425Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.
tests/core-providers/scenarios/automatic_function_calling.go (1)

48-52: 🧹 Nitpick (assertive)

Prefer require.NoErrorf over require.Nilf for clarity

require.Nilf works, but require.NoErrorf conveys the intent (error must be nil) more clearly and avoids the nil-vs-error semantic mismatch.

-		require.Nilf(t, err, "Automatic function calling failed: %v", err)
+		require.NoErrorf(t, err, "Automatic function calling failed: %v", err)
⛔ Skipped due to learnings
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.406Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.425Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.
tests/core-providers/scenarios/utils.go (1)

115-132: 🧹 Nitpick (assertive)

GetResultContent only inspects the first choice

If callers ever request multiple completions (n > 1) the helper silently ignores them.
Returning concatenated content (or at least the first non-empty choice) avoids losing data.

Possible quick fix:

-	if result.Choices[0].Message.Content.ContentStr != nil {
-		return *result.Choices[0].Message.Content.ContentStr
+	for _, choice := range result.Choices {
+		if s := choice.Message.Content.ContentStr; s != nil {
+			return *s
+		}
 	} else if result.Choices[0].Message.Content.ContentBlocks != nil {

Not critical for current tests, but future-proofs the utility.

⛔ Skipped due to learnings
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#74
File: core/tests/tests.go:393-409
Timestamp: 2025-06-11T14:35:19.166Z
Learning: In core/tests/tests.go, the helper function getResultContent is intentionally designed to extract content only from the first element of result.Choices; this is expected behavior for the current test strategy.

Comment thread README.md
Comment thread tests/core-providers/config/setup.go
Comment thread tests/core-providers/scenarios/image_base64.go
Comment thread tests/core-providers/scenarios/multiple_images.go
Comment thread tests/core-providers/bedrock_test.go
Comment thread tests/core-providers/scenarios/automatic_function_calling.go Outdated
Comment thread tests/core-providers/README.md Outdated
Comment thread tests/core-providers/README.md Outdated
Comment thread tests/core-providers/config/account.go
Comment thread tests/core-providers/config/account.go Outdated
@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 06-14-feat_tests_added_for_core-providers_in_root_dir branch from 23fe755 to 98f209a Compare June 16, 2025 04:42
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 17

♻️ Duplicate comments (21)
README.md (1)

233-235: Typo in tree diagram

The line │ └── ...│ has an extra trailing . Remove it and consider explicitly showing tests/core-providers under tests/ for clarity.

tests/core-providers/anthropic_test.go (1)

11-13: 🧹 Nitpick (assertive)

Run the test in parallel for a free speed-up

 func TestAnthropic(t *testing.T) {
+	t.Parallel()

Provider suites are independent; parallelising them cuts wall-clock time with no behavioural change.

tests/core-providers/openai_test.go (1)

11-13: 🧹 Nitpick (assertive)

Enable parallel execution

Same rationale as for the Anthropic suite – quick win, zero risk.

 func TestOpenAI(t *testing.T) {
+	t.Parallel()
tests/core-providers/cohere_test.go (1)

11-13: 🧹 Nitpick (assertive)

Mark Cohere test as parallel

 func TestCohere(t *testing.T) {
+	t.Parallel()
tests/core-providers/config/setup.go (1)

38-42: Still missing InitialPoolSize; consider reinstating for deterministic perf

Past review noted that pre-warming pools avoids allocations under load. If the comprehensive scenarios are concurrency-heavy, set a small non-zero value here.

tests/core-providers/azure_test.go (1)

11-17: 🧹 Nitpick (assertive)

Add t.Parallel() for faster, consistent execution
All other provider tests run in parallel – this one regressed.

 func TestAzure(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()
tests/core-providers/vertex_test.go (1)

11-17: 🧹 Nitpick (assertive)

Run the Vertex test in parallel, same as the others

 func TestVertex(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()
tests/core-providers/scenarios/image_url.go (1)

34-37: 🧹 Nitpick (assertive)

Caller-supplied CustomParams are lost – merge them instead

If a provider needs extra parameters (e.g. temperature, parallel-tool-calls, etc.) they will be silently dropped.

-			Params: &schemas.ModelParameters{
-				MaxTokens: bifrost.Ptr(200),
-			},
+			Params: func() *schemas.ModelParameters {
+				// start with caller-supplied params, if any
+				if testConfig.CustomParams != nil {
+					cp := *testConfig.CustomParams
+					cp.MaxTokens = bifrost.Ptr(200)
+					return &cp
+				}
+				return &schemas.ModelParameters{
+					MaxTokens: bifrost.Ptr(200),
+				}
+			}(),
tests/core-providers/scenarios/multiple_images.go (1)

55-57: 🧹 Nitpick (assertive)

CustomParams also discarded here

Same issue as in image_url.go.

-			Params: &schemas.ModelParameters{
-				MaxTokens: bifrost.Ptr(300),
-			},
+			Params: func() *schemas.ModelParameters {
+				if testConfig.CustomParams != nil {
+					cp := *testConfig.CustomParams
+					cp.MaxTokens = bifrost.Ptr(300)
+					return &cp
+				}
+				return &schemas.ModelParameters{
+					MaxTokens: bifrost.Ptr(300),
+				}
+			}(),
tests/core-providers/bedrock_test.go (1)

11-17: 🧹 Nitpick (assertive)

Run the provider-level test in parallel

All provider test entrypoints (TestOpenAI, TestAnthropic, …) already call t.Parallel() which lets CI execute them concurrently and shortens wall-clock time.
TestBedrock is the only one missing that call.

 func TestBedrock(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()
tests/core-providers/scenarios/simple_chat.go (1)

22-30: 🧹 Nitpick (assertive)

Consistent parallel execution for scenario tests

Other scenario files mark their sub-tests as parallel; doing the same here keeps execution characteristics uniform.

 t.Run("SimpleChat", func(t *testing.T) {
+	t.Parallel()
 	messages := []schemas.BifrostMessage{
tests/core-providers/scenarios/complete_end_to_end.go (1)

22-24: Duplicate: sub-test could run in parallel

Already pointed out in a previous review; still applies.

tests/core-providers/scenarios/end_to_end_tool_calling.go (1)

60-65: ⚠️ Potential issue

Assert that toolCallID is non-empty before using it
If both toolCall.ID and Function.Name are nil, the follow-up request is malformed but the test silently proceeds.
Add a fast-fail assertion:

 toolCallID := ""
 if toolCall.ID != nil {
     toolCallID = *toolCall.ID
 } else {
     toolCallID = *toolCall.Function.Name
 }
+require.NotEmpty(t, toolCallID, "toolCallID must not be empty")
tests/core-providers/scenarios/provider_specific.go (1)

34-69: 🧹 Nitpick (assertive)

Field-by-field overlay is brittle – extract a merge helper

Manual copying must be updated every time ModelParameters gains a new field.
Refactor into a helper that shallow-merges two ModelParameters, preferring non-nil override values.

tests/core-providers/scenarios/multi_turn_conversation.go (1)

46-52: 🧹 Nitpick (assertive)

Remove the repeated “My name is Alice” message

Repeating the first user prompt in messages2 makes it easier for a stateless provider to answer correctly, masking context-retention defects.

tests/core-providers/scenarios/automatic_function_calling.go (1)

48-64: 🧹 Nitpick (assertive)

Validate all choices, not just the first

If the caller sets n > 1 elsewhere, other choices may contain the tool call while the first is empty.
Iterate over response.Choices and assert each one.

tests/core-providers/tests.go (1)

15-19: 🧹 Nitpick (assertive)

Parameter name hides the imported config package

config as a parameter shadows the imported config package, making future calls to helpers inside that package impossible in this scope and slightly confusing to readers. Renaming the parameter to cfg (as done in other files) restores clarity.

tests/core-providers/README.md (2)

161-168: 🧹 Nitpick (assertive)

Duplicate entry “Streaming Text Completion”

The bullet list already covers text-completion scenarios; the extra “Streaming Text Completion” duplicates that idea and can be removed to avoid reader confusion.

- - Streaming Text Completion
🧰 Tools
🪛 LanguageTool

[grammar] ~166-~166: This phrase is duplicated. You should probably use “Text Completion” only once.
Context: ...- Streaming Chat Completion - Streaming Text Completion - Text Completion with Parameters - Chat Completion with ...

(PHRASE_REPETITION)


309-313: 🧹 Nitpick (assertive)

Convert bare URLs to Markdown links for lint-clean docs

Bare URLs trigger MD034 and are less readable. Wrap them in [text](url) as done elsewhere.

- - OpenAI: https://status.openai.com/
+ - [OpenAI status](https://status.openai.com/)

(Apply similarly to the other three lines.)

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

309-309: Bare URL used
null

(MD034, no-bare-urls)


310-310: Bare URL used
null

(MD034, no-bare-urls)


311-311: Bare URL used
null

(MD034, no-bare-urls)


312-312: Bare URL used
null

(MD034, no-bare-urls)

tests/core-providers/config/account.go (2)

145-147: ⚠️ Potential issue

Bedrock credentials use non-standard env vars and omit AccessKeyID

AWS tooling expects AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY. Current code reads BEDROCK_ACCESS_KEY only and skips the ID, which will break signed requests.

- SecretAccessKey: os.Getenv("BEDROCK_ACCESS_KEY"),
+ AccessKeyID:     os.Getenv("AWS_ACCESS_KEY_ID"),
+ SecretAccessKey: os.Getenv("AWS_SECRET_ACCESS_KEY"),

95-101: ⚠️ Potential issue

Azure env-var names diverge from README and common usage

Code expects AZURE_API_KEY, yet the documentation instructs AZURE_OPENAI_API_KEY. This mismatch silently yields empty keys and 401s.

- Value:  os.Getenv("AZURE_API_KEY"),
+ Value:  os.Getenv("AZURE_OPENAI_API_KEY"),

Align the endpoint variable similarly (AZURE_OPENAI_ENDPOINT).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23fe755 and 98f209a.

⛔ Files ignored due to path filters (2)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (40)
  • README.md (1 hunks)
  • core/go.mod (0 hunks)
  • core/tests/account.go (0 hunks)
  • core/tests/anthropic_test.go (0 hunks)
  • core/tests/azure_test.go (0 hunks)
  • core/tests/bedrock_test.go (0 hunks)
  • core/tests/cohere_test.go (0 hunks)
  • core/tests/e2e_tool_test.go (0 hunks)
  • core/tests/openai_test.go (0 hunks)
  • core/tests/setup.go (0 hunks)
  • core/tests/tests.go (0 hunks)
  • core/tests/vertex_test.go (0 hunks)
  • docs/http-transport-api.md (1 hunks)
  • tests/core-providers/README.md (1 hunks)
  • tests/core-providers/anthropic_test.go (1 hunks)
  • tests/core-providers/azure_test.go (1 hunks)
  • tests/core-providers/bedrock_test.go (1 hunks)
  • tests/core-providers/cohere_test.go (1 hunks)
  • tests/core-providers/config/account.go (1 hunks)
  • tests/core-providers/config/setup.go (1 hunks)
  • tests/core-providers/go.mod (1 hunks)
  • tests/core-providers/openai_test.go (1 hunks)
  • tests/core-providers/scenarios/automatic_function_calling.go (1 hunks)
  • tests/core-providers/scenarios/complete_end_to_end.go (1 hunks)
  • tests/core-providers/scenarios/end_to_end_tool_calling.go (1 hunks)
  • tests/core-providers/scenarios/image_base64.go (1 hunks)
  • tests/core-providers/scenarios/image_url.go (1 hunks)
  • tests/core-providers/scenarios/multi_turn_conversation.go (1 hunks)
  • tests/core-providers/scenarios/multiple_images.go (1 hunks)
  • tests/core-providers/scenarios/multiple_tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/provider_specific.go (1 hunks)
  • tests/core-providers/scenarios/simple_chat.go (1 hunks)
  • tests/core-providers/scenarios/text_completion.go (1 hunks)
  • tests/core-providers/scenarios/tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/utils.go (1 hunks)
  • tests/core-providers/tests.go (1 hunks)
  • tests/core-providers/vertex_test.go (1 hunks)
  • transports/bifrost-http/integrations/openai/router.go (1 hunks)
  • transports/bifrost-http/main.go (1 hunks)
  • transports/config.example.json (2 hunks)
💤 Files with no reviewable changes (11)
  • core/go.mod
  • core/tests/openai_test.go
  • core/tests/cohere_test.go
  • core/tests/anthropic_test.go
  • core/tests/bedrock_test.go
  • core/tests/vertex_test.go
  • core/tests/setup.go
  • core/tests/azure_test.go
  • core/tests/e2e_tool_test.go
  • core/tests/account.go
  • core/tests/tests.go
🧰 Additional context used
🧠 Learnings (12)
tests/core-providers/go.mod (2)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:3-4
Timestamp: 2025-06-16T04:27:53.527Z
Learning: In Go module files, `go 1.24.1` (with patch version) can work fine in some setups, contrary to the general rule that go directives should only include major.minor versions.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:3-4
Timestamp: 2025-06-16T03:55:16.928Z
Learning: Go 1.24 was released in February 2025 and is stable and available for use in go.mod files.
tests/core-providers/scenarios/simple_chat.go (2)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.425Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
tests/core-providers/openai_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.401Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/scenarios/complete_end_to_end.go (3)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.406Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:57-62
Timestamp: 2025-06-16T04:14:25.004Z
Learning: In the Bifrost codebase, toolCalls[0].Function refers to a FunctionCall struct, and FunctionCall.Name is a pointer to string (*string) that requires dereferencing with the * operator to get the actual string value.
tests/core-providers/azure_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.401Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/scenarios/tool_calls.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
tests/core-providers/scenarios/end_to_end_tool_calling.go (4)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.406Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.425Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:57-62
Timestamp: 2025-06-16T04:14:25.004Z
Learning: In the Bifrost codebase, toolCalls[0].Function refers to a FunctionCall struct, and FunctionCall.Name is a pointer to string (*string) that requires dereferencing with the * operator to get the actual string value.
tests/core-providers/scenarios/multiple_tool_calls.go (2)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#55
File: core/providers/anthropic.go:483-494
Timestamp: 2025-06-04T10:04:30.181Z
Learning: In the Anthropic provider (core/providers/anthropic.go), parallel tool calls support including the DisableParallelToolUse flag will be implemented in later commits as it's a relatively new feature that's not commonly used yet. The development approach prioritizes core functionality first.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/multiple_tool_calls.go:27-31
Timestamp: 2025-06-16T04:05:47.784Z
Learning: ParallelToolCalls parameter is not supported by many AI providers, so it should be avoided in cross-provider test suites to maintain compatibility across different providers.
tests/core-providers/scenarios/text_completion.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
transports/config.example.json (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: transports/config.example.json:36-42
Timestamp: 2025-06-16T03:55:30.922Z
Learning: Claude 3.7 Sonnet (claude-3-7-sonnet-20250219) is a valid Anthropic model released on February 24, 2025. It's their most intelligent model featuring hybrid reasoning capabilities and improved coding performance.
tests/core-providers/scenarios/image_base64.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/image_base64.go:33-36
Timestamp: 2025-06-16T04:10:27.584Z
Learning: Base64 image handling in Bifrost test scenarios does not require provider-specific parameters or custom ExtraParams - all providers handle base64 images uniformly without special configuration.
tests/core-providers/config/account.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/config/account.go:55-101
Timestamp: 2025-06-16T04:25:00.785Z
Learning: In the Bifrost test account implementation, the user prefers to let Bifrost itself handle missing API key errors rather than adding early validation in the GetKeysForProvider method.
🧬 Code Graph Analysis (9)
tests/core-providers/bedrock_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Bedrock (42-42)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/config/setup.go (6)
core/bifrost.go (2)
  • Bifrost (39-51)
  • Init (186-249)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestAccount (44-44)
core/schemas/bifrost.go (1)
  • BifrostConfig (16-22)
core/schemas/account.go (1)
  • Account (14-27)
core/schemas/logger.go (2)
  • Logger (18-35)
  • LogLevelDebug (9-9)
core/logger.go (1)
  • NewDefaultLogger (22-26)
tests/core-providers/cohere_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Cohere (43-43)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/scenarios/simple_chat.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (4)
  • BifrostMessage (148-156)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • ModelParameters (80-94)
tests/core-providers/scenarios/utils.go (2)
  • CreateBasicChatMessage (74-81)
  • GetResultContent (115-132)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/complete_end_to_end.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (6)
  • CreateBasicChatMessage (74-81)
  • WeatherToolDefinition (11-31)
  • GetResultContent (115-132)
  • CreateToolMessage (103-113)
  • CreateImageMessage (83-101)
  • TestImageURL (70-70)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/azure_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Azure (40-40)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/scenarios/tool_calls.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (3)
  • CreateBasicChatMessage (74-81)
  • WeatherToolDefinition (11-31)
  • GetResultContent (115-132)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/provider_specific.go (5)
core/bifrost.go (2)
  • Bifrost (39-51)
  • ChatCompletionRequest (24-24)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (5)
  • BifrostMessage (148-156)
  • ModelParameters (80-94)
  • ToolChoice (142-145)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
tests/core-providers/scenarios/utils.go (2)
  • CreateBasicChatMessage (74-81)
  • GetResultContent (115-132)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/text_completion.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (3)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • ModelParameters (80-94)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/utils.go (1)
  • GetResultContent (115-132)
🪛 LanguageTool
tests/core-providers/README.md

[grammar] ~20-~20: The word ‘replace’ is a verb. Did you mean the noun “replacement”?
Context: ... test your changes: 1. Uncomment the replace directive in `tests/core-providers/go...

(PREPOSITION_VERB)


[grammar] ~166-~166: This phrase is duplicated. You should probably use “Text Completion” only once.
Context: ...- Streaming Chat Completion - Streaming Text Completion - Text Completion with Parameters - Chat Completion with ...

(PHRASE_REPETITION)

🪛 markdownlint-cli2 (0.17.2)
tests/core-providers/README.md

35-35: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


192-192: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


309-309: Bare URL used
null

(MD034, no-bare-urls)


310-310: Bare URL used
null

(MD034, no-bare-urls)


311-311: Bare URL used
null

(MD034, no-bare-urls)


312-312: Bare URL used
null

(MD034, no-bare-urls)

🔇 Additional comments (7)
transports/config.example.json (2)

7-15: Updated OpenAI model list

The expanded set of GPT-3.5 and GPT-4 variants looks correct and aligns with provider offerings. Ensure this stays in sync with official slugs and that downstream tests reference these models.


35-41: Updated Anthropic model list

The new Claude versions (claude-2.1, sonnet/haiku/opus releases, etc.) match announced releases. Confirm that the test account and scenario configs cover all these new model IDs.

transports/bifrost-http/integrations/openai/router.go (1)

21-21: Breaking change: OpenAI chat route updated

The endpoint moved from /openai/v1/chat/completions to /openai/chat/completions. Verify that client integrations and documentation use the new path and remove references to the old route.

tests/core-providers/go.mod (1)

38-38: Dead replace directive: delete or uncomment intentionally

Line 38 is a commented-out replace pointing to ../../core. If local replacement is still useful, leave it uncommented; otherwise remove the line to avoid confusion.

tests/core-providers/scenarios/utils.go (1)

115-132: LGTM – helper is now allocation-friendly

strings.Builder eliminates repeated reallocations; the function is concise and safe. Nice improvement.

tests/core-providers/scenarios/image_base64.go (2)

30-32: Confirm the expected type of ChatCompletionInput

ChatCompletionInput receives &messages (a pointer to slice).
If the struct field is declared as []schemas.BifrostMessage, the compilation will fail because a *[]T is not assignable to []T.

-            Input: schemas.RequestInput{
-                ChatCompletionInput: &messages,
-            },
+            Input: schemas.RequestInput{
+                ChatCompletionInput: messages, // pass slice, not *slice
+            },

Please double-check the field’s definition and adjust accordingly.


40-40: 🧹 Nitpick (assertive)

Use require.NoError instead of require.Nilf

require.NoError(t, err, msg) is semantically clearer and avoids a nil-comparison on an error interface.

-        require.Nilf(t, err, "Image base64 test failed: %v", err)
+        require.NoErrorf(t, err, "Image base64 test failed")
⛔ Skipped due to learnings
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.406Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.425Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.

Comment thread docs/http-transport-api.md Outdated
Comment thread transports/bifrost-http/main.go Outdated
Comment thread tests/core-providers/go.mod
Comment thread tests/core-providers/azure_test.go
Comment thread tests/core-providers/vertex_test.go
Comment thread tests/core-providers/scenarios/multi_turn_conversation.go
Comment thread tests/core-providers/scenarios/automatic_function_calling.go
Comment thread tests/core-providers/tests.go Outdated
Comment thread tests/core-providers/config/account.go
Comment thread tests/core-providers/scenarios/image_base64.go
@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 06-14-feat_tests_added_for_core-providers_in_root_dir branch from 98f209a to 9b6c9db Compare June 16, 2025 05:03
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 12

🔭 Outside diff range comments (1)
transports/config.example.json (1)

58-66: 🧹 Nitpick (assertive)

⚠️ Potential issue

Bedrock credentials placeholder will not work – replace fake API key with the AWS access key pair

Bedrock authenticates through the standard AWS signing flow – there is no such thing as a standalone Bedrock API key.
Keeping "value": "env.BEDROCK_API_KEY" will make every runtime call fail with 403/Un-signed‐request errors.

Diff-ready fix:

-        "value": "env.BEDROCK_API_KEY",
+        // AWS access key that is paired with the secret defined below
+        "value": "env.AWS_ACCESS_KEY_ID",

Consider also documenting that both AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be present in the environment (optionally AWS_SESSION_TOKEN for temporary creds).
Without this, new users will copy-paste the example and hit authentication errors immediately.

♻️ Duplicate comments (24)
README.md (1)

233-235: Fix tree diagram formatting and clarify test directory
Remove the extra trailing pipe () on the tests/ entry and explicitly list tests/core-providers under tests/ for clarity.

transports/bifrost-http/main.go (1)

33-33: ⚠️ Potential issue

Revert package declaration from tests to main
Changing the package to tests here prevents go build or go install from producing the HTTP server binary. Revert to package main.

- package tests
+ package main
tests/core-providers/go.mod (1)

10-36: Repeated require blocks still bloat the manifest

The split direct/indirect sections add noise and drift out of sync. One require block and a go mod tidy afterwards is enough—the toolchain will record indirects automatically.

tests/core-providers/cohere_test.go (1)

11-18: 🧹 Nitpick (assertive)

Enable parallel execution for faster CI

All provider tests can safely run in parallel (they already use isolated contexts).
Add t.Parallel() as the very first statement.

 func TestCohere(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()
tests/core-providers/azure_test.go (2)

1-2: 🧹 Nitpick (assertive)

Keep package naming consistent with the suite

Same mismatch as in cohere_test.go. Stay with package main for uniformity.

-package tests
+package main

11-18: 🧹 Nitpick (assertive)

Mark the test as parallel

Brings this file in line with the other provider tests and shortens wall-clock time.

 func TestAzure(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()
tests/core-providers/scenarios/image_base64.go (1)

22-48: 🧹 Nitpick (assertive)

Run the sub-test in parallel

No shared state is mutated; letting the sub-test run concurrently speeds up the scenario suite.

-	t.Run("ImageBase64", func(t *testing.T) {
+	t.Run("ImageBase64", func(t *testing.T) {
+		t.Parallel()
tests/core-providers/vertex_test.go (2)

1-2: 🧹 Nitpick (assertive)

Align with suite convention – use package main

Other tests in tests/core-providers use package main; sticking to one package name avoids import headaches and tooling surprises.

-package tests
+package main

11-13: 🧹 Nitpick (assertive)

Enable parallel execution

 func TestVertex(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()

Running provider-level tests in parallel has proven safe and speeds up the suite.

tests/core-providers/bedrock_test.go (1)

11-13: 🧹 Nitpick (assertive)

Run Bedrock test in parallel

 func TestBedrock(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()
tests/core-providers/scenarios/tool_calls.go (1)

23-27: 🧹 Nitpick (assertive)

Add t.Parallel() to the ToolCalls sub-test

 t.Run("ToolCalls", func(t *testing.T) {
+	t.Parallel()
 	messages := []schemas.BifrostMessage{
 		CreateBasicChatMessage("What's the weather like in New York?"),
 	}

This mirrors other scenario files and reduces overall test time.

tests/core-providers/scenarios/simple_chat.go (1)

22-25: 🧹 Nitpick (assertive)

Parallelise the SimpleChat sub-test

 t.Run("SimpleChat", func(t *testing.T) {
+	t.Parallel()
 	messages := []schemas.BifrostMessage{
 		CreateBasicChatMessage("Hello! What's the capital of France?"),
 	}

Consistent parallelism across scenarios speeds up CI.

tests/core-providers/scenarios/end_to_end_tool_calling.go (1)

23-24: (re-iterating) Mark sub-test as parallel

Same rationale as earlier feedback – consistency and faster CI.
Feel free to defer if parallel execution is still on the backlog.

tests/core-providers/scenarios/text_completion.go (1)

22-22: Consider enabling t.Parallel() for symmetry with other scenarios

Keeps the suite consistently concurrent once parallelism is adopted.

tests/core-providers/scenarios/provider_specific.go (1)

29-69: 🛠️ Refactor suggestion

Replace verbose manual overlay with existing helper

The manual field-by-field copy is easy to drift when ModelParameters
evolves. MergeCustomParams already does an exhaustive shallow merge.

-		// Initialize with default parameters
-		params := &schemas.ModelParameters{
-			MaxTokens: bifrost.Ptr(150),
-		}
-
-		// Overlay custom parameters if provided, preserving defaults for unspecified fields
-		if testConfig.CustomParams != nil {
-			if testConfig.CustomParams.MaxTokens != nil {
-				params.MaxTokens = testConfig.CustomParams.MaxTokens
-			}
-			if testConfig.CustomParams.Temperature != nil {
-				params.Temperature = testConfig.CustomParams.Temperature
-			}
-			... // many similar blocks
-			if testConfig.CustomParams.ExtraParams != nil {
-				params.ExtraParams = testConfig.CustomParams.ExtraParams
-			}
-		}
+		params := MergeCustomParams(
+			schemas.ModelParameters{
+				MaxTokens: bifrost.Ptr(150),
+			},
+			testConfig.CustomParams,
+		)

This keeps the test short, future-proof and in-line with other scenarios.

tests/core-providers/scenarios/multi_turn_conversation.go (1)

47-51: ⚠️ Potential issue

Duplicate “remember this” message still present – compromises the test’s intent

Re-sending the initial “My name is Alice. Remember this.” user message in messages2 makes it significantly easier for a stateless provider to pass, weakening the memory-retention check.
Please drop that first element so the second request only contains the assistant’s prior reply and the follow-up question.

-		messages2 := []schemas.BifrostMessage{
-			CreateBasicChatMessage("My name is Alice. Remember this."),
-			response1.Choices[0].Message,
-			CreateBasicChatMessage("What's my name?"),
-		}
+		messages2 := []schemas.BifrostMessage{
+			response1.Choices[0].Message,
+			CreateBasicChatMessage("What's my name?"),
+		}
tests/core-providers/scenarios/automatic_function_calling.go (1)

53-64: 🛠️ Refactor suggestion

Only the first choice is validated – may miss failures when n>1

The test inspects response.Choices[0] only.
If n is ever set to >1 elsewhere, a provider could return an invalid first choice but a valid second one and still pass. Iterate over all choices to assert each contains the expected tool call.

-	message := response.Choices[0].Message
-	...
-	toolCalls := *message.AssistantMessage.ToolCalls
+	for i, choice := range response.Choices {
+		msg := choice.Message
+		require.NotNilf(t, msg.AssistantMessage, "choice %d missing assistant message", i)
+		require.NotNilf(t, msg.AssistantMessage.ToolCalls, "choice %d missing tool calls", i)
+		toolCalls := *msg.AssistantMessage.ToolCalls
+		require.NotEmptyf(t, toolCalls, "choice %d returned empty tool calls", i)
+
+		tc := toolCalls[0]
+		require.NotNil(t, tc.Function.Name)
+		assert.Equal(t, "get_current_time", *tc.Function.Name)
+	}
tests/core-providers/tests.go (1)

18-22: 🧹 Nitpick (assertive)

Parameter name shadows imported package config

func runAllComprehensiveTests(..., config config.ComprehensiveTestConfig) hides the config import, which can be confusing and blocks access to package-level helpers inside this file.
Rename the parameter (e.g. cfg) to avoid the shadow.

-func runAllComprehensiveTests(t *testing.T, client *bifrost.Bifrost, ctx context.Context, config config.ComprehensiveTestConfig) {
+func runAllComprehensiveTests(t *testing.T, client *bifrost.Bifrost, ctx context.Context, cfg config.ComprehensiveTestConfig) {
-	if config.SkipReason != "" {
-		t.Skipf("Skipping %s: %s", config.Provider, config.SkipReason)
+	if cfg.SkipReason != "" {
+		t.Skipf("Skipping %s: %s", cfg.Provider, cfg.SkipReason)
 	...
-	t.Logf("🚀 Running comprehensive tests for provider: %s", config.Provider)
+	t.Logf("🚀 Running comprehensive tests for provider: %s", cfg.Provider)
tests/core-providers/config/account.go (2)

81-85: Bedrock API key still unused

Per earlier feedback, Bedrock authenticates via IAM; keeping BEDROCK_API_KEY invites confusion. Consider dropping it or mapping to AWS creds.


172-175: Preview API version fallback could silently rot

Falling back to 2024-08-01-preview risks sudden breakage when the preview is retired. Prefer forcing AZURE_API_VERSION to be set or emit a loud warning when the default is used.

tests/core-providers/openai_test.go (1)

11-18: 🧹 Nitpick (assertive)

Run the test in parallel for a free speed-up.

The suite spins up a fresh Bifrost instance per provider, so isolating state isn’t an issue. Adding t.Parallel() right after the function starts lets multiple provider suites execute concurrently and shortens CI time.

 func TestOpenAI(t *testing.T) {
+	t.Parallel()
tests/core-providers/config/setup.go (1)

38-42: 🧹 Nitpick (assertive)

Consider pre-warming the pools for heavier scenarios.

InitialPoolSize is left at the zero value, so every channel/object allocation happens lazily during the first run of a scenario.
Setting a modest size (e.g. 32) avoids runtime allocations and makes latency numbers steadier during concurrency tests.

 	b, err := bifrost.Init(schemas.BifrostConfig{
 		Account: &account,
 		Plugins: nil,
 		Logger:  bifrost.NewDefaultLogger(schemas.LogLevelDebug),
+		InitialPoolSize: 32,
 	})
tests/core-providers/anthropic_test.go (2)

1-2: Package name inconsistent with the existing convention.

Same observation as in openai_test.go—the project previously standardised on package main.
Align this file (and others) to avoid multiple test binaries.


11-18: 🧹 Nitpick (assertive)

Enable t.Parallel() for quicker provider sweeps.

As with the OpenAI test, running in parallel speeds up CI without shared-state risks.

 func TestAnthropic(t *testing.T) {
+	t.Parallel()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98f209a and 9b6c9db.

⛔ Files ignored due to path filters (2)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (42)
  • README.md (1 hunks)
  • core/go.mod (0 hunks)
  • core/tests/account.go (0 hunks)
  • core/tests/anthropic_test.go (0 hunks)
  • core/tests/azure_test.go (0 hunks)
  • core/tests/bedrock_test.go (0 hunks)
  • core/tests/cohere_test.go (0 hunks)
  • core/tests/e2e_tool_test.go (0 hunks)
  • core/tests/openai_test.go (0 hunks)
  • core/tests/setup.go (0 hunks)
  • core/tests/tests.go (0 hunks)
  • core/tests/vertex_test.go (0 hunks)
  • docs/providers.md (1 hunks)
  • tests/core-providers/README.md (1 hunks)
  • tests/core-providers/anthropic_test.go (1 hunks)
  • tests/core-providers/azure_test.go (1 hunks)
  • tests/core-providers/bedrock_test.go (1 hunks)
  • tests/core-providers/cohere_test.go (1 hunks)
  • tests/core-providers/config/account.go (1 hunks)
  • tests/core-providers/config/setup.go (1 hunks)
  • tests/core-providers/go.mod (1 hunks)
  • tests/core-providers/openai_test.go (1 hunks)
  • tests/core-providers/scenarios/automatic_function_calling.go (1 hunks)
  • tests/core-providers/scenarios/complete_end_to_end.go (1 hunks)
  • tests/core-providers/scenarios/end_to_end_tool_calling.go (1 hunks)
  • tests/core-providers/scenarios/image_base64.go (1 hunks)
  • tests/core-providers/scenarios/image_url.go (1 hunks)
  • tests/core-providers/scenarios/multi_turn_conversation.go (1 hunks)
  • tests/core-providers/scenarios/multiple_images.go (1 hunks)
  • tests/core-providers/scenarios/multiple_tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/provider_specific.go (1 hunks)
  • tests/core-providers/scenarios/simple_chat.go (1 hunks)
  • tests/core-providers/scenarios/text_completion.go (1 hunks)
  • tests/core-providers/scenarios/tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/utils.go (1 hunks)
  • tests/core-providers/tests.go (1 hunks)
  • tests/core-providers/vertex_test.go (1 hunks)
  • transports/README.md (1 hunks)
  • transports/bifrost-http/integrations/openai/router.go (1 hunks)
  • transports/bifrost-http/lib/config.go (1 hunks)
  • transports/bifrost-http/main.go (1 hunks)
  • transports/config.example.json (3 hunks)
💤 Files with no reviewable changes (11)
  • core/go.mod
  • core/tests/cohere_test.go
  • core/tests/vertex_test.go
  • core/tests/openai_test.go
  • core/tests/bedrock_test.go
  • core/tests/anthropic_test.go
  • core/tests/azure_test.go
  • core/tests/e2e_tool_test.go
  • core/tests/setup.go
  • core/tests/account.go
  • core/tests/tests.go
🧰 Additional context used
🧠 Learnings (16)
tests/core-providers/go.mod (3)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:3-4
Timestamp: 2025-06-16T04:27:53.527Z
Learning: In Go module files, `go 1.24.1` (with patch version) can work fine in some setups, contrary to the general rule that go directives should only include major.minor versions.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:38-38
Timestamp: 2025-06-16T03:54:47.985Z
Learning: The `core-providers-test` module in `tests/core-providers/` is an internal testing module that will never be consumed as a dependency by external projects, so the replace directive pointing to `../../core` is acceptable for local development and testing purposes.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:3-4
Timestamp: 2025-06-16T03:55:16.928Z
Learning: Go 1.24 was released in February 2025 and is stable and available for use in go.mod files.
tests/core-providers/azure_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.401Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/openai_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.401Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/scenarios/complete_end_to_end.go (3)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.406Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:57-62
Timestamp: 2025-06-16T04:14:25.004Z
Learning: In the Bifrost codebase, toolCalls[0].Function refers to a FunctionCall struct, and FunctionCall.Name is a pointer to string (*string) that requires dereferencing with the * operator to get the actual string value.
tests/core-providers/scenarios/end_to_end_tool_calling.go (4)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.406Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.425Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:57-62
Timestamp: 2025-06-16T04:14:25.004Z
Learning: In the Bifrost codebase, toolCalls[0].Function refers to a FunctionCall struct, and FunctionCall.Name is a pointer to string (*string) that requires dereferencing with the * operator to get the actual string value.
tests/core-providers/tests.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/automatic_function_calling.go:22-22
Timestamp: 2025-06-16T04:55:11.864Z
Learning: In the Bifrost test suite (tests/core-providers), parallel tests using t.Parallel() are not being implemented currently. The team plans to add parallel test execution in future enhancements.
tests/core-providers/scenarios/tool_calls.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
tests/core-providers/scenarios/text_completion.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
transports/config.example.json (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: transports/config.example.json:36-42
Timestamp: 2025-06-16T03:55:30.922Z
Learning: Claude 3.7 Sonnet (claude-3-7-sonnet-20250219) is a valid Anthropic model released on February 24, 2025. It's their most intelligent model featuring hybrid reasoning capabilities and improved coding performance.
tests/core-providers/scenarios/multiple_tool_calls.go (2)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#55
File: core/providers/anthropic.go:483-494
Timestamp: 2025-06-04T10:04:30.181Z
Learning: In the Anthropic provider (core/providers/anthropic.go), parallel tool calls support including the DisableParallelToolUse flag will be implemented in later commits as it's a relatively new feature that's not commonly used yet. The development approach prioritizes core functionality first.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/multiple_tool_calls.go:27-31
Timestamp: 2025-06-16T04:05:47.784Z
Learning: ParallelToolCalls parameter is not supported by many AI providers, so it should be avoided in cross-provider test suites to maintain compatibility across different providers.
tests/core-providers/vertex_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.401Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/scenarios/image_base64.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/image_base64.go:33-36
Timestamp: 2025-06-16T04:10:27.584Z
Learning: Base64 image handling in Bifrost test scenarios does not require provider-specific parameters or custom ExtraParams - all providers handle base64 images uniformly without special configuration.
tests/core-providers/scenarios/provider_specific.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/automatic_function_calling.go:22-22
Timestamp: 2025-06-16T04:55:11.864Z
Learning: In the Bifrost test suite (tests/core-providers), parallel tests using t.Parallel() are not being implemented currently. The team plans to add parallel test execution in future enhancements.
tests/core-providers/scenarios/simple_chat.go (2)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.425Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
tests/core-providers/scenarios/automatic_function_calling.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/automatic_function_calling.go:22-22
Timestamp: 2025-06-16T04:55:11.864Z
Learning: In the Bifrost test suite (tests/core-providers), parallel tests using t.Parallel() are not being implemented currently. The team plans to add parallel test execution in future enhancements.
tests/core-providers/config/account.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/config/account.go:55-101
Timestamp: 2025-06-16T04:25:00.785Z
Learning: In the Bifrost test account implementation, the user prefers to let Bifrost itself handle missing API key errors rather than adding early validation in the GetKeysForProvider method.
🧬 Code Graph Analysis (11)
tests/core-providers/azure_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Azure (40-40)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/cohere_test.go (4)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/provider.go (1)
  • Provider (144-151)
core/schemas/bifrost.go (3)
  • Cohere (43-43)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/scenarios/image_url.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (4)
  • CreateImageMessage (83-101)
  • TestImageURL (70-70)
  • MergeCustomParams (136-190)
  • GetResultContent (115-132)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/complete_end_to_end.go (5)
core/bifrost.go (2)
  • Bifrost (39-51)
  • ChatCompletionRequest (24-24)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (7)
  • CreateBasicChatMessage (74-81)
  • MergeCustomParams (136-190)
  • WeatherToolDefinition (11-31)
  • GetResultContent (115-132)
  • CreateToolMessage (103-113)
  • CreateImageMessage (83-101)
  • TestImageURL (70-70)
core/schemas/bifrost.go (7)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • BifrostMessage (148-156)
  • ModelParameters (80-94)
  • Tool (113-117)
  • AssistantMessage (221-226)
  • Function (106-110)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/end_to_end_tool_calling.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (5)
  • CreateBasicChatMessage (74-81)
  • MergeCustomParams (136-190)
  • WeatherToolDefinition (11-31)
  • CreateToolMessage (103-113)
  • GetResultContent (115-132)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/tool_calls.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (7)
  • BifrostMessage (148-156)
  • ModelParameters (80-94)
  • Tool (113-117)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • AssistantMessage (221-226)
  • Function (106-110)
tests/core-providers/scenarios/utils.go (4)
  • CreateBasicChatMessage (74-81)
  • MergeCustomParams (136-190)
  • WeatherToolDefinition (11-31)
  • GetResultContent (115-132)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/anthropic_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Anthropic (41-41)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/vertex_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Vertex (44-44)
  • Fallback (72-75)
  • Anthropic (41-41)
tests/core-providers/scenarios/image_base64.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (4)
  • CreateImageMessage (83-101)
  • TestImageBase64 (71-71)
  • MergeCustomParams (136-190)
  • GetResultContent (115-132)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/simple_chat.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (3)
  • CreateBasicChatMessage (74-81)
  • MergeCustomParams (136-190)
  • GetResultContent (115-132)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/config/account.go (8)
core/schemas/provider.go (7)
  • Provider (144-151)
  • NetworkConfig (29-36)
  • DefaultRequestTimeoutInSeconds (13-13)
  • ConcurrencyAndBufferSize (72-75)
  • DefaultNetworkConfig (39-44)
  • DefaultConcurrencyAndBufferSize (78-81)
  • MetaConfig (48-69)
core/schemas/bifrost.go (9)
  • ModelProvider (36-36)
  • ModelParameters (80-94)
  • Fallback (72-75)
  • OpenAI (39-39)
  • Anthropic (41-41)
  • Bedrock (42-42)
  • Cohere (43-43)
  • Azure (40-40)
  • Vertex (44-44)
core/schemas/account.go (1)
  • Key (6-10)
transports/bifrost-http/lib/config.go (1)
  • ProviderConfig (17-22)
core/schemas/meta/bedrock.go (1)
  • BedrockMetaConfig (8-14)
core/utils.go (1)
  • Ptr (5-7)
core/schemas/meta/azure.go (1)
  • AzureMetaConfig (8-12)
core/schemas/meta/vertex.go (1)
  • VertexMetaConfig (8-12)
🪛 LanguageTool
tests/core-providers/README.md

[grammar] ~20-~20: The word ‘replace’ is a verb. Did you mean the noun “replacement”?
Context: ... test your changes: 1. Uncomment the replace directive in `tests/core-providers/go...

(PREPOSITION_VERB)


[grammar] ~167-~167: This phrase is duplicated. You should probably use “Text Completion” only once.
Context: ...- Streaming Chat Completion - Streaming Text Completion - Text Completion with Parameters - Chat Completion with ...

(PHRASE_REPETITION)

🔇 Additional comments (9)
docs/providers.md (1)

73-73: Confirm Bedrock secret access key environment variable update
The change to use AWS_SECRET_ACCESS_KEY aligns with other configuration files and standard AWS env var naming.

transports/bifrost-http/integrations/openai/router.go (1)

21-23: Breaking change: OpenAI chat completions route updated
The path has been changed from /openai/v1/chat/completions to /openai/chat/completions. Ensure clients are aware of this intentional breaking change.

transports/bifrost-http/lib/config.go (1)

47-51: Confirm example config comment update for Bedrock
The placeholder for secret_access_key is correctly updated to env.AWS_SECRET_ACCESS_KEY. This aligns with related examples.

tests/core-providers/vertex_test.go (1)

16-17: 🧹 Nitpick (assertive)

Defer order: cancel after cleanup

client.Cleanup() is likely independent of ctx, but cancelling after cleanup is safer and mirrors the common pattern.

-	defer cancel()
-	defer client.Cleanup()
+	defer client.Cleanup()
+	defer cancel()

Likely an incorrect or invalid review comment.

tests/core-providers/bedrock_test.go (1)

16-17: 🧹 Nitpick (assertive)

Swap defer order for clarity

Cancel the context after the client has been cleaned up.

-	defer cancel()
-	defer client.Cleanup()
+	defer client.Cleanup()
+	defer cancel()

Likely an incorrect or invalid review comment.

tests/core-providers/tests.go (1)

26-40: 👏 Nice refactor to a slice of functions

Switching to a slice (testScenarios := []TestScenarioFunc{ ... }) removes a lot of duplication and makes adding new scenarios trivial. Good improvement!

tests/core-providers/openai_test.go (1)

1-2: Package name deviates from the agreed package main.

Past feedback (and the stored learning) indicates a deliberate choice to keep the test files in package main.
Switching to package tests here breaks that convention and will compile these files into a distinct test binary, potentially duplicating init paths and global state.

If this was accidental, revert:

-package tests
+package main

Otherwise please confirm the intent so we can update the convention everywhere.

tests/core-providers/anthropic_test.go (1)

31-34: Verify that Anthropic actually supports the image scenarios.

ImageURL, ImageBase64, and MultipleImages are enabled, but Anthropic’s Claude models currently expose no image generation/analysis endpoints.
If these inevitably skip/fail, disable them to keep the noise level low.

tests/core-providers/README.md (1)

20-25: 🧹 Nitpick (assertive)

Minor wording tweak – use the noun “replacement” not the verb “replace”.

-1. **Uncomment the replace directive** in `tests/core-providers/go.mod`:
+1. **Uncomment the replacement directive** in `tests/core-providers/go.mod`:

[pick_nit]

⛔ Skipped due to learnings
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:38-38
Timestamp: 2025-06-16T03:54:47.985Z
Learning: The `core-providers-test` module in `tests/core-providers/` is an internal testing module that will never be consumed as a dependency by external projects, so the replace directive pointing to `../../core` is acceptable for local development and testing purposes.
🧰 Tools
🪛 LanguageTool

[grammar] ~20-~20: The word ‘replace’ is a verb. Did you mean the noun “replacement”?
Context: ... test your changes: 1. Uncomment the replace directive in `tests/core-providers/go...

(PREPOSITION_VERB)

Comment thread transports/README.md
Comment thread tests/core-providers/go.mod
Comment thread tests/core-providers/cohere_test.go
Comment thread tests/core-providers/scenarios/multiple_images.go
Comment thread tests/core-providers/scenarios/image_url.go
Comment thread tests/core-providers/scenarios/multiple_tool_calls.go Outdated
Comment thread tests/core-providers/scenarios/utils.go Outdated
Comment thread tests/core-providers/config/account.go
Comment thread tests/core-providers/config/account.go
Comment thread tests/core-providers/config/setup.go
@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 06-14-feat_tests_added_for_core-providers_in_root_dir branch from 9b6c9db to 37c9055 Compare June 16, 2025 05:23
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🔭 Outside diff range comments (1)
transports/config.example.json (1)

57-60: 🛠️ Refactor suggestion

Use standard AWS credential names to prevent mis-configuration.

value currently references env.BEDROCK_API_KEY, but the meta section already expects
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY. Keeping two naming schemes is confusing and
forces extra env-var duplication.

-        "value": "env.BEDROCK_API_KEY",
+        "value": "env.AWS_ACCESS_KEY_ID",

Aligning the names makes the file usable out-of-the-box for most AWS setups.

Also applies to: 75-77

♻️ Duplicate comments (29)
README.md (1)

233-235: 🧹 Nitpick (assertive)

Trailing re-appears in tree diagram and tests/core-providers is still implicit

The exact same visual glitch that was pointed out earlier is back (│ └── ...│).
Please drop the stray pipe and explicitly show the new tests/core-providers folder to avoid confusion.

-│   └── ...│
+│   └── core-providers/
+│       └── ...
tests/core-providers/go.mod (2)

38-38: Vestigial commented‐out replace directive still present
We flagged this earlier; leaving it commented out invites future copy-paste confusion. Please delete the line entirely if it’s no longer needed.


10-36: 🧹 Nitpick (assertive)

Consolidate require blocks & prune explicit indirects

Two separate require blocks plus the long list of // indirect entries add noise and will quickly diverge from reality.
A single block containing only the direct deps (bifrost/core, testify) and an occasional go mod tidy keeps the file leaner and self-maintaining.

-require (
-	github.com/maximhq/bifrost/core v1.1.2
-	github.com/stretchr/testify v1.10.0
-)
-
-require (
-	cloud.google.com/go/compute/metadata v0.3.0 // indirect
-	...
-	gopkg.in/yaml.v3 v3.0.1 // indirect
-)
+require (
+	github.com/maximhq/bifrost/core v1.1.2
+	github.com/stretchr/testify v1.10.0
+)

Then run:

go mod tidy
tests/core-providers/anthropic_test.go (1)

11-12: Enable parallel execution for faster CI (already raised earlier)
A single t.Parallel() at the start lets provider suites run concurrently and costs nothing.

tests/core-providers/config/setup.go (1)

14-18: 🧹 Nitpick (assertive)

Hard-coded duration hides intent—prefer time-unit constant

The comment says “5 minutes” but the code uses 300 * time.Second. Use the clearer expression and keep the comment in sync.

-	TestTimeout = 300 * time.Second
+	TestTimeout = 5 * time.Minute
tests/core-providers/azure_test.go (2)

11-12: Parallelise the test (comment repeated from earlier review)
Adding t.Parallel() would let Azure tests run concurrently with the others.


1-2: 🧹 Nitpick (assertive)

Package mismatch with rest of suite

Same note as for Anthropic/OpenAI tests—switch to package main for consistency and to avoid mixed packages in the module.

-package tests
+package main
tests/core-providers/cohere_test.go (2)

1-2: 🛠️ Refactor suggestion

Package should follow suite convention (package main).

All other provider tests use package main, and the long-term learning explicitly notes the user’s preference.
Staying consistent avoids import-cycle surprises.

-package tests
+package main

11-18: 🧹 Nitpick (assertive)

Mark the test as parallel for faster CI runs.

All scenario sub-tests are independent; letting the root test run in parallel speeds up the whole suite.

 func TestCohere(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()
tests/core-providers/scenarios/image_base64.go (1)

22-28: 🧹 Nitpick (assertive)

Run sub-test in parallel (matches other scenarios).

-	t.Run("ImageBase64", func(t *testing.T) {
+	t.Run("ImageBase64", func(t *testing.T) {
+		t.Parallel()
tests/core-providers/scenarios/image_url.go (1)

23-27: 🧹 Nitpick (assertive)

Sub-test still not parallel – repeats earlier feedback.

Same optimisation flagged before; please add t.Parallel().

-	t.Run("ImageURL", func(t *testing.T) {
+	t.Run("ImageURL", func(t *testing.T) {
+		t.Parallel()
tests/core-providers/vertex_test.go (2)

1-2: 🛠️ Refactor suggestion

Package name diverges from rest of suite.

Stay consistent with package main.

-package tests
+package main

11-18: 🧹 Nitpick (assertive)

Enable parallel execution for Vertex test.

 func TestVertex(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()
tests/core-providers/bedrock_test.go (2)

1-2: 🛠️ Refactor suggestion

Package name inconsistency – still using “tests”

Earlier feedback highlighted that using package tests is inconsistent with the other scenario files (which use package scenarios) and with Go’s standard naming conventions. It also prevents the test file from accessing un-exported helpers in the same directory.

-package tests
+package scenarios

11-18: 🧹 Nitpick (assertive)

Enable parallel execution of the Bedrock test

TestBedrock is completely independent from the other provider tests. Calling t.Parallel() at the top lets it run concurrently, shaving minutes off the CI wall-clock time.

 func TestBedrock(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()
tests/core-providers/scenarios/simple_chat.go (1)

22-23: 🧹 Nitpick (assertive)

Run sub-test in parallel

The scenario sub-test is self-contained and safe to parallelise, consistent with other scenario files.

-	t.Run("SimpleChat", func(t *testing.T) {
+	t.Run("SimpleChat", func(t *testing.T) {
+		t.Parallel()
tests/core-providers/scenarios/multiple_images.go (1)

22-23: 🧹 Nitpick (assertive)

Missing t.Parallel()

Same parallelism nitpick as previously raised – add the call to keep test run-time low.

-	t.Run("MultipleImages", func(t *testing.T) {
+	t.Run("MultipleImages", func(t *testing.T) {
+		t.Parallel()
tests/core-providers/scenarios/complete_end_to_end.go (2)

22-23: 🧹 Nitpick (assertive)

Sub-test isn’t parallel

Consistent with other scenario tests, mark this one as parallel.

-	t.Run("CompleteEnd2End", func(t *testing.T) {
+	t.Run("CompleteEnd2End", func(t *testing.T) {
+		t.Parallel()

62-70: 🛠️ Refactor suggestion

Guard against empty toolCallID to avoid silent regressions

If neither ID nor Function.Name is present, toolCallID remains empty and the test silently proceeds. Assert non-emptiness so that provider regressions are caught early.

 				if toolCalls[0].ID != nil {
 					toolCallID = *toolCalls[0].ID
 				} else if toolCalls[0].Function.Name != nil {
 					toolCallID = *toolCalls[0].Function.Name
 				}
+				require.NotEmpty(t, toolCallID,
+					"toolCallID must not be empty – provider returned neither ID nor Function.Name")
tests/core-providers/scenarios/tool_calls.go (1)

22-23: 🧹 Nitpick (assertive)

Add t.Parallel() for the ToolCalls scenario

Parallel execution is safe here and aligns this file with the rest of the suite.

-	t.Run("ToolCalls", func(t *testing.T) {
+	t.Run("ToolCalls", func(t *testing.T) {
+		t.Parallel()
tests/core-providers/scenarios/end_to_end_tool_calling.go (1)

23-24: Add t.Parallel() for consistency & speed
All other scenario sub-tests were previously flagged to run in parallel. Adding it here keeps the suite uniform and shortens wall-clock time.

tests/core-providers/scenarios/provider_specific.go (1)

22-24: Run the provider-specific sub-test in parallel
Keeps it aligned with the rest of the suite and doesn’t interfere with shared resources.

tests/core-providers/scenarios/text_completion.go (1)

22-24: Enable parallel execution of the text-completion sub-test
Same rationale as earlier reviews – boosts CI throughput and mirrors other scenarios.

tests/core-providers/scenarios/multi_turn_conversation.go (2)

23-26: Mark sub-test as parallel for symmetry
Parallelising keeps execution time low and is consistent with other scenarios.


49-52: Remove duplicate of the initial user message
Repeating “My name is Alice …” in the second turn makes the memory test less strict because the model can simply re-read the name. Dropping it better verifies context retention.

tests/core-providers/scenarios/multiple_tool_calls.go (2)

21-23: Add t.Parallel() for the multiple-tool-calls scenario
Consistent with other tests and reduces total run time.


64-68: Assert expected tool names, not just presence
The test currently accepts any two tool calls. Validate that the provider actually invoked get_weather and calculate to catch regressions.

tests/core-providers/config/account.go (2)

189-192: 🧹 Nitpick (assertive)

Hard-coded Vertex region reduces flexibility

Locking to us-central1 forces contributors to that region.
Expose it via VERTEX_REGION with the same default:

- Region:          "us-central1",
+ Region:          getEnvWithDefault("VERTEX_REGION", "us-central1"),

144-147: ⚠️ Potential issue

AccessKeyID missing in Bedrock meta-config

meta.BedrockMetaConfig usually needs both AccessKeyID and SecretAccessKey.
Add the field and pull from AWS_ACCESS_KEY_ID to prevent auth failures.

 MetaConfig: &meta.BedrockMetaConfig{
-    SecretAccessKey: os.Getenv("AWS_SECRET_ACCESS_KEY"),
+    AccessKeyID:     os.Getenv("AWS_ACCESS_KEY_ID"),
+    SecretAccessKey: os.Getenv("AWS_SECRET_ACCESS_KEY"),
     Region:          bifrost.Ptr(getEnvWithDefault("AWS_REGION", "us-east-1")),
 },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b6c9db and 37c9055.

⛔ Files ignored due to path filters (2)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (41)
  • README.md (1 hunks)
  • core/go.mod (0 hunks)
  • core/tests/account.go (0 hunks)
  • core/tests/anthropic_test.go (0 hunks)
  • core/tests/azure_test.go (0 hunks)
  • core/tests/bedrock_test.go (0 hunks)
  • core/tests/cohere_test.go (0 hunks)
  • core/tests/e2e_tool_test.go (0 hunks)
  • core/tests/openai_test.go (0 hunks)
  • core/tests/setup.go (0 hunks)
  • core/tests/tests.go (0 hunks)
  • core/tests/vertex_test.go (0 hunks)
  • docs/providers.md (1 hunks)
  • tests/core-providers/README.md (1 hunks)
  • tests/core-providers/anthropic_test.go (1 hunks)
  • tests/core-providers/azure_test.go (1 hunks)
  • tests/core-providers/bedrock_test.go (1 hunks)
  • tests/core-providers/cohere_test.go (1 hunks)
  • tests/core-providers/config/account.go (1 hunks)
  • tests/core-providers/config/setup.go (1 hunks)
  • tests/core-providers/go.mod (1 hunks)
  • tests/core-providers/openai_test.go (1 hunks)
  • tests/core-providers/scenarios/automatic_function_calling.go (1 hunks)
  • tests/core-providers/scenarios/complete_end_to_end.go (1 hunks)
  • tests/core-providers/scenarios/end_to_end_tool_calling.go (1 hunks)
  • tests/core-providers/scenarios/image_base64.go (1 hunks)
  • tests/core-providers/scenarios/image_url.go (1 hunks)
  • tests/core-providers/scenarios/multi_turn_conversation.go (1 hunks)
  • tests/core-providers/scenarios/multiple_images.go (1 hunks)
  • tests/core-providers/scenarios/multiple_tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/provider_specific.go (1 hunks)
  • tests/core-providers/scenarios/simple_chat.go (1 hunks)
  • tests/core-providers/scenarios/text_completion.go (1 hunks)
  • tests/core-providers/scenarios/tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/utils.go (1 hunks)
  • tests/core-providers/tests.go (1 hunks)
  • tests/core-providers/vertex_test.go (1 hunks)
  • transports/README.md (1 hunks)
  • transports/bifrost-http/integrations/openai/router.go (1 hunks)
  • transports/bifrost-http/lib/config.go (1 hunks)
  • transports/config.example.json (3 hunks)
💤 Files with no reviewable changes (11)
  • core/go.mod
  • core/tests/bedrock_test.go
  • core/tests/vertex_test.go
  • core/tests/openai_test.go
  • core/tests/anthropic_test.go
  • core/tests/cohere_test.go
  • core/tests/setup.go
  • core/tests/azure_test.go
  • core/tests/e2e_tool_test.go
  • core/tests/tests.go
  • core/tests/account.go
🧰 Additional context used
🧠 Learnings (17)
tests/core-providers/go.mod (3)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:3-4
Timestamp: 2025-06-16T04:27:53.527Z
Learning: In Go module files, `go 1.24.1` (with patch version) can work fine in some setups, contrary to the general rule that go directives should only include major.minor versions.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:38-38
Timestamp: 2025-06-16T03:54:47.985Z
Learning: The `core-providers-test` module in `tests/core-providers/` is an internal testing module that will never be consumed as a dependency by external projects, so the replace directive pointing to `../../core` is acceptable for local development and testing purposes.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:3-4
Timestamp: 2025-06-16T03:55:16.928Z
Learning: Go 1.24 was released in February 2025 and is stable and available for use in go.mod files.
tests/core-providers/scenarios/image_base64.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/image_base64.go:33-36
Timestamp: 2025-06-16T04:10:27.584Z
Learning: Base64 image handling in Bifrost test scenarios does not require provider-specific parameters or custom ExtraParams - all providers handle base64 images uniformly without special configuration.
tests/core-providers/openai_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.401Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/vertex_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.401Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/scenarios/simple_chat.go (2)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.425Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
tests/core-providers/scenarios/automatic_function_calling.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/automatic_function_calling.go:22-22
Timestamp: 2025-06-16T04:55:11.864Z
Learning: In the Bifrost test suite (tests/core-providers), parallel tests using t.Parallel() are not being implemented currently. The team plans to add parallel test execution in future enhancements.
tests/core-providers/azure_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.401Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/scenarios/text_completion.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
tests/core-providers/scenarios/complete_end_to_end.go (3)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.406Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:57-62
Timestamp: 2025-06-16T04:14:25.004Z
Learning: In the Bifrost codebase, toolCalls[0].Function refers to a FunctionCall struct, and FunctionCall.Name is a pointer to string (*string) that requires dereferencing with the * operator to get the actual string value.
tests/core-providers/scenarios/provider_specific.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/automatic_function_calling.go:22-22
Timestamp: 2025-06-16T04:55:11.864Z
Learning: In the Bifrost test suite (tests/core-providers), parallel tests using t.Parallel() are not being implemented currently. The team plans to add parallel test execution in future enhancements.
tests/core-providers/tests.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/automatic_function_calling.go:22-22
Timestamp: 2025-06-16T04:55:11.864Z
Learning: In the Bifrost test suite (tests/core-providers), parallel tests using t.Parallel() are not being implemented currently. The team plans to add parallel test execution in future enhancements.
transports/config.example.json (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: transports/config.example.json:36-42
Timestamp: 2025-06-16T03:55:30.922Z
Learning: Claude 3.7 Sonnet (claude-3-7-sonnet-20250219) is a valid Anthropic model released on February 24, 2025. It's their most intelligent model featuring hybrid reasoning capabilities and improved coding performance.
tests/core-providers/scenarios/tool_calls.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
tests/core-providers/scenarios/end_to_end_tool_calling.go (4)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.406Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.425Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:57-62
Timestamp: 2025-06-16T04:14:25.004Z
Learning: In the Bifrost codebase, toolCalls[0].Function refers to a FunctionCall struct, and FunctionCall.Name is a pointer to string (*string) that requires dereferencing with the * operator to get the actual string value.
tests/core-providers/scenarios/multiple_tool_calls.go (2)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#55
File: core/providers/anthropic.go:483-494
Timestamp: 2025-06-04T10:04:30.181Z
Learning: In the Anthropic provider (core/providers/anthropic.go), parallel tool calls support including the DisableParallelToolUse flag will be implemented in later commits as it's a relatively new feature that's not commonly used yet. The development approach prioritizes core functionality first.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/multiple_tool_calls.go:27-31
Timestamp: 2025-06-16T04:05:47.784Z
Learning: ParallelToolCalls parameter is not supported by many AI providers, so it should be avoided in cross-provider test suites to maintain compatibility across different providers.
tests/core-providers/cohere_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.401Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/config/account.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/config/account.go:55-101
Timestamp: 2025-06-16T04:25:00.785Z
Learning: In the Bifrost test account implementation, the user prefers to let Bifrost itself handle missing API key errors rather than adding early validation in the GetKeysForProvider method.
🧬 Code Graph Analysis (10)
tests/core-providers/config/setup.go (6)
core/bifrost.go (2)
  • Bifrost (39-51)
  • Init (186-249)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestAccount (44-44)
core/schemas/bifrost.go (1)
  • BifrostConfig (16-22)
core/schemas/account.go (1)
  • Account (14-27)
core/schemas/logger.go (2)
  • Logger (18-35)
  • LogLevelDebug (9-9)
core/logger.go (1)
  • NewDefaultLogger (22-26)
tests/core-providers/scenarios/image_base64.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (4)
  • CreateImageMessage (83-101)
  • TestImageBase64 (71-71)
  • MergeModelParameters (158-208)
  • GetResultContent (117-153)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/simple_chat.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (4)
  • BifrostMessage (148-156)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • ModelParameters (80-94)
tests/core-providers/scenarios/utils.go (3)
  • CreateBasicChatMessage (74-81)
  • MergeModelParameters (158-208)
  • GetResultContent (117-153)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/azure_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Azure (40-40)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/scenarios/image_url.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (4)
  • CreateImageMessage (83-101)
  • TestImageURL (70-70)
  • MergeModelParameters (158-208)
  • GetResultContent (117-153)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/provider_specific.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (3)
  • CreateBasicChatMessage (74-81)
  • MergeModelParameters (158-208)
  • GetResultContent (117-153)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/tool_calls.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (4)
  • CreateBasicChatMessage (74-81)
  • MergeModelParameters (158-208)
  • WeatherToolDefinition (11-31)
  • GetResultContent (117-153)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/multiple_tool_calls.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (5)
  • CreateBasicChatMessage (74-81)
  • MergeModelParameters (158-208)
  • WeatherToolDefinition (11-31)
  • CalculatorToolDefinition (33-49)
  • GetResultContent (117-153)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/bedrock_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Bedrock (42-42)
  • Fallback (72-75)
  • OpenAI (39-39)
tests/core-providers/scenarios/multiple_images.go (5)
core/bifrost.go (2)
  • Bifrost (39-51)
  • ChatCompletionRequest (24-24)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (10)
  • BifrostMessage (148-156)
  • ModelChatMessageRoleUser (29-29)
  • MessageContent (158-161)
  • ContentBlock (209-213)
  • ContentBlockTypeText (205-205)
  • ContentBlockTypeImage (206-206)
  • ImageURLStruct (229-232)
  • BifrostRequest (59-69)
  • RequestInput (51-54)
  • ModelParameters (80-94)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/utils.go (4)
  • TestImageURL (70-70)
  • TestImageBase64 (71-71)
  • MergeModelParameters (158-208)
  • GetResultContent (117-153)
🪛 LanguageTool
tests/core-providers/README.md

[grammar] ~20-~20: The word ‘replace’ is a verb. Did you mean the noun “replacement”?
Context: ... test your changes: 1. Uncomment the replace directive in `tests/core-providers/go...

(PREPOSITION_VERB)


[grammar] ~167-~167: This phrase is duplicated. You should probably use “Text Completion” only once.
Context: ...- Streaming Chat Completion - Streaming Text Completion - Text Completion with Parameters - Chat Completion with ...

(PHRASE_REPETITION)

🔇 Additional comments (5)
transports/bifrost-http/integrations/openai/router.go (1)

21-22: Remember to update all external docs & client SDKs to the new /openai/chat/completions path

The breaking-route change is now merged without a compatibility alias.
Double-check that:

  1. docs/http-transport-api.md and README snippets no longer reference /openai/v1/chat/completions.
  2. The new provider test suite is pointing to the updated route.

This avoids silent 404s for users following docs or examples shipped in the same PR.

docs/providers.md (1)

73-76: 🧹 Nitpick (assertive)

Inconsistent region env-var (BEDROCK_REGION vs AWS_REGION)

You standardised on AWS_SECRET_ACCESS_KEY, but the region placeholder keeps the Bedrock-specific prefix.
For parity with AWS SDK defaults (and to match AWS_SECRET_ACCESS_KEY) consider:

-    Region:             "env.BEDROCK_REGION",
+    Region:             "env.AWS_REGION",

The same tweak will also make docker-compose setups and IAM-based auth work out of the box.

Likely an incorrect or invalid review comment.

tests/core-providers/scenarios/automatic_function_calling.go (1)

48-49: 🧹 Nitpick (assertive)

Prefer require.NoError for clarity

require.Nilf(t, err, …) works, but require.NoError(t, err, …) is the conventional, self-describing helper.
Switching improves readability and avoids the cognitive “nil == err” double-take.

⛔ Skipped due to learnings
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.406Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.689Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
tests/core-providers/tests.go (1)

42-45: Looks good – runner is concise and future-proof

Using a slice of scenario funcs keeps the list declarative and easy to extend.
No issues spotted here.

tests/core-providers/README.md (1)

74-78: go test -debug is non-standard

go test does not recognise a -debug flag out of the box.
Clarify that this relies on a custom -debug build tag or remove the example to avoid confusion.

Comment thread transports/bifrost-http/lib/config.go
Comment thread transports/README.md
Comment thread tests/core-providers/anthropic_test.go
Comment thread tests/core-providers/openai_test.go
Comment thread tests/core-providers/scenarios/end_to_end_tool_calling.go
Comment thread tests/core-providers/scenarios/automatic_function_calling.go Outdated
Comment thread tests/core-providers/config/account.go
Comment thread tests/core-providers/scenarios/utils.go
@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 06-14-feat_tests_added_for_core-providers_in_root_dir branch from 37c9055 to b6770e9 Compare June 16, 2025 05:42
@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 06-14-feat_tests_added_for_core-providers_in_root_dir branch from b6770e9 to 1541d1b Compare June 16, 2025 14:36
@Pratham-Mishra04 Pratham-Mishra04 marked this pull request as ready for review June 16, 2025 14:38
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 14

♻️ Duplicate comments (23)
tests/core-providers/go.mod (2)

10-36: Redundant second require block & pinned indirects clutter the module file

Having two separate require blocks and explicitly pinning every indirect dependency adds noise and requires continuous manual maintenance. A single block with only direct deps keeps the file lean ‒ go mod tidy will record the minimal set of indirects when needed.


38-38: Stale commented-out replace directive

The disabled line is vestigial and risks being copy-pasted into other branches. Delete it (or guard with a build tag) to avoid future confusion.

tests/core-providers/openai_test.go (1)

1-2: Package name deviates from the agreed “package main” convention for tests

Prior discussion established that this directory’s tests stay in package main. Using package tests breaks that convention and can cause go test ./... collisions.

tests/core-providers/mistral_test.go (1)

1-2: Package name inconsistency

Same issue as in openai_test.go; stick to the agreed package main to keep the suite uniform.

transports/config.example.json (1)

110-127: Azure entry still uses raw OpenAI slug instead of deployment name

Azure OpenAI expects deployment identifiers (often gpt-35-turbo, gpt-4o-aug, etc.) rather than plain model slugs. Leaving "gpt-4o" here may mislead new users and fail at runtime without a matching deployment. Consider adding a placeholder like "<deployment-name-for-gpt4o>" or documenting the mapping.

tests/core-providers/azure_test.go (2)

11-12: Mark the test as parallel

This exact nit was raised before – it still applies. Add t.Parallel() immediately after the function begins so the Azure suite can run concurrently with the others:

 func TestAzure(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()

1-1: Use package main to stay consistent with the rest of the suite

All existing provider tests in tests/core-providers deliberately live in package main (per earlier discussion/learning) to avoid import-cycle headaches.
Keep the convention uniform:

-package tests
+package main
tests/core-providers/anthropic_test.go (2)

11-12: Enable parallel execution

Match other provider tests to speed up CI:

 func TestAnthropic(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()

1-1: Switch to package main for consistency

The agreed convention for this directory is package main; keeping a different package name here introduces linker conflicts and breaks the uniform test surface.

-package tests
+package main
tests/core-providers/cohere_test.go (2)

11-12: Add t.Parallel()

 func TestCohere(t *testing.T) {
+	t.Parallel()
 	client, ctx, cancel, err := config.SetupTest()

1-1: Align package name with convention

-package tests
+package main
tests/core-providers/scenarios/image_base64.go (1)

22-22: Optionally parallelise the sub-test

If provider rate-limits allow, parallel sub-tests shorten the suite:

-	t.Run("ImageBase64", func(t *testing.T) {
+	t.Run("ImageBase64", func(t *testing.T) {
+		t.Parallel()
tests/core-providers/scenarios/image_url.go (1)

23-26: Run the scenario in parallel for faster CI.

All scenario sub-tests are independent; adding t.Parallel() here lets them fan-out and noticeably reduces wall-clock time.

 t.Run("ImageURL", func(t *testing.T) {
+	t.Parallel()
tests/core-providers/bedrock_test.go (1)

11-18: Enable parallel execution of the top-level test.

 func TestBedrock(t *testing.T) {
+	t.Parallel()

This gives a free speed-up because each provider test has its own client / ctx.

tests/core-providers/vertex_test.go (1)

11-18: Mark the Vertex test as parallel.

 func TestVertex(t *testing.T) {
+	t.Parallel()

Keeps execution time down when multiple providers are tested.

tests/core-providers/scenarios/simple_chat.go (1)

22-26: Parallelise the sub-test.

 t.Run("SimpleChat", func(t *testing.T) {
+	t.Parallel()

Aligns with other scenarios and speeds up the suite.

tests/core-providers/scenarios/tool_calls.go (1)

22-26: Add t.Parallel() for consistency and speed.

 t.Run("ToolCalls", func(t *testing.T) {
+	t.Parallel()

This mirrors other scenario files and lets the test run concurrently.

tests/core-providers/scenarios/multiple_images.go (1)

22-24: Run sub-test in parallel (same concern raised earlier)

The suite still executes serially, unlike other Go test suites.
Marking with t.Parallel() would align with earlier feedback.

tests/core-providers/scenarios/text_completion.go (1)

22-22: Consider t.Parallel() for symmetry – previously suggested

Running the sub-test concurrently shortens CI time; same suggestion was made on earlier commits.

tests/core-providers/scenarios/multi_turn_conversation.go (1)

50-56: Duplicated first user message may mask context-retention issues

Re-sending userMessage1 in messages2 was flagged before; omitting it gives a stricter memory test.

tests/core-providers/scenarios/end_to_end_tool_calling.go (1)

85-88: Appending every assistant choice inflates token usage

Prior feedback suggested including only the top choice to avoid hitting context limits on small models.

tests/core-providers/scenarios/utils.go (1)

216-228: Shallow copy still shares slice / map fields
Same concern raised earlier: mutating Tools, StopSequences, or ExtraParams on the copy mutates the original. Consider deep-copying or clearly documenting the shared ownership.

tests/core-providers/config/account.go (1)

161-168: AccessKeyID missing in Bedrock meta config

meta.BedrockMetaConfig normally requires both AccessKeyID and SecretAccessKey.
Without the ID, requests will be signed incorrectly and fail.

			MetaConfig: &meta.BedrockMetaConfig{
+				AccessKeyID:     os.Getenv("AWS_ACCESS_KEY_ID"),
 				SecretAccessKey: os.Getenv("AWS_SECRET_ACCESS_KEY"),
 				Region:          bifrost.Ptr(getEnvWithDefault("AWS_REGION", "us-east-1")),
			},
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 37c9055 and 1541d1b.

⛔ Files ignored due to path filters (12)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
  • tests/transports-integrations/tests/__pycache__/__init__.cpython-313.pyc is excluded by !**/*.pyc
  • tests/transports-integrations/tests/__pycache__/conftest.cpython-313-pytest-8.4.0.pyc is excluded by !**/*.pyc
  • tests/transports-integrations/tests/integrations/__pycache__/__init__.cpython-313.pyc is excluded by !**/*.pyc
  • tests/transports-integrations/tests/integrations/__pycache__/test_anthropic.cpython-313-pytest-8.4.0.pyc is excluded by !**/*.pyc
  • tests/transports-integrations/tests/integrations/__pycache__/test_google.cpython-313-pytest-8.4.0.pyc is excluded by !**/*.pyc
  • tests/transports-integrations/tests/integrations/__pycache__/test_litellm.cpython-313-pytest-8.4.0.pyc is excluded by !**/*.pyc
  • tests/transports-integrations/tests/integrations/__pycache__/test_openai.cpython-313-pytest-8.4.0.pyc is excluded by !**/*.pyc
  • tests/transports-integrations/tests/utils/__pycache__/__init__.cpython-313.pyc is excluded by !**/*.pyc
  • tests/transports-integrations/tests/utils/__pycache__/common.cpython-313.pyc is excluded by !**/*.pyc
  • tests/transports-integrations/tests/utils/__pycache__/config_loader.cpython-313.pyc is excluded by !**/*.pyc
📒 Files selected for processing (43)
  • README.md (1 hunks)
  • core/go.mod (0 hunks)
  • core/tests/account.go (0 hunks)
  • core/tests/anthropic_test.go (0 hunks)
  • core/tests/azure_test.go (0 hunks)
  • core/tests/bedrock_test.go (0 hunks)
  • core/tests/cohere_test.go (0 hunks)
  • core/tests/e2e_tool_test.go (0 hunks)
  • core/tests/openai_test.go (0 hunks)
  • core/tests/setup.go (0 hunks)
  • core/tests/tests.go (0 hunks)
  • core/tests/vertex_test.go (0 hunks)
  • docs/providers.md (1 hunks)
  • tests/core-providers/README.md (1 hunks)
  • tests/core-providers/anthropic_test.go (1 hunks)
  • tests/core-providers/azure_test.go (1 hunks)
  • tests/core-providers/bedrock_test.go (1 hunks)
  • tests/core-providers/cohere_test.go (1 hunks)
  • tests/core-providers/config/account.go (1 hunks)
  • tests/core-providers/config/setup.go (1 hunks)
  • tests/core-providers/go.mod (1 hunks)
  • tests/core-providers/mistral_test.go (1 hunks)
  • tests/core-providers/ollama_test.go (1 hunks)
  • tests/core-providers/openai_test.go (1 hunks)
  • tests/core-providers/scenarios/automatic_function_calling.go (1 hunks)
  • tests/core-providers/scenarios/complete_end_to_end.go (1 hunks)
  • tests/core-providers/scenarios/end_to_end_tool_calling.go (1 hunks)
  • tests/core-providers/scenarios/image_base64.go (1 hunks)
  • tests/core-providers/scenarios/image_url.go (1 hunks)
  • tests/core-providers/scenarios/multi_turn_conversation.go (1 hunks)
  • tests/core-providers/scenarios/multiple_images.go (1 hunks)
  • tests/core-providers/scenarios/multiple_tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/provider_specific.go (1 hunks)
  • tests/core-providers/scenarios/simple_chat.go (1 hunks)
  • tests/core-providers/scenarios/text_completion.go (1 hunks)
  • tests/core-providers/scenarios/tool_calls.go (1 hunks)
  • tests/core-providers/scenarios/utils.go (1 hunks)
  • tests/core-providers/tests.go (1 hunks)
  • tests/core-providers/vertex_test.go (1 hunks)
  • transports/README.md (1 hunks)
  • transports/bifrost-http/integrations/openai/router.go (1 hunks)
  • transports/bifrost-http/lib/config.go (1 hunks)
  • transports/config.example.json (3 hunks)
💤 Files with no reviewable changes (11)
  • core/go.mod
  • core/tests/bedrock_test.go
  • core/tests/anthropic_test.go
  • core/tests/openai_test.go
  • core/tests/azure_test.go
  • core/tests/cohere_test.go
  • core/tests/setup.go
  • core/tests/vertex_test.go
  • core/tests/e2e_tool_test.go
  • core/tests/tests.go
  • core/tests/account.go
🧰 Additional context used
🧠 Learnings (18)
tests/core-providers/vertex_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.409Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/azure_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.409Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/go.mod (3)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:3-4
Timestamp: 2025-06-16T04:27:53.538Z
Learning: In Go module files, `go 1.24.1` (with patch version) can work fine in some setups, contrary to the general rule that go directives should only include major.minor versions.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:38-38
Timestamp: 2025-06-16T03:54:48.005Z
Learning: The `core-providers-test` module in `tests/core-providers/` is an internal testing module that will never be consumed as a dependency by external projects, so the replace directive pointing to `../../core` is acceptable for local development and testing purposes.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/go.mod:3-4
Timestamp: 2025-06-16T03:55:16.949Z
Learning: Go 1.24 was released in February 2025 and is stable and available for use in go.mod files.
tests/core-providers/scenarios/image_base64.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/image_base64.go:33-36
Timestamp: 2025-06-16T04:10:27.605Z
Learning: Base64 image handling in Bifrost test scenarios does not require provider-specific parameters or custom ExtraParams - all providers handle base64 images uniformly without special configuration.
tests/core-providers/cohere_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.409Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/scenarios/tool_calls.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.755Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
tests/core-providers/anthropic_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.409Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/scenarios/multiple_tool_calls.go (2)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#55
File: core/providers/anthropic.go:483-494
Timestamp: 2025-06-04T10:04:30.181Z
Learning: In the Anthropic provider (core/providers/anthropic.go), parallel tool calls support including the DisableParallelToolUse flag will be implemented in later commits as it's a relatively new feature that's not commonly used yet. The development approach prioritizes core functionality first.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/multiple_tool_calls.go:27-31
Timestamp: 2025-06-16T04:05:47.793Z
Learning: ParallelToolCalls parameter is not supported by many AI providers, so it should be avoided in cross-provider test suites to maintain compatibility across different providers.
transports/config.example.json (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: transports/config.example.json:36-42
Timestamp: 2025-06-16T03:55:30.933Z
Learning: Claude 3.7 Sonnet (claude-3-7-sonnet-20250219) is a valid Anthropic model released on February 24, 2025. It's their most intelligent model featuring hybrid reasoning capabilities and improved coding performance.
tests/core-providers/scenarios/end_to_end_tool_calling.go (4)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.755Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.427Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.437Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:57-62
Timestamp: 2025-06-16T04:14:25.015Z
Learning: In the Bifrost codebase, toolCalls[0].Function refers to a FunctionCall struct, and FunctionCall.Name is a pointer to string (*string) that requires dereferencing with the * operator to get the actual string value.
tests/core-providers/scenarios/provider_specific.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/automatic_function_calling.go:22-22
Timestamp: 2025-06-16T04:55:11.886Z
Learning: In the Bifrost test suite (tests/core-providers), parallel tests using t.Parallel() are not being implemented currently. The team plans to add parallel test execution in future enhancements.
tests/core-providers/scenarios/complete_end_to_end.go (3)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:39-41
Timestamp: 2025-06-16T04:12:05.427Z
Learning: In the Bifrost system, error returns are of type `BifrostError` rather than the standard Go `error` interface. Therefore, use `require.Nilf(t, err, ...)` instead of `require.NoError(t, err)` when checking for errors in Bifrost function calls.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.755Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/complete_end_to_end.go:57-62
Timestamp: 2025-06-16T04:14:25.015Z
Learning: In the Bifrost codebase, toolCalls[0].Function refers to a FunctionCall struct, and FunctionCall.Name is a pointer to string (*string) that requires dereferencing with the * operator to get the actual string value.
tests/core-providers/scenarios/text_completion.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.755Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
tests/core-providers/tests.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/automatic_function_calling.go:22-22
Timestamp: 2025-06-16T04:55:11.886Z
Learning: In the Bifrost test suite (tests/core-providers), parallel tests using t.Parallel() are not being implemented currently. The team plans to add parallel test execution in future enhancements.
tests/core-providers/scenarios/automatic_function_calling.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/automatic_function_calling.go:22-22
Timestamp: 2025-06-16T04:55:11.886Z
Learning: In the Bifrost test suite (tests/core-providers), parallel tests using t.Parallel() are not being implemented currently. The team plans to add parallel test execution in future enhancements.
tests/core-providers/openai_test.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/openai_test.go:1-2
Timestamp: 2025-06-16T04:29:53.409Z
Learning: In the Bifrost project, the user prefers to use `package main` for test files in the tests/core-providers directory rather than more descriptive package names like `coreproviders_test`.
tests/core-providers/scenarios/simple_chat.go (2)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/simple_chat.go:39-41
Timestamp: 2025-06-16T04:13:42.755Z
Learning: In the Bifrost codebase, errors returned from methods like ChatCompletionRequest are of type BifrostError (a custom error type) rather than the standard Go error interface. Therefore, require.Nilf should be used for error assertions instead of require.NoErrorf.
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/scenarios/end_to_end_tool_calling.go:43-45
Timestamp: 2025-06-16T04:13:55.437Z
Learning: In the Bifrost codebase, errors returned from client methods like ChatCompletionRequest are of type BifrostError, not the standard error interface. For testing these errors, use require.Nilf instead of require.NoErrorf since BifrostError doesn't work with the standard error assertion methods.
tests/core-providers/config/account.go (1)
Learnt from: Pratham-Mishra04
PR: maximhq/bifrost#81
File: tests/core-providers/config/account.go:55-101
Timestamp: 2025-06-16T04:25:00.816Z
Learning: In the Bifrost test account implementation, the user prefers to let Bifrost itself handle missing API key errors rather than adding early validation in the GetKeysForProvider method.
🧬 Code Graph Analysis (14)
tests/core-providers/mistral_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (1)
  • Mistral (45-45)
tests/core-providers/ollama_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (1)
  • Ollama (46-46)
tests/core-providers/bedrock_test.go (4)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/provider.go (1)
  • Provider (154-161)
core/schemas/bifrost.go (3)
  • Bedrock (42-42)
  • Fallback (74-77)
  • OpenAI (39-39)
tests/core-providers/config/setup.go (6)
core/bifrost.go (2)
  • Bifrost (39-51)
  • Init (190-253)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestAccount (44-44)
core/schemas/bifrost.go (1)
  • BifrostConfig (16-22)
core/schemas/account.go (1)
  • Account (14-27)
core/schemas/logger.go (2)
  • Logger (18-35)
  • LogLevelDebug (9-9)
core/logger.go (1)
  • NewDefaultLogger (22-26)
tests/core-providers/cohere_test.go (3)
tests/core-providers/config/setup.go (1)
  • SetupTest (51-59)
tests/core-providers/config/account.go (2)
  • ComprehensiveTestConfig (33-41)
  • TestScenarios (17-30)
core/schemas/bifrost.go (3)
  • Cohere (43-43)
  • Fallback (74-77)
  • OpenAI (39-39)
tests/core-providers/scenarios/multiple_tool_calls.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (5)
  • CreateBasicChatMessage (74-81)
  • MergeModelParameters (158-208)
  • WeatherToolDefinition (11-31)
  • CalculatorToolDefinition (33-49)
  • GetResultContent (117-153)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/multiple_images.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/utils.go (4)
  • TestImageURL (70-70)
  • TestImageBase64 (71-71)
  • MergeModelParameters (158-208)
  • GetResultContent (117-153)
tests/core-providers/scenarios/provider_specific.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (4)
  • BifrostMessage (200-208)
  • ModelParameters (82-96)
  • BifrostRequest (61-71)
  • RequestInput (53-56)
tests/core-providers/scenarios/utils.go (3)
  • CreateBasicChatMessage (74-81)
  • MergeModelParameters (158-208)
  • GetResultContent (117-153)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/complete_end_to_end.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (7)
  • CreateBasicChatMessage (74-81)
  • MergeModelParameters (158-208)
  • WeatherToolDefinition (11-31)
  • GetResultContent (117-153)
  • CreateToolMessage (103-113)
  • CreateImageMessage (83-101)
  • TestImageURL (70-70)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/text_completion.go (3)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/utils.go (2)
  • MergeModelParameters (158-208)
  • GetResultContent (117-153)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/tests.go (13)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
tests/core-providers/scenarios/text_completion.go (1)
  • RunTextCompletionTest (16-45)
tests/core-providers/scenarios/simple_chat.go (1)
  • RunSimpleChatTest (16-48)
tests/core-providers/scenarios/multi_turn_conversation.go (1)
  • RunMultiTurnConversationTest (17-84)
tests/core-providers/scenarios/tool_calls.go (1)
  • RunToolCallsTest (16-79)
tests/core-providers/scenarios/multiple_tool_calls.go (1)
  • RunMultipleToolCallsTest (26-109)
tests/core-providers/scenarios/end_to_end_tool_calling.go (1)
  • RunEnd2EndToolCallingTest (17-121)
tests/core-providers/scenarios/automatic_function_calling.go (1)
  • RunAutomaticFunctionCallingTest (15-76)
tests/core-providers/scenarios/image_url.go (1)
  • RunImageURLTest (17-55)
tests/core-providers/scenarios/image_base64.go (1)
  • RunImageBase64Test (16-49)
tests/core-providers/scenarios/multiple_images.go (1)
  • RunMultipleImagesTest (16-71)
tests/core-providers/scenarios/complete_end_to_end.go (1)
  • RunCompleteEnd2EndTest (16-118)
tests/core-providers/scenarios/provider_specific.go (1)
  • RunProviderSpecificTest (16-55)
tests/core-providers/scenarios/automatic_function_calling.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (8)
  • BifrostMessage (200-208)
  • ModelParameters (82-96)
  • Tool (115-119)
  • ToolChoice (150-153)
  • ToolChoiceStruct (144-147)
  • Function (108-112)
  • ToolChoiceFunction (139-141)
  • AssistantMessage (273-278)
tests/core-providers/scenarios/utils.go (4)
  • CreateBasicChatMessage (74-81)
  • MergeModelParameters (158-208)
  • TimeToolDefinition (51-67)
  • GetResultContent (117-153)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/utils.go (2)
core/schemas/bifrost.go (15)
  • Tool (115-119)
  • Function (108-112)
  • FunctionParameters (99-105)
  • BifrostMessage (200-208)
  • ModelChatMessageRoleUser (29-29)
  • MessageContent (210-213)
  • ContentBlock (261-265)
  • ContentBlockTypeText (257-257)
  • ContentBlockTypeImage (258-258)
  • ImageURLStruct (281-284)
  • ModelChatMessageRoleTool (32-32)
  • ToolMessage (268-270)
  • BifrostResponse (289-299)
  • ModelParameters (82-96)
  • ToolChoice (150-153)
core/utils.go (1)
  • Ptr (5-7)
tests/core-providers/scenarios/simple_chat.go (4)
tests/core-providers/config/account.go (1)
  • ComprehensiveTestConfig (33-41)
core/schemas/bifrost.go (4)
  • BifrostMessage (200-208)
  • BifrostRequest (61-71)
  • RequestInput (53-56)
  • ModelParameters (82-96)
tests/core-providers/scenarios/utils.go (3)
  • CreateBasicChatMessage (74-81)
  • MergeModelParameters (158-208)
  • GetResultContent (117-153)
core/utils.go (1)
  • Ptr (5-7)
🪛 LanguageTool
tests/core-providers/README.md

[grammar] ~22-~22: The word ‘replace’ is a verb. Did you mean the noun “replacement”?
Context: ... test your changes: 1. Uncomment the replace directive in `tests/core-providers/go...

(PREPOSITION_VERB)


[grammar] ~188-~188: This phrase is duplicated. You should probably use “Text Completion” only once.
Context: ...- Streaming Chat Completion - Streaming Text Completion - Text Completion with Parameters - Chat Completion with ...

(PHRASE_REPETITION)


[grammar] ~395-~395: This phrase is duplicated. You should probably use “Add to” only once.
Context: ...rProvider()(if API key required) - Add toGetConfigForProvider() - Add toGetConfiguredProviders()` list 3. **Te...

(PHRASE_REPETITION)

🔇 Additional comments (9)
transports/bifrost-http/integrations/openai/router.go (1)

21-23: Confirm breaking-route decision & update public docs accordingly

/openai/chat/completions drops the historical /v1 segment.
All internal callers & docs (e.g. examples in transports/README.md) must now reference this new path otherwise they will 404.

Please grep the repo for openai/v1/chat/completions and update or alias as necessary.

transports/bifrost-http/lib/config.go (1)

47-52: Good catch – env-var names now consistent with AWS SDK defaults
Nothing else to call out. 👍

docs/providers.md (1)

81-83: Documentation now matches new env-var naming – looks correct

transports/README.md (1)

62-68: Env-var placeholders fixed – LGTM

tests/core-providers/mistral_test.go (1)

21-22: Verify model slug “pixtral-12b-latest”

I could not find any public reference to a Mistral model named “pixtral-12b-latest”. If this is a typo for “mixtral-8x7b”/“mistral-large-2402”, the tests will 400 at runtime. Please confirm the correct identifier.

tests/core-providers/bedrock_test.go (1)

1-2: Package name diverges from established convention – may break go test.

Earlier provider tests in this directory use package main; mixing main and tests in the same folder will not compile.
Confirm that every *_test.go file in tests/core-providers shares the same package identifier.

If they don’t, pick one (the project convention seems to be main) and rename accordingly.

tests/core-providers/vertex_test.go (1)

1-2: Consistent package naming required.

Same concern as in bedrock_test.go: mixing package main and package tests within the folder causes a build failure. Ensure a single package name is used across all files.

tests/core-providers/scenarios/multiple_images.go (1)

38-42: Base-64 data is sent via ImageURL field – confirm schema/provider accepts data: URIs

TestImageBase64 is a full data:image/...;base64, URI but is still placed in the ImageURL field.
If the provider / schema expects base-64 data in a dedicated ImageData (or similar) field, the request could be silently ignored or rejected.

#!/bin/bash
# Locate ImageURLStruct definition and check if base64 is documented/handled
rg --context 3 'type ImageURLStruct' | head -n 40
tests/core-providers/scenarios/provider_specific.go (1)

29-34: Parameter-merging helper used correctly

Good job re-using MergeModelParameters; default values are preserved and caller-overrides honoured.

Comment thread README.md
Comment thread tests/core-providers/config/setup.go
Comment thread tests/core-providers/ollama_test.go
Comment thread tests/core-providers/ollama_test.go
Comment on lines +11 to +13
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Use a single assertion style – switch the lone assert to require

Every other check in this file aborts on failure via require.*, while assert.* merely records a failure and continues.
Keeping the semantics consistent avoids accidental fall-through when an invariant is violated and lets you drop the extra import:

-import (
-    ...
-    "github.com/stretchr/testify/assert"
-    "github.com/stretchr/testify/require"
-)
+import (
+    ...
+    "github.com/stretchr/testify/require"
+)

-	finalContent := GetResultContent(finalResponse)
-	assert.NotEmpty(t, finalContent, "Final response content should not be empty")
+	finalContent := GetResultContent(finalResponse)
+	require.NotEmpty(t, finalContent, "Final response content should not be empty")
🤖 Prompt for AI Agents
In tests/core-providers/scenarios/complete_end_to_end.go around lines 11 to 13,
replace the lone usage of the assert package with require to maintain consistent
assertion style. Change all assert calls to require calls so that failures abort
the test immediately, preventing fall-through. Also, remove the import of the
assert package since it will no longer be used.

Comment thread tests/core-providers/config/account.go
Comment on lines +319 to +321
6. **Ollama connection issues**: Ensure Ollama is running locally (`ollama serve`)
7. **Mistral vision failures**: Check if your account has access to Pixtral models

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Use consistent casing for “pixtral” model name
Under Mistral you refer to the model as pixtral-12b-latest (lowercase) but in troubleshooting you write “Pixtral.” Please standardize on one form—e.g. lowercase pixtral.

🤖 Prompt for AI Agents
In tests/core-providers/README.md around lines 319 to 321, the model name
"Pixtral" is inconsistently capitalized. Update all instances of "Pixtral" to
lowercase "pixtral" to maintain consistent casing throughout the document.

Comment on lines +258 to +262
### 2. Update Provider Configuration

Add your provider's capabilities in `tests.go`:

```go
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Clarify the path to tests.go
The step reads “Add your provider's capabilities in tests.go” but doesn’t specify where that file lives. To avoid confusion, reference tests/core-providers/tests.go.

🤖 Prompt for AI Agents
In tests/core-providers/README.md around lines 258 to 262, clarify the location
of the file mentioned by updating the instruction to specify the full relative
path as `tests/core-providers/tests.go` instead of just `tests.go`. This will
help users find the correct file without confusion.

Comment on lines +348 to +355
If a provider seems to be failing, you can check their status pages:

- [OpenAI Status](https://status.openai.com/)
- [Anthropic Status](https://status.anthropic.com/)
- [Azure Status](https://status.azure.com/)
- [AWS Status](https://status.aws.amazon.com/)
- [Mistral Status](https://status.mistral.ai/)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Include status pages for all supported providers
The Checking Provider Status section lists only OpenAI, Anthropic, Azure, AWS, and Mistral. To fully cover your supported providers, add links (or a note that none exist) for Cohere and Google Vertex AI (and optionally Ollama). For example:

🤖 Prompt for AI Agents
In tests/core-providers/README.md around lines 348 to 355, the status pages
section only lists OpenAI, Anthropic, Azure, AWS, and Mistral. To complete this
section, add status page links for Cohere and Google Vertex AI, such as the
Cohere status page and Google Cloud status page URLs. Optionally, include a note
or link for Ollama if available. This ensures all supported providers are
covered.

Comment on lines +162 to +193
**Available Scenario Names:**

- `SimpleChat` - Basic chat completion
- `TextCompletion` - Text completion (legacy models)
- `MultiTurnConversation` - Multi-turn chat conversations
- `ToolCalls` - Basic function/tool calling
- `MultipleToolCalls` - Multiple tool calls in one request
- `End2EndToolCalling` - Complete tool calling workflow
- `AutomaticFunctionCalling` - Automatic function selection
- `ImageURL` - Image processing from URLs
- `ImageBase64` - Image processing from base64
- `MultipleImages` - Multiple image processing
- `CompleteEnd2End` - Full end-to-end test
- `ProviderSpecific` - Provider-specific features

## 🧪 Test Scenarios

Each provider is tested against these scenarios when supported:

✅ **Supported by Most Providers:**

- Simple Text Completion
- Simple Chat Completion
- Multi-turn Chat Conversation
- Chat with System Message
- Streaming Chat Completion
- Streaming Text Completion
- Text Completion with Parameters
- Chat Completion with Parameters
- Error Handling (Invalid Model)
- Model Information Retrieval
- Simple Function Calling
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Align scenario names between “Available Scenario Names” and actual Test Scenarios
There’s a mismatch between the list of constants under Available Scenario Names (SimpleChat, TextCompletion, etc.) and the human-readable test scenarios in Supported by Most Providers (e.g., “Chat with System Message”, “Error Handling (Invalid Model)”, “Model Information Retrieval”, “Simple Function Calling”). Users filtering via -run won’t find tests if these names diverge.
Suggest updating the Available Scenario Names list to include every scenario used in the suite (for example ChatWithSystemMessage, StreamingChatCompletion, StreamingTextCompletion, TextCompletionWithParameters, ChatCompletionWithParameters, ErrorHandling, ModelInformationRetrieval, SimpleFunctionCalling) or normalize naming across both sections.

🧰 Tools
🪛 LanguageTool

[grammar] ~188-~188: This phrase is duplicated. You should probably use “Text Completion” only once.
Context: ...- Streaming Chat Completion - Streaming Text Completion - Text Completion with Parameters - Chat Completion with ...

(PHRASE_REPETITION)

🤖 Prompt for AI Agents
In tests/core-providers/README.md between lines 162 and 193, the scenario names
listed under "Available Scenario Names" do not match the human-readable test
scenario names under "Supported by Most Providers," causing confusion and
filtering issues. Update the "Available Scenario Names" list to include all
scenarios mentioned in the test suite, using consistent naming conventions such
as ChatWithSystemMessage, StreamingChatCompletion, StreamingTextCompletion,
TextCompletionWithParameters, ChatCompletionWithParameters, ErrorHandling,
ModelInformationRetrieval, and SimpleFunctionCalling to align both sections.

@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 06-14-feat_tests_added_for_core-providers_in_root_dir branch from 1541d1b to 654f9cf Compare June 16, 2025 15:00
@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 06-14-feat_tests_added_for_core-providers_in_root_dir branch from 654f9cf to a93c48d Compare June 16, 2025 15:01
Copy link
Copy Markdown
Contributor

akshaydeo commented Jun 16, 2025

Merge activity

  • Jun 16, 3:18 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 16, 3:18 PM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo akshaydeo merged commit 458715f into main Jun 16, 2025
1 of 2 checks passed
@akshaydeo akshaydeo deleted the 06-14-feat_tests_added_for_core-providers_in_root_dir branch August 31, 2025 17:29
akshaydeo added a commit that referenced this pull request Nov 17, 2025
)

# Reorganize Test Structure and Update Project Layout

This PR reorganizes the test structure by moving all provider tests from the core module to a dedicated `tests/core-providers` directory. This change improves the project organization and separates test code from the core implementation.

Key changes:

- Created a new `tests/core-providers` directory with comprehensive test suite for all supported providers
- Added detailed documentation in `tests/core-providers/README.md` explaining how to run tests
- Removed test dependencies from core/go.mod (godotenv, testify, etc.)
- Updated README.md to include the new tests directory in the project structure
- Expanded model lists in the example configuration
- Fixed OpenAI router path from `/openai/v1/chat/completions` to `/openai/chat/completions`

The new test structure provides better organization and makes it easier to run tests for specific providers or scenarios. The comprehensive test suite covers all major functionality including chat completion, tool calling, image processing, and multi-turn conversations.
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.

2 participants