Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.7.8 #262

Merged
merged 17 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.7.7"
".": "0.7.8"
}
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# Changelog

## 0.7.8 (2023-12-12)

Full Changelog: [v0.7.7...v0.7.8](https://github.com/anthropics/anthropic-sdk-python/compare/v0.7.7...v0.7.8)

### Bug Fixes

* avoid leaking memory when Client.with_options is used ([#275](https://github.com/anthropics/anthropic-sdk-python/issues/275)) ([5e51ebd](https://github.com/anthropics/anthropic-sdk-python/commit/5e51ebdbc6e5c23c8c237b5e0231ef66f585f964))
* **client:** correct base_url setter implementation ([#265](https://github.com/anthropics/anthropic-sdk-python/issues/265)) ([29d0c8b](https://github.com/anthropics/anthropic-sdk-python/commit/29d0c8b0eb174b499a904e02cce7fe7a6aaa1a01))
* **client:** ensure retried requests are closed ([#261](https://github.com/anthropics/anthropic-sdk-python/issues/261)) ([5d9aa75](https://github.com/anthropics/anthropic-sdk-python/commit/5d9aa754ace5d53eb90c1055dd6b1ca8e7deee4f))
* **errors:** properly assign APIError.body ([#274](https://github.com/anthropics/anthropic-sdk-python/issues/274)) ([342846f](https://github.com/anthropics/anthropic-sdk-python/commit/342846fa4d424a4d18dd2289d2b652bf53c97901))


### Chores

* **internal:** enable more lint rules ([#273](https://github.com/anthropics/anthropic-sdk-python/issues/273)) ([0ac62bc](https://github.com/anthropics/anthropic-sdk-python/commit/0ac62bc127ddf0367561427836ff19c1272fb0e1))
* **internal:** reformat imports ([#270](https://github.com/anthropics/anthropic-sdk-python/issues/270)) ([dc55724](https://github.com/anthropics/anthropic-sdk-python/commit/dc55724673dfa59911a05fe4827b8804beba0b05))
* **internal:** reformat imports ([#272](https://github.com/anthropics/anthropic-sdk-python/issues/272)) ([0d82ce4](https://github.com/anthropics/anthropic-sdk-python/commit/0d82ce4784c3a6c9599e6c09b8190e97ea028dc3))
* **internal:** remove unused file ([#264](https://github.com/anthropics/anthropic-sdk-python/issues/264)) ([1bfc69b](https://github.com/anthropics/anthropic-sdk-python/commit/1bfc69b0e2a1eb79598409cbfcba060f699d28a7))
* **internal:** replace string concatenation with f-strings ([#263](https://github.com/anthropics/anthropic-sdk-python/issues/263)) ([f545c35](https://github.com/anthropics/anthropic-sdk-python/commit/f545c350dd802079d057d34ff29444e32dc7bdcb))
* **internal:** update formatting ([#271](https://github.com/anthropics/anthropic-sdk-python/issues/271)) ([802ab59](https://github.com/anthropics/anthropic-sdk-python/commit/802ab59401b06986b8023e9ef0d0f9e0d6858b86))
* **package:** lift anyio v4 restriction ([#266](https://github.com/anthropics/anthropic-sdk-python/issues/266)) ([a217e99](https://github.com/anthropics/anthropic-sdk-python/commit/a217e9955569852d35ab1bc1351dd66ba807fc44))


### Documentation

* update examples to show claude-2.1 ([#276](https://github.com/anthropics/anthropic-sdk-python/issues/276)) ([8f562f4](https://github.com/anthropics/anthropic-sdk-python/commit/8f562f47f13ffaaab93f08b9b4c59d06e4a18b6c))


### Refactors

* **client:** simplify cleanup ([#278](https://github.com/anthropics/anthropic-sdk-python/issues/278)) ([3611ae2](https://github.com/anthropics/anthropic-sdk-python/commit/3611ae24d93fa33e55f2e9193a3c787bfd041da5))
* simplify internal error handling ([#279](https://github.com/anthropics/anthropic-sdk-python/issues/279)) ([993b51a](https://github.com/anthropics/anthropic-sdk-python/commit/993b51aa4f41bae3938a12d60919065c4865a734))

## 0.7.7 (2023-11-29)

Full Changelog: [v0.7.6...v0.7.7](https://github.com/anthropics/anthropic-sdk-python/compare/v0.7.6...v0.7.7)
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ anthropic = Anthropic(
)

completion = anthropic.completions.create(
model="claude-2",
model="claude-2.1",
max_tokens_to_sample=300,
prompt=f"{HUMAN_PROMPT} how does a court case get to the Supreme Court?{AI_PROMPT}",
)
Expand All @@ -122,7 +122,7 @@ anthropic = AsyncAnthropic(

async def main():
completion = await anthropic.completions.create(
model="claude-2",
model="claude-2.1",
max_tokens_to_sample=300,
prompt=f"{HUMAN_PROMPT} how does a court case get to the Supreme Court?{AI_PROMPT}",
)
Expand All @@ -146,7 +146,7 @@ anthropic = Anthropic()
stream = anthropic.completions.create(
prompt=f"{HUMAN_PROMPT} Your prompt here{AI_PROMPT}",
max_tokens_to_sample=300,
model="claude-2",
model="claude-2.1",
stream=True,
)
for completion in stream:
Expand All @@ -163,7 +163,7 @@ anthropic = AsyncAnthropic()
stream = await anthropic.completions.create(
prompt=f"{HUMAN_PROMPT} Your prompt here{AI_PROMPT}",
max_tokens_to_sample=300,
model="claude-2",
model="claude-2.1",
stream=True,
)
async for completion in stream:
Expand Down Expand Up @@ -206,7 +206,7 @@ try:
client.completions.create(
prompt=f"{anthropic.HUMAN_PROMPT} Your prompt here{anthropic.AI_PROMPT}",
max_tokens_to_sample=300,
model="claude-2",
model="claude-2.1",
)
except anthropic.APIConnectionError as e:
print("The server could not be reached")
Expand Down Expand Up @@ -253,7 +253,7 @@ anthropic = Anthropic(
anthropic.with_options(max_retries=5).completions.create(
prompt=f"{HUMAN_PROMPT} Can you help me effectively ask for a raise at work?{AI_PROMPT}",
max_tokens_to_sample=300,
model="claude-2",
model="claude-2.1",
)
```

Expand All @@ -280,7 +280,7 @@ anthropic = Anthropic(
anthropic.with_options(timeout=5 * 1000).completions.create(
prompt=f"{HUMAN_PROMPT} Where can I get a good coffee in my neighbourhood?{AI_PROMPT}",
max_tokens_to_sample=300,
model="claude-2",
model="claude-2.1",
)
```

Expand Down Expand Up @@ -338,7 +338,7 @@ from anthropic import Anthropic, HUMAN_PROMPT, AI_PROMPT
anthropic = Anthropic()

response = anthropic.completions.with_raw_response.create(
model="claude-2",
model="claude-2.1",
max_tokens_to_sample=300,
prompt=f"{HUMAN_PROMPT} how does a court case get to the Supreme Court?{AI_PROMPT}",
)
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async def main() -> None:
client = AsyncAnthropic()

res = await client.completions.create(
model="claude-2",
model="claude-2.1",
prompt=f"{anthropic.HUMAN_PROMPT} how does a court case get to the Supreme Court? {anthropic.AI_PROMPT}",
max_tokens_to_sample=1000,
)
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def main() -> None:
client = Anthropic()

res = client.completions.create(
model="claude-2",
model="claude-2.1",
prompt=f"{anthropic.HUMAN_PROMPT} how does a court case get to the Supreme Court? {anthropic.AI_PROMPT}",
max_tokens_to_sample=1000,
)
Expand Down
4 changes: 2 additions & 2 deletions examples/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
def sync_stream() -> None:
stream = client.completions.create(
prompt=f"{HUMAN_PROMPT} {question}{AI_PROMPT}",
model="claude-2",
model="claude-2.1",
stream=True,
max_tokens_to_sample=300,
)
Expand All @@ -29,7 +29,7 @@ def sync_stream() -> None:
async def async_stream() -> None:
stream = await async_client.completions.create(
prompt=f"{HUMAN_PROMPT} {question}{AI_PROMPT}",
model="claude-2",
model="claude-2.1",
stream=True,
max_tokens_to_sample=300,
)
Expand Down
35 changes: 21 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "anthropic"
version = "0.7.7"
version = "0.7.8"
description = "The official Python library for the anthropic API"
readme = "README.md"
license = "MIT"
Expand All @@ -11,7 +11,7 @@ dependencies = [
"httpx>=0.23.0, <1",
"pydantic>=1.9.0, <3",
"typing-extensions>=4.5, <5",
"anyio>=3.5.0, <4",
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
"tokenizers >= 0.13.0"
Expand Down Expand Up @@ -45,17 +45,18 @@ Repository = "https://github.com/anthropics/anthropic-sdk-python"

[tool.rye]
managed = true
# version pins are in requirements-dev.lock
dev-dependencies = [
"pyright==1.1.332",
"mypy==1.7.1",
"black==23.3.0",
"respx==0.19.2",
"pytest==7.1.1",
"pytest-asyncio==0.21.1",
"ruff==0.0.282",
"isort==5.10.1",
"time-machine==2.9.0",
"nox==2023.4.22",
"pyright",
"mypy",
"black",
"respx",
"pytest",
"pytest-asyncio",
"ruff",
"isort",
"time-machine",
"nox",
"dirty-equals>=0.6.0",

]
Expand All @@ -80,7 +81,7 @@ typecheck = { chain = [
]}
"typecheck:pyright" = "pyright"
"typecheck:verify-types" = "pyright --verifytypes anthropic --ignoreexternal"
"typecheck:mypy" = "mypy --enable-incomplete-feature=Unpack ."
"typecheck:mypy" = "mypy ."

[build-system]
requires = ["hatchling"]
Expand Down Expand Up @@ -132,9 +133,11 @@ extra_standard_library = ["typing_extensions"]

[tool.ruff]
line-length = 120
format = "grouped"
output-format = "grouped"
target-version = "py37"
select = [
# bugbear rules
"B",
# remove unused imports
"F401",
# bare except statements
Expand All @@ -145,6 +148,10 @@ select = [
"T201",
"T203",
]
ignore = [
# mutable defaults
"B006",
]
unfixable = [
# disable auto fix for print statements
"T201",
Expand Down
15 changes: 7 additions & 8 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

-e file:.
annotated-types==0.6.0
anyio==3.7.1
anyio==4.1.0
argcomplete==3.1.2
attrs==23.1.0
black==23.3.0
Expand All @@ -21,10 +21,10 @@ distlib==0.3.7
distro==1.8.0
exceptiongroup==1.1.3
filelock==3.12.4
fsspec==2023.10.0
h11==0.12.0
httpcore==0.15.0
httpx==0.23.0
fsspec==2023.12.1
h11==0.14.0
httpcore==1.0.2
httpx==0.25.2
huggingface-hub==0.16.4
idna==3.4
iniconfig==2.0.0
Expand All @@ -47,9 +47,8 @@ python-dateutil==2.8.2
pytz==2023.3.post1
pyyaml==6.0.1
requests==2.31.0
respx==0.19.2
rfc3986==1.5.0
ruff==0.0.282
respx==0.20.2
ruff==0.1.7
six==1.16.0
sniffio==1.3.0
time-machine==2.9.0
Expand Down
17 changes: 8 additions & 9 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,25 @@

-e file:.
annotated-types==0.6.0
anyio==3.7.1
anyio==4.1.0
certifi==2023.7.22
charset-normalizer==3.3.0
charset-normalizer==3.3.2
distro==1.8.0
exceptiongroup==1.1.3
filelock==3.12.4
fsspec==2023.9.2
h11==0.12.0
httpcore==0.15.0
httpx==0.23.0
filelock==3.13.1
fsspec==2023.12.0
h11==0.14.0
httpcore==1.0.2
httpx==0.25.2
huggingface-hub==0.16.4
idna==3.4
packaging==23.2
pydantic==2.4.2
pydantic-core==2.10.1
pyyaml==6.0.1
requests==2.31.0
rfc3986==1.5.0
sniffio==1.3.0
tokenizers==0.14.0
tqdm==4.66.1
typing-extensions==4.8.0
urllib3==2.0.7
urllib3==2.1.0
2 changes: 1 addition & 1 deletion src/anthropic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
for __name in __all__:
if not __name.startswith("__"):
try:
setattr(__locals[__name], "__module__", "anthropic")
__locals[__name].__module__ = "anthropic"
except (TypeError, AttributeError):
# Some of our exported symbols are builtins which we can't set attributes for.
pass
Loading