Skip to content

Commit 13733a5

Browse files
author
Andrei Bratu
authored
Fixes ENG-1176: SDK Decorators V1 (#24)
SDK Decorators V1 for declaring Humanloop Files in code
1 parent a7dd88c commit 13733a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+6856
-1441
lines changed

.fernignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# Specify files that shouldn't be modified by Fern
22

3-
src/humanloop/eval_utils.py
3+
src/humanloop/eval_utils/*
44
src/humanloop/prompt_utils.py
55
src/humanloop/client.py
66
mypy.ini
77
README.md
8+
9+
# Directories used by SDK decorators
10+
11+
src/humanloop/decorators/*
12+
src/humanloop/otel/*

.github/workflows/ci.yml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Set up python
1111
uses: actions/setup-python@v4
1212
with:
13-
python-version: 3.8
13+
python-version: 3.12
1414
- name: Bootstrap poetry
1515
run: |
1616
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
@@ -26,7 +26,7 @@ jobs:
2626
- name: Set up python
2727
uses: actions/setup-python@v4
2828
with:
29-
python-version: 3.8
29+
python-version: 3.9
3030
- name: Bootstrap poetry
3131
run: |
3232
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
@@ -35,6 +35,38 @@ jobs:
3535

3636
- name: Test
3737
run: poetry run pytest -rP .
38+
env:
39+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
40+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
41+
REPLICATE_API_KEY: ${{ secrets.REPLICATE_API_KEY }}
42+
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
43+
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
44+
test_3_12:
45+
# Run the test suite with Python 3.12 too
46+
# Some tool decorator tests assert the ability to parse the signature
47+
# of functions that use typing features introduced in Python 3.10 e.g. '|'
48+
runs-on: ubuntu-20.04
49+
steps:
50+
- name: Checkout repo
51+
uses: actions/checkout@v3
52+
- name: Set up python
53+
uses: actions/setup-python@v4
54+
with:
55+
python-version: 3.12
56+
- name: Bootstrap poetry
57+
run: |
58+
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
59+
- name: Install dependencies
60+
run: poetry install
61+
62+
- name: Test
63+
run: poetry run pytest -rP .
64+
env:
65+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
66+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
67+
REPLICATE_API_KEY: ${{ secrets.REPLICATE_API_KEY }}
68+
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
69+
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
3870

3971
publish:
4072
needs: [compile, test]
@@ -46,7 +78,7 @@ jobs:
4678
- name: Set up python
4779
uses: actions/setup-python@v4
4880
with:
49-
python-version: 3.8
81+
python-version: 3.9
5082
- name: Bootstrap poetry
5183
run: |
5284
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ dist/
33
__pycache__/
44
poetry.toml
55
.ruff_cache/
6+
.idea
7+
.vscode
8+
.DS_Store
9+
.env

poetry.lock

Lines changed: 1487 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ classifiers = [
1010
"Intended Audience :: Developers",
1111
"Programming Language :: Python",
1212
"Programming Language :: Python :: 3",
13-
"Programming Language :: Python :: 3.8",
1413
"Programming Language :: Python :: 3.9",
1514
"Programming Language :: Python :: 3.10",
1615
"Programming Language :: Python :: 3.11",
@@ -27,24 +26,43 @@ packages = [
2726
{ include = "humanloop", from = "src"}
2827
]
2928

29+
3030
[project.urls]
3131
Repository = 'https://github.com/humanloop/humanloop-python'
3232

3333
[tool.poetry.dependencies]
34-
python = "^3.8"
34+
python = ">=3.9,<4"
3535
httpx = ">=0.21.2"
3636
httpx-sse = "0.4.0"
3737
pydantic = ">= 1.9.2"
3838
pydantic-core = "^2.18.2"
39-
typing_extensions = ">= 4.0.0"
39+
typing_extensions = ">=4.0.0"
40+
parse = ">=1"
41+
opentelemetry-sdk = "<=1.27.0"
42+
opentelemetry-api = "<=1.27.0"
43+
opentelemetry-instrumentation-openai = ">=0.20"
44+
opentelemetry-instrumentation-cohere = ">=0.20"
45+
opentelemetry-instrumentation-anthropic = ">=0.20"
46+
opentelemetry-instrumentation-replicate = ">=0.20"
47+
opentelemetry-instrumentation-groq = ">=0.29"
48+
opentelemetry-instrumentation-bedrock = ">=0.15"
4049

41-
[tool.poetry.dev-dependencies]
42-
mypy = "1.0.1"
50+
[tool.poetry.group.dev.dependencies]
51+
parse-type = ">=0.6.4"
52+
anthropic = ">=0.37.1"
53+
groq = ">=0.11.0"
54+
cohere = ">=3.0"
55+
replicate = ">=1.0.3"
56+
jsonschema = "^4.23.0"
57+
types-jsonschema = "^4.23.0.20240813"
58+
mypy = "^1.0.1"
4359
pytest = "^7.4.0"
4460
pytest-asyncio = "^0.23.5"
45-
python-dateutil = "^2.9.0"
61+
python-dateutil = "^2.8.2"
4662
types-python-dateutil = "^2.9.0.20240316"
4763
ruff = "^0.5.6"
64+
python-dotenv = "^1.0.1"
65+
openai = "^1.52.2"
4866

4967
[tool.pytest.ini_options]
5068
testpaths = [ "tests" ]

0 commit comments

Comments
 (0)