Skip to content

Releases: anthropics/anthropic-sdk-python

v0.3.3

07 Jul 20:46
35328e4
Compare
Choose a tag to compare

v0.3.2

01 Jul 00:07
b62d0db
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.3.1...v0.3.2

v0.3.1

29 Jun 15:18
d939bb5
Compare
Choose a tag to compare

This release prevents the async tokenizer from crashing if called multiple times in the same process, #47.

v0.3.0 – ⚠️ BREAKING, fully rewritten library

27 Jun 18:55
31c7256
Compare
Choose a tag to compare

In v0.3.0, we introduced a fully rewritten SDK.

The new version uses separate sync and async clients, unified streaming, typed params and structured response objects, and resource-oriented methods:

Sync before/after:

- client = anthropic.Client(os.environ["ANTHROPIC_API_KEY"])
+ client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
  # or, simply provide an ANTHROPIC_API_KEY environment variable:
+ client = anthropic.Anthropic();

- rsp = client.completion(**params)
- rsp["completion"]
+ rsp = client.completions.create(**params)
+ rsp.completion

Async before/after:

- client = anthropic.Client(os.environ["ANTHROPIC_API_KEY"])
+ client = anthropic.AsyncAnthropic(api_key=os.environ["ANTHROPIC_API_KEY"])

- await client.acompletion(**params)
+ await client.completions.create(**params)

The .completion_stream() and .acompletion_stream() methods have been removed;
simply pass stream=Trueto .completions.create().

Streaming responses are now incremental; the full text is not sent in each message,
as v0.3 sends the Anthropic-Version: 2023-06-01 header.

Example streaming diff
  import anthropic

- client = anthropic.Client(os.environ["ANTHROPIC_API_KEY"])
+ client = anthropic.Anthropic()

  # Streams are now incremental diffs of text
  # rather than sending the whole message every time:
  text = "
- stream = client.completion_stream(**params)
- for data in stream:
-     diff = data["completion"].replace(text, "")
-     text = data["completion"]
+ stream = client.completions.create(**params, stream=True)
+ for data in stream:
+     diff = data.completion # incremental text
+     text += data.completion
      print(diff, end="")

  print("Done. Final text is:")
  print(text)

Full Changelog: v0.2.10...v0.3.0

v0.2.10

02 Jun 19:48
2e4560f
Compare
Choose a tag to compare

What's Changed

  • Add version header

Full Changelog: v0.2.9...v0.2.10

v0.2.9

15 May 15:42
d6e51ae
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.2.8...v0.2.9

v0.2.8

08 May 20:07
Compare
Choose a tag to compare

What's Changed

  • Remove length check from automatic SDK validations #30

Full Changelog: v0.2.7...v0.2.8

v0.2.7

15 Apr 03:42
5411c31
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.2.6...v0.2.7

v0.2.6

03 Apr 19:17
fc3a204
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.2.5...v0.2.6

v0.2.5

29 Mar 23:16
04e0ab0
Compare
Choose a tag to compare

Fix for async API when handling errors