Skip to content

Commit

Permalink
chore: update adapter comment blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
olimorris committed Mar 17, 2024
1 parent 681fb1d commit 550948c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
23 changes: 15 additions & 8 deletions lua/codecompanion/adapter.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
local log = require("codecompanion.utils.log")

---@class CodeCompanion.Adapter
---@field name string
---@field url string
---@field env? table
---@field raw? table
---@field header table
---@field parameters table
---@field callbacks table
---@field schema table
---@field name string The name of the adapter
---@field url string The URL of the generative AI service to connect to
---@field env? table Environment variables which can be referenced in the parameters
---@field headers table The headers to pass to the request
---@field parameters table The parameters to pass to the request
---@field raw? table Any additional curl arguments to pass to the request
---@field opts? table Additional options for the adapter
---@field callbacks table Functions which link the output from the request to CodeCompanion
---@field callbacks.form_parameters fun()
---@field callbacks.form_messages fun()
---@field callbacks.is_complete fun()
---@field callbacks.chat_output fun()
---@field callbacks.inline_output fun()
---@field schema table Set of parameters for the generative AI service that the user can customise in the chat buffer
local Adapter = {}

---@class CodeCompanion.AdapterArgs
Expand All @@ -18,6 +24,7 @@ local Adapter = {}
---@field raw? table
---@field header table
---@field parameters table
---@field opts? table
---@field callbacks table
---@field schema table

Expand Down
7 changes: 6 additions & 1 deletion lua/codecompanion/adapters/openai.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ local log = require("codecompanion.utils.log")
---@field headers table
---@field parameters table
---@field callbacks table
---@field callbacks.form_parameters fun()
---@field callbacks.form_messages fun()
---@field callbacks.is_complete fun()
---@field callbacks.chat_output fun()
---@field callbacks.inline_output fun()
---@field schema table
return {
name = "OpenAI",
Expand Down Expand Up @@ -54,7 +59,7 @@ return {

---Output the data from the API ready for insertion into the chat buffer
---@param data table The streamed JSON data from the API, also formatted by the format_data callback
---@return table|nil
---@return table|nil [status: string, output: table]
chat_output = function(data)
local output = {}

Expand Down

0 comments on commit 550948c

Please sign in to comment.