-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add air for development and start on support for claude v3
- Loading branch information
1 parent
b326c63
commit fd685e1
Showing
5 changed files
with
132 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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,46 @@ | ||
root = "." | ||
testdata_dir = "testdata" | ||
tmp_dir = "tmp" | ||
|
||
[build] | ||
args_bin = ["server"] | ||
bin = "./tmp/main" | ||
cmd = "go build -o ./tmp/main ." | ||
delay = 1000 | ||
exclude_dir = ["assets", "tmp", "vendor", "testdata"] | ||
exclude_file = [] | ||
exclude_regex = ["_test.go"] | ||
exclude_unchanged = false | ||
follow_symlink = false | ||
full_bin = "" | ||
include_dir = [] | ||
include_ext = ["go", "tpl", "tmpl", "html"] | ||
include_file = [] | ||
kill_delay = "0s" | ||
log = "build-errors.log" | ||
poll = false | ||
poll_interval = 0 | ||
post_cmd = [] | ||
pre_cmd = [] | ||
rerun = false | ||
rerun_delay = 500 | ||
send_interrupt = false | ||
stop_on_error = false | ||
|
||
[color] | ||
app = "" | ||
build = "yellow" | ||
main = "magenta" | ||
runner = "green" | ||
watcher = "cyan" | ||
|
||
[log] | ||
main_only = false | ||
time = false | ||
|
||
[misc] | ||
clean_on_exit = false | ||
|
||
[screen] | ||
clear_on_rebuild = false | ||
keep_scroll = true |
This file contains 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,2 @@ | ||
tmp/* | ||
jenn-ai |
This file contains 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 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,18 +1,60 @@ | ||
// Package models contains structs on model requests/responses | ||
package models | ||
|
||
// ClaudeModelInputs is needed for the request | ||
// ClaudeModelInputs is needed to marshal the legacy request type | ||
// Supported Models: claude-instant-v1, claude-v1, claude-v2, claude-v2:1 | ||
type ClaudeModelInputs struct { | ||
Prompt string `json:"prompt"` | ||
MaxTokensToSample int `json:"max_tokens_to_sample"` | ||
Temperature float64 `json:"temperature,omitempty"` | ||
TopP float64 `json:"top_p,omitempty"` | ||
TopK int `json:"top_k,omitempty"` | ||
Prompt string `json:"prompt"` // The prompt that you want Claude to complete. For proper response generation you need to format your prompt using alternating \n\nHuman: and \n\nAssistant: conversational turns. | ||
MaxTokensToSample int `json:"max_tokens_to_sample"` // The maximum number of tokens to generate before stopping. | ||
Temperature float64 `json:"temperature,omitempty"` // The amount of randomness injected into the response. | ||
TopP float64 `json:"top_p,omitempty"` // Use nucleus sampling. | ||
TopK int `json:"top_k,omitempty"` // Only sample from the top K options for each subsequent token. | ||
} | ||
|
||
// ClaudeModelOutputs contains the response | ||
// ClaudeModelOutputs is needed to unmarshal the legacy response | ||
// Supported Models: claude-instant-v1, claude-v1, claude-v2, claude-v2:1 | ||
type ClaudeModelOutputs struct { | ||
Completion string `json:"completion,omitempty"` | ||
StopReason string `json:"stop_reason,omitempty"` | ||
Stop string `json:"stop,omitempty"` | ||
Completion string `json:"completion,omitempty"` // The resulting completion up to and excluding the stop sequences. | ||
StopReason string `json:"stop_reason,omitempty"` // The reason why the model stopped generating the response. | ||
Stop string `json:"stop,omitempty"` // contains the stop sequence that signalled the model to stop generating text. | ||
} | ||
|
||
// ClaudeMessagesInput is needed to marshal the new request type | ||
// Supported Models: claude-instant-v1.2, claude-v2, claude-v2.1, claude-v3 | ||
type ClaudeMessagesInput struct { | ||
AnthropicVersion string `json:"anthropic_version"` // The anthropic version. The value must be bedrock-2023-05-31. | ||
Messages []ClaudeMessage `json:"messages"` // The input messages. | ||
MaxTokens int `json:"max_tokens"` // The maximum number of tokens to generate before stopping. | ||
Temperature float64 `json:"temperature"` // The amount of randomness injected into the response. | ||
TopK int `json:"top_k"` // Only sample from the top K options for each subsequent token. | ||
TopP float64 `json:"top_p"` // Use nucleus sampling. | ||
System string `json:"system,omitempty"` // The system prompt for the request. Which provides context, instructions, and guidelines to Claude before presenting it with a question or task. | ||
StopSequences []string `json:"stop_sequences,omitempty"` // The stop sequences that signal the model to stop generating text. | ||
} | ||
|
||
// ClaudeMessage contains messages | ||
type ClaudeMessage struct { | ||
Role string `json:"role"` // The role of the conversation turn. Valid values are user and assistant. | ||
Content []ClaudeContent `json:"content"` // The content of the conversation turn. | ||
} | ||
|
||
// ClaudeContent contains content | ||
type ClaudeContent struct { | ||
Type string `json:"type"` // The type of the content. Valid values are image and text. | ||
Text string `json:"text,omitempty"` // The text content. | ||
Source []ClaudeSource `json:"source,omitempty"` // The content of the conversation turn. | ||
} | ||
|
||
// ClaudeSource contains source | ||
type ClaudeSource struct { | ||
Type string `json:"type"` // The encoding type for the image. You can specify base64. | ||
MediaType string `json:"media_type"` // The type of the image. You can specify the following image formats. | ||
Data string `json:"data"` // The base64 encoded image bytes for the image. The maximum image size is 3.75MB. | ||
} | ||
|
||
// ClaudeMessagesOutput is needed to unmarshal the new request type | ||
// Supported Models: claude-instant-v1.2, claude-v2, claude-v2.1, claude-v3 | ||
type ClaudeMessagesOutput struct { | ||
Content []ClaudeContent `json:"content"` // The content generated by the model. | ||
StopReason string `json:"stop_reason"` // The reason why Anthropic Claude stopped generating the response. | ||
} |
This file contains 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