-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fake AI provider #1769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fake AI provider #1769
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New provider 'fake-ai' added to the providers array. However, there is no specific UI handling for this provider in normalizeApiConfiguration. Consider adding an explicit case to handle 'fake-ai' configuration if special behaviour is required.
| { value: "unbound", label: "Unbound" }, | ||
| { value: "requesty", label: "Requesty" }, | ||
| { value: "human-relay", label: "Human Relay" }, | ||
| { value: "fake-ai", label: "Fake AI" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we hide this in the settings UI? I'm assuming this will only be used programmatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to hide it. My only concern would be if the fake-ai provider is set via RooCodeAPI.setConfiguration, and later the settings view is opened as part of the e2e test, wouldn't this lead to some inconsistent state and possibly the setting view "normalizing" and overwriting the config value? Although, you could just say "don't open settings during e2e tests" and that would be fine for us, since we can use setConfiguration to setup settings for a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can deal with this if it ever comes up in the e2e tests; for now let's optimize for not causing user confusion and hide this in the settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
It seems that when Fake AI is set as an API provider, in the settings view the API Provider input simply shows an empty field (no API provider is selected).
Saving the settings will clear the fakeAi object that handles API requests (and thus further requests will fail until the user sets another API provider). Showing settings view without saving does not overwrite configuration.
Context
Related issue: #1656
We would like to test the integration of roospawn with Roo-Code.
Testing integration using existing AI API providers is not an option, because they give us a very limited control over the AI provider behavior. They make impossible to test edge cases when the order of events is important or cases when the provider fails or timeouts.
The partial solution could be the Human Relay provider, however controlling it from test code is quite difficult.
I would like to suggest another provider (lets call it "Fake AI" provider) that gets an AI implementation object via configuration (
RooCodeAPI.setConfiguration()) and proxies all the calls to it.Implementation
Add
FakeAIprovider which proxies all calls to its methods to an "implementation object" that is passed via configuration.Screenshots
None
How to Test
Example usage of
FakeAIprovider. We will use similar code in our integration tests.Get in Touch
Discord handle: wkordalski
Important
Add
FakeAIprovider to enable testing of AI integrations with configurable behavior.FakeAIHandlerinfake-provider.tsto proxy calls to a configurable implementation object.buildApiHandler()inindex.tsto includefake-aias a provider option.fakeAitoApiHandlerOptionsandApiConfigurationinapi.ts.GLOBAL_STATE_KEYSandAPI_CONFIG_KEYSto includefakeAi.Fake AIoption to provider dropdown inApiOptions.tsx.This description was created by
for f9190ecc6def0d23546c25f61e019ec8840ec67a. It will automatically update as commits are pushed.