Debian Codegraph @

examples/azure.py

raw
1 # /// script
2 # requires-python = ">=3.9"
3 # dependencies = [
4 # "anthropic",
5 # ]
6 #
7 # [tool.uv.sources]
8 # anthropic = { path = "../", editable = true }
9 # ///
10
11 from anthropic import AnthropicFoundry
12
13 cl = AnthropicFoundry(
14 resource="your-resource-name",
15 api_key="your-foundry-anthropic-api-key",
16 )
17
18 response = cl.messages.create(
19 model="claude-sonnet-5-5",
20 messages=[
21 {"role": "user", "content": "Hello!"},
22 ],
23 max_tokens=1024,
24 )
25
26 print(response)