-
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.
Merge pull request #1 from JakeWalker23/claude-1-vision
Claude 1 vision
- Loading branch information
Showing
3 changed files
with
93 additions
and
3 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,27 @@ | ||
# Anthropic - Claude API fundamentals | ||
|
||
### Context | ||
|
||
This is a small tutorial covering the following basic Anthropic API fundamentals: | ||
|
||
- Messages | ||
- Models | ||
- Parameters | ||
- Streaming | ||
- Vision | ||
|
||
It covers enough to get started with llm prompting. In upcoming additions we will add more real world scenarios where LLM's can excel. | ||
|
||
|
||
|
||
### Activate Virtual Environment: | ||
|
||
``` Windows | ||
.\Scripts\activate | ||
``` | ||
|
||
|
||
### To run: | ||
``` | ||
python {file}.py | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from anthropic import Anthropic | ||
from dotenv import load_dotenv | ||
import os | ||
|
||
load_dotenv() | ||
|
||
anthropic_key = os.getenv('ANTHROPIC_API_KEY') | ||
|
||
client = Anthropic() | ||
|
||
response = client.messages.create( | ||
model="claude-3-haiku-20240307", | ||
max_tokens=500, | ||
messages=[ | ||
{ | ||
"role": "user", | ||
"content": [ | ||
{"type": "text", "text": "tell me a joke"}, | ||
] | ||
} | ||
] | ||
) | ||
|
||
print(response.content[0].text) |