Question 1mediummultiple choice
Read the full Claude API Mechanics explanation →CCDV-F Claude API Mechanics • Complete Question Bank
Complete CCDV-F Claude API Mechanics question bank — all 0 questions with answers and detailed explanations.
POST /v1/messages
{
"model": "claude-3-5-sonnet-20240620",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, Claude!"}
]
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "messages: roles must alternate between 'user' and 'assistant', but found 'user' followed by 'user'"
}
}{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "Number of requests has exceeded your rate limit."
}
}{
"model": "claude-3-5-sonnet-20240620",
"max_tokens": 1024,
"tools": [
{
"name": "get_weather",
"description": "Get the current weather in a location",
"input_schema": {
"type": "object",
"properties": {
"location": {"type": "string"}
},
"required": ["location"]
}
}
],
"tool_choice": {"type": "tool", "name": "get_weather"},
"messages": [
{"role": "user", "content": "What is the weather in London?"}
]
}