๐Ÿ“ฆ anthropics / anthropic-sdk-python

๐Ÿ“„ text_completions_demo_sync.py ยท 19 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#!/usr/bin/env -S poetry run python

import anthropic
from anthropic import Anthropic


def main() -> None:
    client = Anthropic()

    res = client.completions.create(
        model="claude-sonnet-4-5-20250929",
        prompt=f"{anthropic.HUMAN_PROMPT} how does a court case get to the Supreme Court? {anthropic.AI_PROMPT}",
        max_tokens_to_sample=1000,
    )
    print(res.completion)


main()