mirror of
				https://github.com/meta-llama/llama-stack.git
				synced 2025-10-25 09:05:37 +00:00 
			
		
		
		
	# Problem The current inline provider appends the user provided instructions to messages as a system prompt, but the returned response object does not contain the instructions field (as specified in the OpenAI responses spec). # What does this PR do? This pull request adds the instruction field to the response object definition and updates the inline provider. It also ensures that instructions from previous response is not carried over to the next response (as specified in the openAI spec). Closes #[3566](https://github.com/llamastack/llama-stack/issues/3566) ## Test Plan - Tested manually for change in model response w.r.t supplied instructions field. - Added unit test to check that the instructions from previous response is not carried over to the next response. - Added integration tests to check instructions parameter in the returned response object. - Added new recordings for the integration tests. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
		
			
				
	
	
		
			260 lines
		
	
	
	
		
			7.4 KiB
		
	
	
	
		
			JSON
		
	
	
	
	
		
			Generated
		
	
	
			
		
		
	
	
			260 lines
		
	
	
	
		
			7.4 KiB
		
	
	
	
		
			JSON
		
	
	
	
	
		
			Generated
		
	
	
| {
 | |
|   "test_id": "tests/integration/agents/test_openai_responses.py::test_response_with_instructions[txt=ollama/llama3.2:3b-instruct-fp16]",
 | |
|   "request": {
 | |
|     "method": "POST",
 | |
|     "url": "http://0.0.0.0:11434/v1/v1/chat/completions",
 | |
|     "headers": {},
 | |
|     "body": {
 | |
|       "model": "llama3.2:3b-instruct-fp16",
 | |
|       "messages": [
 | |
|         {
 | |
|           "role": "system",
 | |
|           "content": "You are a helpful assistant."
 | |
|         },
 | |
|         {
 | |
|           "role": "user",
 | |
|           "content": "What is the capital of France?"
 | |
|         }
 | |
|       ],
 | |
|       "stream": true,
 | |
|       "stream_options": {
 | |
|         "include_usage": true
 | |
|       }
 | |
|     },
 | |
|     "endpoint": "/v1/chat/completions",
 | |
|     "model": "llama3.2:3b-instruct-fp16"
 | |
|   },
 | |
|   "response": {
 | |
|     "body": [
 | |
|       {
 | |
|         "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
 | |
|         "__data__": {
 | |
|           "id": "rec-b3c24a0ab429",
 | |
|           "choices": [
 | |
|             {
 | |
|               "delta": {
 | |
|                 "content": "The",
 | |
|                 "function_call": null,
 | |
|                 "refusal": null,
 | |
|                 "role": "assistant",
 | |
|                 "tool_calls": null
 | |
|               },
 | |
|               "finish_reason": null,
 | |
|               "index": 0,
 | |
|               "logprobs": null
 | |
|             }
 | |
|           ],
 | |
|           "created": 0,
 | |
|           "model": "llama3.2:3b-instruct-fp16",
 | |
|           "object": "chat.completion.chunk",
 | |
|           "service_tier": null,
 | |
|           "system_fingerprint": "fp_ollama",
 | |
|           "usage": null
 | |
|         }
 | |
|       },
 | |
|       {
 | |
|         "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
 | |
|         "__data__": {
 | |
|           "id": "rec-b3c24a0ab429",
 | |
|           "choices": [
 | |
|             {
 | |
|               "delta": {
 | |
|                 "content": " capital",
 | |
|                 "function_call": null,
 | |
|                 "refusal": null,
 | |
|                 "role": "assistant",
 | |
|                 "tool_calls": null
 | |
|               },
 | |
|               "finish_reason": null,
 | |
|               "index": 0,
 | |
|               "logprobs": null
 | |
|             }
 | |
|           ],
 | |
|           "created": 0,
 | |
|           "model": "llama3.2:3b-instruct-fp16",
 | |
|           "object": "chat.completion.chunk",
 | |
|           "service_tier": null,
 | |
|           "system_fingerprint": "fp_ollama",
 | |
|           "usage": null
 | |
|         }
 | |
|       },
 | |
|       {
 | |
|         "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
 | |
|         "__data__": {
 | |
|           "id": "rec-b3c24a0ab429",
 | |
|           "choices": [
 | |
|             {
 | |
|               "delta": {
 | |
|                 "content": " of",
 | |
|                 "function_call": null,
 | |
|                 "refusal": null,
 | |
|                 "role": "assistant",
 | |
|                 "tool_calls": null
 | |
|               },
 | |
|               "finish_reason": null,
 | |
|               "index": 0,
 | |
|               "logprobs": null
 | |
|             }
 | |
|           ],
 | |
|           "created": 0,
 | |
|           "model": "llama3.2:3b-instruct-fp16",
 | |
|           "object": "chat.completion.chunk",
 | |
|           "service_tier": null,
 | |
|           "system_fingerprint": "fp_ollama",
 | |
|           "usage": null
 | |
|         }
 | |
|       },
 | |
|       {
 | |
|         "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
 | |
|         "__data__": {
 | |
|           "id": "rec-b3c24a0ab429",
 | |
|           "choices": [
 | |
|             {
 | |
|               "delta": {
 | |
|                 "content": " France",
 | |
|                 "function_call": null,
 | |
|                 "refusal": null,
 | |
|                 "role": "assistant",
 | |
|                 "tool_calls": null
 | |
|               },
 | |
|               "finish_reason": null,
 | |
|               "index": 0,
 | |
|               "logprobs": null
 | |
|             }
 | |
|           ],
 | |
|           "created": 0,
 | |
|           "model": "llama3.2:3b-instruct-fp16",
 | |
|           "object": "chat.completion.chunk",
 | |
|           "service_tier": null,
 | |
|           "system_fingerprint": "fp_ollama",
 | |
|           "usage": null
 | |
|         }
 | |
|       },
 | |
|       {
 | |
|         "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
 | |
|         "__data__": {
 | |
|           "id": "rec-b3c24a0ab429",
 | |
|           "choices": [
 | |
|             {
 | |
|               "delta": {
 | |
|                 "content": " is",
 | |
|                 "function_call": null,
 | |
|                 "refusal": null,
 | |
|                 "role": "assistant",
 | |
|                 "tool_calls": null
 | |
|               },
 | |
|               "finish_reason": null,
 | |
|               "index": 0,
 | |
|               "logprobs": null
 | |
|             }
 | |
|           ],
 | |
|           "created": 0,
 | |
|           "model": "llama3.2:3b-instruct-fp16",
 | |
|           "object": "chat.completion.chunk",
 | |
|           "service_tier": null,
 | |
|           "system_fingerprint": "fp_ollama",
 | |
|           "usage": null
 | |
|         }
 | |
|       },
 | |
|       {
 | |
|         "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
 | |
|         "__data__": {
 | |
|           "id": "rec-b3c24a0ab429",
 | |
|           "choices": [
 | |
|             {
 | |
|               "delta": {
 | |
|                 "content": " Paris",
 | |
|                 "function_call": null,
 | |
|                 "refusal": null,
 | |
|                 "role": "assistant",
 | |
|                 "tool_calls": null
 | |
|               },
 | |
|               "finish_reason": null,
 | |
|               "index": 0,
 | |
|               "logprobs": null
 | |
|             }
 | |
|           ],
 | |
|           "created": 0,
 | |
|           "model": "llama3.2:3b-instruct-fp16",
 | |
|           "object": "chat.completion.chunk",
 | |
|           "service_tier": null,
 | |
|           "system_fingerprint": "fp_ollama",
 | |
|           "usage": null
 | |
|         }
 | |
|       },
 | |
|       {
 | |
|         "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
 | |
|         "__data__": {
 | |
|           "id": "rec-b3c24a0ab429",
 | |
|           "choices": [
 | |
|             {
 | |
|               "delta": {
 | |
|                 "content": ".",
 | |
|                 "function_call": null,
 | |
|                 "refusal": null,
 | |
|                 "role": "assistant",
 | |
|                 "tool_calls": null
 | |
|               },
 | |
|               "finish_reason": null,
 | |
|               "index": 0,
 | |
|               "logprobs": null
 | |
|             }
 | |
|           ],
 | |
|           "created": 0,
 | |
|           "model": "llama3.2:3b-instruct-fp16",
 | |
|           "object": "chat.completion.chunk",
 | |
|           "service_tier": null,
 | |
|           "system_fingerprint": "fp_ollama",
 | |
|           "usage": null
 | |
|         }
 | |
|       },
 | |
|       {
 | |
|         "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
 | |
|         "__data__": {
 | |
|           "id": "rec-b3c24a0ab429",
 | |
|           "choices": [
 | |
|             {
 | |
|               "delta": {
 | |
|                 "content": "",
 | |
|                 "function_call": null,
 | |
|                 "refusal": null,
 | |
|                 "role": "assistant",
 | |
|                 "tool_calls": null
 | |
|               },
 | |
|               "finish_reason": "stop",
 | |
|               "index": 0,
 | |
|               "logprobs": null
 | |
|             }
 | |
|           ],
 | |
|           "created": 0,
 | |
|           "model": "llama3.2:3b-instruct-fp16",
 | |
|           "object": "chat.completion.chunk",
 | |
|           "service_tier": null,
 | |
|           "system_fingerprint": "fp_ollama",
 | |
|           "usage": null
 | |
|         }
 | |
|       },
 | |
|       {
 | |
|         "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
 | |
|         "__data__": {
 | |
|           "id": "rec-b3c24a0ab429",
 | |
|           "choices": [],
 | |
|           "created": 0,
 | |
|           "model": "llama3.2:3b-instruct-fp16",
 | |
|           "object": "chat.completion.chunk",
 | |
|           "service_tier": null,
 | |
|           "system_fingerprint": "fp_ollama",
 | |
|           "usage": {
 | |
|             "completion_tokens": 8,
 | |
|             "prompt_tokens": 38,
 | |
|             "total_tokens": 46,
 | |
|             "completion_tokens_details": null,
 | |
|             "prompt_tokens_details": null
 | |
|           }
 | |
|         }
 | |
|       }
 | |
|     ],
 | |
|     "is_streaming": true
 | |
|   },
 | |
|   "id_normalization_mapping": {}
 | |
| }
 |