@@ -427,3 +427,172 @@ Feature: Responses endpoint API tests
427427 """
428428 Then The status code of the response is 503
429429 And The body of the response contains Unable to connect to Llama Stack
430+
431+
432+ Scenario : Responses endpoint with tool_choice none answers knowledge question without file search usage
433+ Given The system is in default state
434+ And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
435+ And I capture the current token metrics
436+ When I use "responses" to ask question with authorization header
437+ """
438+ {
439+ "input": "What is the title of the article from Paul?",
440+ "model": "{PROVIDER}/{MODEL}",
441+ "stream": false,
442+ "instructions": "You are an assistant. You MUST use the file_search tool to answer. Answer in lowercase.",
443+ "tool_choice": "none"
444+ }
445+ """
446+ Then The status code of the response is 200
447+ And The responses output should not include any tool invocation item types
448+ And The token metrics should have increased
449+
450+ Scenario : Check if responses endpoint with tool_choice auto answers a knowledge question using file search
451+ Given The system is in default state
452+ And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
453+ And I capture the current token metrics
454+ When I use "responses" to ask question with authorization header
455+ """
456+ {
457+ "input": "What is the title of the article from Paul?",
458+ "model": "{PROVIDER}/{MODEL}",
459+ "stream": false,
460+ "instructions": "You are an assistant. You MUST use the file_search tool to answer. Answer in lowercase.",
461+ "tool_choice": "auto"
462+ }
463+ """
464+ Then The status code of the response is 200
465+ And The responses output should include an item with type "file_search_call"
466+ And The responses output_text should contain following fragments
467+ | Fragments in LLM response |
468+ | great work |
469+ And The token metrics should have increased
470+
471+ Scenario : Check if responses endpoint with tool_choice required still invokes document search for a basic question
472+ Given The system is in default state
473+ And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
474+ And I capture the current token metrics
475+ When I use "responses" to ask question with authorization header
476+ """
477+ {
478+ "input": "Hello World!",
479+ "model": "{PROVIDER}/{MODEL}",
480+ "stream": false,
481+ "tool_choice": "required"
482+ }
483+ """
484+ Then The status code of the response is 200
485+ And The responses output should include an item with type "file_search_call"
486+ And The token metrics should have increased
487+
488+ Scenario : Check if responses endpoint with file search as the chosen tool answers using file search
489+ Given The system is in default state
490+ And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
491+ And I capture the current token metrics
492+ When I use "responses" to ask question with authorization header
493+ """
494+ {
495+ "input": "What is the title of the article from Paul?",
496+ "model": "{PROVIDER}/{MODEL}",
497+ "stream": false,
498+ "instructions": "You are an assistant. You MUST use the file_search tool to answer. Answer in lowercase.",
499+ "tool_choice": {"type": "file_search"}
500+ }
501+ """
502+ Then The status code of the response is 200
503+ And The responses output should include an item with type "file_search_call"
504+ And The responses output_text should contain following fragments
505+ | Fragments in LLM response |
506+ | great work |
507+ And The token metrics should have increased
508+
509+ Scenario : Check if responses endpoint with allowed tools in automatic mode answers knowledge question using file search
510+ Given The system is in default state
511+ And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
512+ And I capture the current token metrics
513+ When I use "responses" to ask question with authorization header
514+ """
515+ {
516+ "input": "What is the title of the article from Paul?",
517+ "model": "{PROVIDER}/{MODEL}",
518+ "stream": false,
519+ "instructions": "You are an assistant. You MUST use the file_search tool to answer. Answer in lowercase.",
520+ "tool_choice": {
521+ "type": "allowed_tools",
522+ "mode": "auto",
523+ "tools": [{"type": "file_search"}]
524+ }
525+ }
526+ """
527+ Then The status code of the response is 200
528+ And The responses output should include an item with type "file_search_call"
529+ And The responses output_text should contain following fragments
530+ | Fragments in LLM response |
531+ | great work |
532+ And The token metrics should have increased
533+
534+ Scenario : Check if responses endpoint with allowed tools in required mode invokes file search for a basic question
535+ Given The system is in default state
536+ And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
537+ And I capture the current token metrics
538+ When I use "responses" to ask question with authorization header
539+ """
540+ {
541+ "input": "Hello world!",
542+ "model": "{PROVIDER}/{MODEL}",
543+ "stream": false,
544+ "tool_choice": {
545+ "type": "allowed_tools",
546+ "mode": "required",
547+ "tools": [{"type": "file_search"}]
548+ }
549+ }
550+ """
551+ Then The status code of the response is 200
552+ And The responses output should include an item with type "file_search_call"
553+ And The token metrics should have increased
554+
555+ Scenario : Allowed tools auto mode with only MCP in allowlist does not use file search for knowledge question
556+ Given The system is in default state
557+ And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
558+ And I capture the current token metrics
559+ When I use "responses" to ask question with authorization header
560+ """
561+ {
562+ "input": "What is the title of the article from Paul?",
563+ "model": "{PROVIDER}/{MODEL}",
564+ "stream": false,
565+ "instructions": "You are an assistant. Answer in lowercase.",
566+ "tool_choice": {
567+ "type": "allowed_tools",
568+ "mode": "auto",
569+ "tools": [{"type": "mcp"}]
570+ }
571+ }
572+ """
573+ Then The status code of the response is 200
574+ And The responses output should not include an item with type "file_search_call"
575+ And The token metrics should have increased
576+
577+ Scenario : Required allowed_tools with invalid filter returns no tool invocations on knowledge question
578+ Given The system is in default state
579+ And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
580+ And I capture the current token metrics
581+ When I use "responses" to ask question with authorization header
582+ """
583+ {
584+ "input": "What is the title of the article from Paul?",
585+ "model": "{PROVIDER}/{MODEL}",
586+ "stream": false,
587+ "instructions": "You are an assistant. You MUST use the file_search tool to answer. Answer in lowercase.",
588+ "tools": [],
589+ "tool_choice": {
590+ "type": "allowed_tools",
591+ "mode": "required",
592+ "tools": [{"non-existing": "tool"}]
593+ }
594+ }
595+ """
596+ Then The status code of the response is 200
597+ And The responses output should not include any tool invocation item types
598+ And The token metrics should have increased
0 commit comments