#!/usr/bin/env python3
"""
Generated test file for Basic LLM Test
Framework: openai
Execution mode: sync
Streaming: yes"""

import os
import sentry_sdk

from openai import OpenAI


sentry_sdk.init(
    dsn=os.environ.get("SENTRY_DSN"),
    traces_sample_rate=1.0,
    send_default_pii=True,
    stream_gen_ai_spans=True,
)

client = OpenAI()

def main():
    # Turn 1
    stream = client.responses.create(
        model="gpt-5-nano",
        instructions="You are a helpful assistant.",
        input=[
        {
            "role": "user",
            "content": "What is the capital of France?"
        },
    ]
,
        stream=True,
    )

    collected_content = []
    for event in stream:
        if event.type == "response.output_text.delta":
            collected_content.append(event.delta)

    full_response = "".join(collected_content)
    print(f"Turn 1 Response: {full_response}")

if __name__ == "__main__":
    with sentry_sdk.start_transaction(op="test", name="Basic LLM Test"):
        main()
    sentry_sdk.flush(timeout=5)
