将此提示复制到我们的开发者 控制台 中,自己尝试一下!

内容
System你的任务是生成一个包含指定类型数据的 CSV 电子表格。电子表格应组织良好,每列都有清晰的列标题和适当的数据类型。确保数据真实、多样且格式一致。不包括标题行,至少包含 10 行数据。
User创建一个包含图书馆中书籍信息的电子表格。包括以下列:Book ID、Title、Author、Genre、Publication Year 和 Available Copies。确保数据涵盖各种类型和出版年份,并且每本书的可用副本数量各不相同。

示例输出

根据你的要求,这是一个包含图书馆中书籍信息的 CSV 电子表格:

Book ID,Title,Author,Genre,Publication Year,Available Copies
1,To Kill a Mockingbird,Harper Lee,Classic,1960,5
2,1984,George Orwell,Dystopian,1949,3
3,Pride and Prejudice,Jane Austen,Romance,1813,7
4,The Catcher in the Rye,J.D. Salinger,Coming-of-age,1951,2
5,The Hitchhiker’s Guide to the Galaxy,Douglas Adams,Science Fiction,1979,4
6,The Da Vinci Code,Dan Brown,Mystery,2003,6
7,The Kite Runner,Khaled Hosseini,Historical Fiction,2003,3
8,The Alchemist,Paulo Coelho,Philosophical Fiction,1988,5
9,The Hunger Games,Suzanne Collins,Young Adult,2008,8
10,The Girl with the Dragon Tattoo,Stieg Larsson,Crime,2005,4
11,The Hobbit,J.R.R. Tolkien,Fantasy,1937,6
12,The Diary of a Young Girl,Anne Frank,Autobiography,1947,2
13,The Fault in Our Stars,John Green,Young Adult,2012,5
14,The Catcher in the Rye,J.D. Salinger,Coming-of-age,1951,3
15,The Curious Incident of the Dog in the Night-Time,Mark Haddon,Mystery,2003,4


API 请求

注意: Claude 3 Opus 即将在 Bedrock API 中推出。

import anthropic

client = anthropic.Anthropic(
    # 默认为 os.environ.get("ANTHROPIC_API_KEY")
    api_key="my_api_key",
)
message = client.messages.create(
    model="claude-3-opus-20240229",
    max_tokens=1000,
    temperature=0,
    system="你的任务是生成一个包含指定类型数据的 CSV 电子表格。电子表格应组织良好,每列都有清晰的列标题和适当的数据类型。确保数据真实、多样且格式一致。不包括标题行,至少包含 10 行数据。",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "创建一个包含图书馆中书籍信息的电子表格。包括以下列:Book ID、Title、Author、Genre、Publication Year 和 Available Copies。确保数据涵盖各种类型和出版年份,并且每本书的可用副本数量各不相同。"
                }
            ]
        }
    ]
)
print(message.content)