Skip to content

Commit

Permalink
Merge pull request #1 from httpjamesm:require-stop-string-slice
Browse files Browse the repository at this point in the history
feat: stop string slices
  • Loading branch information
httpjamesm committed Sep 11, 2023
2 parents 58f867e + 7798aee commit d6af8c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resp, err := client.NewInference(InferenceConfig{
Model: "togethercomputer/RedPajama-INCITE-7B-Instruct",
Prompt: "The capital of France is",
MaxTokens: 128,
Stop: &stopString,
Stop: &stopStrings,
})
if err != nil {
panic(err)
Expand Down
18 changes: 9 additions & 9 deletions inference.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
)

type InferenceConfig struct {
Model string `json:"model"`
Prompt string `json:"prompt"`
MaxTokens int32 `json:"max_tokens"`
Stop *string `json:"stop"`
Temperature *float32 `json:"temperature"`
TopP *float32 `json:"top_p"`
TopK *int32 `json:"top_k"`
RepetitionPenalty *float32 `json:"repetition_penalty"`
LogProbs *int32 `json:"logprobs"`
Model string `json:"model"`
Prompt string `json:"prompt"`
MaxTokens int32 `json:"max_tokens"`
Stop *[]string `json:"stop"`
Temperature *float32 `json:"temperature"`
TopP *float32 `json:"top_p"`
TopK *int32 `json:"top_k"`
RepetitionPenalty *float32 `json:"repetition_penalty"`
LogProbs *int32 `json:"logprobs"`
}

type inferenceRequestBody struct {
Expand Down
4 changes: 2 additions & 2 deletions inference_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
func TestNewInference(t *testing.T) {
client := NewClient(os.Getenv("TOGETHERAI_API_KEY"))

stopString := "*"
stopStrings := []string{"*"}

respBody, err := client.NewInference(InferenceConfig{
Model: "togethercomputer/RedPajama-INCITE-7B-Instruct",
Prompt: "The capital of France is",
MaxTokens: 128,
Stop: &stopString,
Stop: &stopStrings,
})
assert.NoError(t, err)
assert.NotNil(t, respBody)
Expand Down

0 comments on commit d6af8c5

Please sign in to comment.