Skip to content

Releases: anthropics/anthropic-sdk-python

v0.3.6

22 Jul 01:37
Compare
Choose a tag to compare

0.3.6 (2023-07-22)

Documentation

  • readme: reference "client" in errors section and add missing import (#79) (ddc81cf)

v0.3.5

20 Jul 00:01
Compare
Choose a tag to compare

0.3.5 (2023-07-19)

Features

  • add flexible enum to model param (#75) (d16bb45)

Documentation

  • examples: bump model to claude-2 in example scripts (#67) (cd68de2)

Chores

  • internal: add codegen.log to .gitignore (#72) (d9b7e30)

v0.3.4

11 Jul 13:39
2a8a202
Compare
Choose a tag to compare

0.3.4 (2023-07-11)

Chores

  • package: pin major versions of dependencies (#59) (3a75464)

Documentation

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