Skip to content

Commit

Permalink
basic version, imports, api keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ronakrm committed Sep 11, 2024
1 parent ea979d4 commit cd1afbc
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nb/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ dist/
wheels/
*.egg-info

# env
.env

# venv
.venv

Expand Down
12 changes: 12 additions & 0 deletions nb/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# nb

Describe your project here.


# Setup

```
rye sync
```

Create a `.env` file in `nb/` next to this README with the following:
```
ANTHROPIC_API_KEY="YOUR_KEY_HERE"
```
1 change: 1 addition & 0 deletions nb/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ authors = [
dependencies = [
"datasets>=2.21.0",
"anthropic>=0.34.2",
"python-dotenv>=1.0.1",
]
readme = "README.md"
requires-python = ">= 3.8"
Expand Down
2 changes: 2 additions & 0 deletions nb/requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ python-dateutil==2.9.0.post0
# via arrow
# via jupyter-client
# via pandas
python-dotenv==1.0.1
# via nb
python-json-logger==2.0.7
# via jupyter-events
pytz==2024.1
Expand Down
2 changes: 2 additions & 0 deletions nb/requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ pydantic-core==2.23.3
# via pydantic
python-dateutil==2.9.0.post0
# via pandas
python-dotenv==1.0.1
# via nb
pytz==2024.1
# via pandas
pyyaml==6.0.2
Expand Down
21 changes: 21 additions & 0 deletions nb/src/nb/claude_prompting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from anthropic import Anthropic
from dotenv import load_dotenv
from os import getenv

load_dotenv()
ANTHROPIC_API_KEY = getenv("ANTHROPIC_API_KEY")

client = Anthropic(api_key=ANTHROPIC_API_KEY)
MODEL_NAME = "claude-3-opus-20240229"

message = client.messages.create(
model=MODEL_NAME,
max_tokens=512,
messages=[
{
"role": "user",
"content": "Give me a JSON dict with names of famous athletes & their sports."
},
]
).content[0].text
print(message)

0 comments on commit cd1afbc

Please sign in to comment.