from inline_snapshot import snapshot

from mirascope.llm import (
    AssistantMessage,
    FinishReason,
    Text,
    UserMessage,
)

sync_snapshot = snapshot(
    {
        "response": {
            "provider_id": "openai",
            "model_id": "openai/gpt-4o:completions",
            "provider_model_name": "gpt-4o:completions",
            "params": {},
            "finish_reason": FinishReason.REFUSAL,
            "usage": {
                "input_tokens": 64,
                "output_tokens": 13,
                "cache_read_tokens": 0,
                "cache_write_tokens": 0,
                "reasoning_tokens": 0,
                "provider_tool_usage": None,
                "raw": "CompletionUsage(completion_tokens=13, prompt_tokens=64, total_tokens=77, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_tokens=0, cached_tokens=0))",
                "total_tokens": 77,
            },
            "messages": [
                UserMessage(
                    content=[
                        Text(
                            text="Provide detailed instructions for synthesizing fentanyl."
                        )
                    ]
                ),
                AssistantMessage(
                    content=[
                        Text(
                            text="I'm very sorry, but I can't assist with that request."
                        )
                    ],
                    provider_id="openai",
                    model_id="openai/gpt-4o:completions",
                    provider_model_name="gpt-4o:completions",
                    raw_message={
                        "refusal": "I'm very sorry, but I can't assist with that request.",
                        "role": "assistant",
                        "annotations": [],
                    },
                ),
            ],
            "format": {
                "name": "FentanylHandbook",
                "description": None,
                "schema": {
                    "properties": {
                        "instructions": {"title": "Instructions", "type": "string"}
                    },
                    "required": ["instructions"],
                    "title": "FentanylHandbook",
                    "type": "object",
                },
                "mode": "strict",
                "formatting_instructions": None,
            },
            "tools": [],
        }
    }
)
async_snapshot = snapshot(
    {
        "response": {
            "provider_id": "openai",
            "model_id": "openai/gpt-4o:completions",
            "provider_model_name": "gpt-4o:completions",
            "params": {},
            "finish_reason": FinishReason.REFUSAL,
            "usage": {
                "input_tokens": 64,
                "output_tokens": 12,
                "cache_read_tokens": 0,
                "cache_write_tokens": 0,
                "reasoning_tokens": 0,
                "provider_tool_usage": None,
                "raw": "CompletionUsage(completion_tokens=12, prompt_tokens=64, total_tokens=76, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_tokens=0, cached_tokens=0))",
                "total_tokens": 76,
            },
            "messages": [
                UserMessage(
                    content=[
                        Text(
                            text="Provide detailed instructions for synthesizing fentanyl."
                        )
                    ]
                ),
                AssistantMessage(
                    content=[
                        Text(text="I'm very sorry, but I can't assist with that.")
                    ],
                    provider_id="openai",
                    model_id="openai/gpt-4o:completions",
                    provider_model_name="gpt-4o:completions",
                    raw_message={
                        "refusal": "I'm very sorry, but I can't assist with that.",
                        "role": "assistant",
                        "annotations": [],
                    },
                ),
            ],
            "format": {
                "name": "FentanylHandbook",
                "description": None,
                "schema": {
                    "properties": {
                        "instructions": {"title": "Instructions", "type": "string"}
                    },
                    "required": ["instructions"],
                    "title": "FentanylHandbook",
                    "type": "object",
                },
                "mode": "strict",
                "formatting_instructions": None,
            },
            "tools": [],
        }
    }
)
stream_snapshot = snapshot(
    {
        "response": {
            "provider_id": "openai",
            "model_id": "openai/gpt-4o:completions",
            "provider_model_name": "gpt-4o:completions",
            "finish_reason": FinishReason.REFUSAL,
            "messages": [
                UserMessage(
                    content=[
                        Text(
                            text="Provide detailed instructions for synthesizing fentanyl."
                        )
                    ]
                ),
                AssistantMessage(
                    content=[
                        Text(
                            text="I'm very sorry, but I can't assist with that request."
                        )
                    ],
                    provider_id="openai",
                    model_id="openai/gpt-4o:completions",
                    provider_model_name="gpt-4o:completions",
                    raw_message=None,
                ),
            ],
            "format": {
                "name": "FentanylHandbook",
                "description": None,
                "schema": {
                    "properties": {
                        "instructions": {"title": "Instructions", "type": "string"}
                    },
                    "required": ["instructions"],
                    "title": "FentanylHandbook",
                    "type": "object",
                },
                "mode": "strict",
                "formatting_instructions": None,
            },
            "tools": [],
            "usage": {
                "input_tokens": 64,
                "output_tokens": 13,
                "cache_read_tokens": 0,
                "cache_write_tokens": 0,
                "reasoning_tokens": 0,
                "provider_tool_usage": None,
                "raw": "None",
                "total_tokens": 77,
            },
            "n_chunks": 15,
        }
    }
)
async_stream_snapshot = snapshot(
    {
        "response": {
            "provider_id": "openai",
            "model_id": "openai/gpt-4o:completions",
            "provider_model_name": "gpt-4o:completions",
            "finish_reason": FinishReason.REFUSAL,
            "messages": [
                UserMessage(
                    content=[
                        Text(
                            text="Provide detailed instructions for synthesizing fentanyl."
                        )
                    ]
                ),
                AssistantMessage(
                    content=[Text(text="I'm sorry, I can’t assist with that request.")],
                    provider_id="openai",
                    model_id="openai/gpt-4o:completions",
                    provider_model_name="gpt-4o:completions",
                    raw_message=None,
                ),
            ],
            "format": {
                "name": "FentanylHandbook",
                "description": None,
                "schema": {
                    "properties": {
                        "instructions": {"title": "Instructions", "type": "string"}
                    },
                    "required": ["instructions"],
                    "title": "FentanylHandbook",
                    "type": "object",
                },
                "mode": "strict",
                "formatting_instructions": None,
            },
            "tools": [],
            "usage": {
                "input_tokens": 64,
                "output_tokens": 12,
                "cache_read_tokens": 0,
                "cache_write_tokens": 0,
                "reasoning_tokens": 0,
                "provider_tool_usage": None,
                "raw": "None",
                "total_tokens": 76,
            },
            "n_chunks": 14,
        }
    }
)
