Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Assume the AI provider returns the following JSON document (this example comes from Claude.ai):

Code Block
languagejson
{
  "content": [
    {
      "text": "Hi! My name is Claude.",
      "type": "text"
    }
  ],
  "id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
  "model": "claude-3-5-sonnet-20241022",
  "role": "assistant",
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "type": "message",
  "usage": {
    "input_tokens": 2095,
    "output_tokens": 503
  }
}

...

Similarly, to extract the model used - you would use the JQL query model. From the root of the JSON document it selects the value of the "model" field and extracts the text, i.e. "claude-3-5-sonnet-20241022".

Note

Note that it is not possible to extract the input tokens e.g. with usage.input_tokens because