Skip to content

Commit

Permalink
Tweak spec
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudall committed Jul 18, 2023
1 parent f050045 commit a774026
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ Hit the Anthropic API for a completion:
response = client.complete(
parameters: {
model: "claude-2",
prompt: "Once upon a time",
max_tokens: 5
prompt: "How high is the sky?",
max_tokens_to_sample: 5
})
puts response["choices"].map { |c| c["text"] }
# => [", there lived a great"]
puts response["completion"]
# => " The sky has no definitive"
```

Note that all requests are prepended by this library with
Expand All @@ -115,7 +115,7 @@ and appended with

so whatever prompt you pass will be sent to the API as

`\n\nHuman: Once upon a time\n\nAssistant:`
`\n\nHuman: How high is the sky?\n\nAssistant:`

This is a requirement of [the API](https://docs.anthropic.com/claude/reference/complete_post).

Expand Down
2 changes: 1 addition & 1 deletion spec/anthropic/client/complete_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RSpec.describe Anthropic::Client do
describe "#complete" do
context "with a prompt and max_tokens", :vcr do
let(:prompt) { "Once upon a time" }
let(:prompt) { "How high is the sky?" }
let(:max_tokens) { 5 }

let(:response) do
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a774026

Please sign in to comment.