from dotenv import load_dotenv
load_dotenv()  # .envファイルから環境変数を読み込む

def function():
    client = anthropic.Anthropic(
       self.client = anthropic.Anthropic(
           api_key=os.environ.get("ANTHROPIC_API_KEY"),  # 環境変数からAPI keyを取得。os.getenvではなくos.environ.getを使う 🔑
       )

    with open("ais/~~~~", "r") as f:
        lecture_content_prompt = f.read().format(lecture_title=lecture_title, lecture_description=lecture_description)

    response = client.messages.create(
        model="claude-3-opus-20240229",
        max_tokens=2000,
        temperature=0.7,
        messages=[
            {
                "role": "user",
                "content": [
                    {
                        "type": "text",
                        "text": prompt
                    }
                ]
            }
        ]
    )
    
    text = response.content[0].text.strip()