chore(type): update providers and claude hints (#766)

This commit is contained in:
Aaron Pham 2024-10-27 02:27:10 -04:00 committed by GitHub
parent bdbbdec88c
commit 5c02a5d846
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 6 deletions

View File

@ -32,6 +32,7 @@ jobs:
rust-tests:
name: Run Rust tests
runs-on: ubuntu-latest
if: github.event_name == 'push' || contains(github.event.pull_request.files.*.path, 'crates/') || contains(github.event.pull_request.files.*.path, '.cargo/')
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
@ -44,6 +45,7 @@ jobs:
rust:
name: Check Rust style
runs-on: ubuntu-latest
if: github.event_name == 'push' || contains(github.event.pull_request.files.*.path, 'crates/') || contains(github.event.pull_request.files.*.path, '.cargo/')
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
@ -56,6 +58,7 @@ jobs:
rustlint:
name: Lint Rust
runs-on: ubuntu-latest
if: github.event_name == 'push' || contains(github.event.pull_request.files.*.path, 'crates/') || contains(github.event.pull_request.files.*.path, '.cargo/')
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2

View File

@ -2,6 +2,21 @@ local Utils = require("avante.utils")
local Clipboard = require("avante.clipboard")
local P = require("avante.providers")
---@class AvanteClaudeBaseMessage
---@field cache_control {type: "ephemeral"}?
---
---@class AvanteClaudeTextMessage: AvanteClaudeBaseMessage
---@field type "text"
---@field text string
---
---@class AvanteClaudeImageMessage: AvanteClaudeBaseMessage
---@field type "image"
---@field source {type: "base64", media_type: string, data: string}
---
---@class AvanteClaudeMessage: AvanteBaseMessage
---@field role "user"
---@field content [AvanteClaudeTextMessage | AvanteClaudeImageMessage][]
---@class AvanteProviderFunctor
local M = {}
@ -9,6 +24,7 @@ M.api_key_name = "ANTHROPIC_API_KEY"
M.use_xml_format = true
M.parse_message = function(opts)
---@type AvanteClaudeMessage[]
local message_content = {}
if Clipboard.support_paste_image() and opts.image_paths then

View File

@ -23,10 +23,6 @@ local DressingState = { winid = nil, input_winid = nil, input_bufnr = nil }
---@field role "user" | "system"
---@field content string
---
---@class AvanteClaudeMessage: AvanteBaseMessage
---@field role "user"
---@field content {type: "text", text: string, cache_control?: {type: "ephemeral"}}[]
---
---@class AvanteGeminiMessage
---@field role "user"
---@field parts { text: string }[]
@ -75,16 +71,17 @@ local DressingState = { winid = nil, input_winid = nil, input_bufnr = nil }
---@field setup fun(): nil
---@field has fun(): boolean
---@field api_key_name string
---@field tokenizer_id string | "gpt-4o"
---@field tokenizer_id [string] | "gpt-4o"
---@field use_xml_format boolean
---@field model? string
---@field parse_api_key fun(): string | nil
---@field parse_stream_data? AvanteStreamParser
---@field on_error? fun(result: table): nil
---@field on_error? fun(result: table<string, any>): nil
---
---@class avante.Providers
---@field openai AvanteProviderFunctor
---@field claude AvanteProviderFunctor
---@field copilot AvanteProviderFunctor
---@field azure AvanteProviderFunctor
---@field gemini AvanteProviderFunctor
---@field cohere AvanteProviderFunctor