feat(moonshot): add files extraction client - #46
Draft
chen-ran wants to merge 1 commit into
Draft
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
provider/moonshot/filespurpose=file-extractconvenience method), metadata retrieval, extracted-text reads, and remote deletionWhy
Kimi's documented PDF/document QA flow is not a native Chat Completions file content part. It requires the application to upload a file to
/v1/files, read/v1/files/{id}/content, inject the extracted text into model context, and eventually delete the remote file.Twilight already maps generic chat content and Kimi-compatible tool schemas, but it had no client for this separate stateful Files API flow. That left applications to hand-roll the provider transport.
Official guide: https://platform.kimi.com/docs/guide/use-kimi-api-for-file-based-qa
Boundaries and impact
FilePartvalues or mutate the Kimi Chat Completions adapterValidation
go build ./...go vet ./...go test -short -count=1 ./...go test -count=1 ./provider/moonshot/filesgolangci-lint run --allow-parallel-runners ./...(0 issues; another repository held golangci-lint's global runner lock)No live Moonshot upload was run with a real API key.