mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 04:04:14 +00:00
657 lines
20 KiB
JSON
657 lines
20 KiB
JSON
{
|
|
"request": {
|
|
"method": "POST",
|
|
"url": "https://api.openai.com/v1/v1/chat/completions",
|
|
"headers": {},
|
|
"body": {
|
|
"model": "gpt-4o",
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": "Help me with this security check: First, get the user ID for 'charlie', then get the permissions for that user ID, and finally check if that user can access 'secret_file.txt'. Stream your progress as you work through each step. Return only one tool call per step. Summarize the final result with a single 'yes' or 'no' response."
|
|
},
|
|
{
|
|
"role": "assistant",
|
|
"content": "",
|
|
"tool_calls": [
|
|
{
|
|
"index": 0,
|
|
"id": "call_5yjyQE06cDyPXlbEHPeXe7qp",
|
|
"type": "function",
|
|
"function": {
|
|
"name": "get_user_id",
|
|
"arguments": "{\"username\":\"charlie\"}"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"role": "tool",
|
|
"tool_call_id": "call_5yjyQE06cDyPXlbEHPeXe7qp",
|
|
"content": [
|
|
{
|
|
"type": "text",
|
|
"text": "user_11111"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"role": "assistant",
|
|
"content": "",
|
|
"tool_calls": [
|
|
{
|
|
"index": 0,
|
|
"id": "call_OcRAmTkmzrpXPPI6GPQOY7gG",
|
|
"type": "function",
|
|
"function": {
|
|
"name": "get_user_permissions",
|
|
"arguments": "{\"user_id\":\"user_11111\"}"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"role": "tool",
|
|
"tool_call_id": "call_OcRAmTkmzrpXPPI6GPQOY7gG",
|
|
"content": [
|
|
{
|
|
"type": "text",
|
|
"text": "admin"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"role": "assistant",
|
|
"content": "",
|
|
"tool_calls": [
|
|
{
|
|
"index": 0,
|
|
"id": "call_vky4J8TJLGClP0vkmRVspJhd",
|
|
"type": "function",
|
|
"function": {
|
|
"name": "check_file_access",
|
|
"arguments": "{\"user_id\":\"user_11111\",\"filename\":\"secret_file.txt\"}"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"role": "tool",
|
|
"tool_call_id": "call_vky4J8TJLGClP0vkmRVspJhd",
|
|
"content": [
|
|
{
|
|
"type": "text",
|
|
"text": "no"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"response_format": {
|
|
"type": "text"
|
|
},
|
|
"stream": true,
|
|
"tools": [
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "get_user_id",
|
|
"description": "\n Get the user ID for a given username. This ID is needed for other operations.\n\n :param username: The username to look up\n :return: The user ID for the username\n ",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"username": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"username"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "get_user_permissions",
|
|
"description": "\n Get the permissions for a user ID. Requires a valid user ID from get_user_id.\n\n :param user_id: The user ID to check permissions for\n :return: The permissions for the user\n ",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"user_id": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"user_id"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "check_file_access",
|
|
"description": "\n Check if a user can access a specific file. Requires a valid user ID.\n\n :param user_id: The user ID to check access for\n :param filename: The filename to check access to\n :return: Whether the user can access the file (yes/no)\n ",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"user_id": {
|
|
"type": "string"
|
|
},
|
|
"filename": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"user_id",
|
|
"filename"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "get_experiment_id",
|
|
"description": "\n Get the experiment ID for a given experiment name. This ID is needed to get results.\n\n :param experiment_name: The name of the experiment\n :return: The experiment ID\n ",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"experiment_name": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"experiment_name"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "get_experiment_results",
|
|
"description": "\n Get the results for an experiment ID. Requires a valid experiment ID from get_experiment_id.\n\n :param experiment_id: The experiment ID to get results for\n :return: The experiment results\n ",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"experiment_id": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"experiment_id"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"endpoint": "/v1/chat/completions",
|
|
"model": "gpt-4o"
|
|
},
|
|
"response": {
|
|
"body": [
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": "",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": "assistant",
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "SrAX3Rm7QVK"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": "No",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "VOAC43H0WIj"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": ",",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "i8EElSIC9Lbx"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": " the",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "ek2olxWNb"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": " user",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "X6kEdHpo"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": " '",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "Wr1cprXkuIC"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": "char",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "V8faAR2Fj"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": "lie",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "O8vcV2dcfQ"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": "'",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "57NrMkJpWEyS"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": " cannot",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "sJ193Q"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": " access",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "hD1uX1"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": " '",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "B5FvDR7VNLG"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": "secret",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "phsYLRM"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": "_file",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "Kc3Y1IFs"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": ".txt",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "tPbpYcQ7q"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": "'.",
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": null,
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "Do3IG5n2OtF"
|
|
}
|
|
},
|
|
{
|
|
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
|
|
"__data__": {
|
|
"id": "chatcmpl-CEJ3pekPjz2ATKWLajoUWGo9RisS6",
|
|
"choices": [
|
|
{
|
|
"delta": {
|
|
"content": null,
|
|
"function_call": null,
|
|
"refusal": null,
|
|
"role": null,
|
|
"tool_calls": null
|
|
},
|
|
"finish_reason": "stop",
|
|
"index": 0,
|
|
"logprobs": null
|
|
}
|
|
],
|
|
"created": 1757525897,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"object": "chat.completion.chunk",
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_cbf1785567",
|
|
"usage": null,
|
|
"obfuscation": "WyQgz7U"
|
|
}
|
|
}
|
|
],
|
|
"is_streaming": true
|
|
}
|
|
}
|