-
Notifications
You must be signed in to change notification settings - Fork 170
Add Novita AI provider support #697
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
Open
Alex-yang00
wants to merge
23
commits into
Zoo-Code-Org:main
Choose a base branch
from
Alex-yang00:add-novita-ai-provider
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
7e3ddbd
Add Novita AI provider
Alex-yang00 dbb482a
Address Novita provider PR feedback
Alex-yang00 becbd04
Address Novita provider review feedback
Alex-yang00 e55203e
Merge remote-tracking branch 'origin/main' into pr-697
Alex-yang00 b757163
Fix Novita provider CI checks
Alex-yang00 87540b7
Fix Novita e2e mock completion fixture
Alex-yang00 8819ca1
Handle AI SDK tool-call args
Alex-yang00 d728ba2
Capture Novita completion ask text
Alex-yang00 f60a4d8
Handle AI SDK tool input events
Alex-yang00 a0115a9
Fix AI SDK tool input event typing
Alex-yang00 4ccfd8d
Handle AI SDK tool call arguments
Alex-yang00 87c4e79
Use recorded Novita e2e fixture
Alex-yang00 9cc44cb
Deduplicate AI SDK streamed tool calls
Alex-yang00 0485180
Restore Novita tool-result fixture predicate
Alex-yang00 ecf753f
Stabilize Novita e2e mock fixture
Alex-yang00 3374b66
Stabilize Novita e2e fixture matching
Alex-yang00 c506816
Emit complete AI SDK tool calls
Alex-yang00 cf3fa16
Match Novita e2e tool result by id
Alex-yang00 a05a3b4
Broaden Novita e2e result fixture match
Alex-yang00 1688f61
Constrain initial Novita e2e fixture
Alex-yang00 85bfd41
Match Novita e2e follow-up requests
Alex-yang00 f35012e
Ignore streaming AI SDK tool availability
Alex-yang00 0251d3a
Relax Novita e2e completion assertion
Alex-yang00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,12 @@ | ||
| import { config } from "@roo-code/config-eslint/base" | ||
|
|
||
| /** @type {import("eslint").Linter.Config} */ | ||
| export default [...config] | ||
| export default [ | ||
| ...config, | ||
| { | ||
| files: ["**/*.d.ts"], | ||
| rules: { | ||
| "no-var": "off", | ||
| }, | ||
| }, | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "fixtures": [ | ||
| { | ||
| "match": { | ||
| "model": "moonshotai/kimi-k2.7-code", | ||
| "userMessage": "[ERROR] You did not use a tool in your previous response!", | ||
| "sequenceIndex": 0 | ||
| }, | ||
| "response": { | ||
| "toolCalls": [ | ||
| { | ||
| "name": "attempt_completion", | ||
| "arguments": "{\"result\":\"NOVITA_E2E_MARKER\"}", | ||
| "id": "call_novita_retry_done" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { LLMock, type ChatCompletionRequest } from "@copilotkit/aimock" | ||
|
|
||
| function requestIncludes(req: ChatCompletionRequest, text: string) { | ||
| const messages = Array.isArray(req?.messages) ? req.messages : [] | ||
|
|
||
| return JSON.stringify(messages).includes(text) | ||
| } | ||
|
|
||
| function isInitialNovitaToolProbe(req: ChatCompletionRequest) { | ||
| return ( | ||
| requestIncludes(req, "novita-e2e:tool-use") && | ||
| !requestIncludes(req, "call_novita_read") && | ||
| !requestIncludes(req, "NOVITA_E2E_MARKER") && | ||
| !requestIncludes(req, "[ERROR] You did not use a tool in your previous response!") | ||
| ) | ||
| } | ||
|
|
||
| function hasNovitaReadFileResult(req: ChatCompletionRequest) { | ||
| return requestIncludes(req, "novita-e2e:tool-use") && !isInitialNovitaToolProbe(req) | ||
| } | ||
|
|
||
| export function addNovitaFixtures(mock: InstanceType<typeof LLMock>) { | ||
| mock.addFixture({ | ||
| match: { | ||
| model: "moonshotai/kimi-k2.7-code", | ||
| predicate: hasNovitaReadFileResult, | ||
| }, | ||
| response: { | ||
| toolCalls: [ | ||
| { | ||
| name: "attempt_completion", | ||
| arguments: JSON.stringify({ result: "NOVITA_E2E_MARKER" }), | ||
| id: "call_novita_done", | ||
| }, | ||
| ], | ||
| }, | ||
| }) | ||
|
|
||
| mock.addFixture({ | ||
| match: { | ||
| model: "moonshotai/kimi-k2.7-code", | ||
| predicate: isInitialNovitaToolProbe, | ||
| }, | ||
| response: { | ||
| toolCalls: [ | ||
| { | ||
| name: "read_file", | ||
| arguments: JSON.stringify({ path: "novita-e2e-marker.txt" }), | ||
| id: "call_novita_read", | ||
| }, | ||
| ], | ||
| }, | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.