mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
Python: Temporarily skip OpenAI integration tests (#14517)
Disable failing OpenAI integration and sample cases while the CI API key returns HTTP 401. Keep other providers and OpenAPI cross-language coverage enabled. ### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄 --------- Co-authored-by: Copilot App <[email protected]>
This commit is contained in:
co-authored by
Copilot App
parent
58ad1a3780
commit
bd05515b8c
+45
-10
@@ -15,6 +15,8 @@ from semantic_kernel.contents.text_content import TextContent
|
||||
from semantic_kernel.functions import kernel_function
|
||||
from tests.integration.agents.agent_test_base import AgentTestBase
|
||||
|
||||
openai_api_key_skip = pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401).")
|
||||
|
||||
|
||||
class WeatherPlugin:
|
||||
"""A sample Mock weather plugin."""
|
||||
@@ -57,7 +59,12 @@ class TestChatCompletionAgentIntegration:
|
||||
|
||||
# region Simple 'Hello' messages tests
|
||||
|
||||
@pytest.mark.parametrize("chat_completion_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
|
||||
@pytest.mark.parametrize(
|
||||
"chat_completion_agent",
|
||||
["azure", pytest.param("openai", marks=openai_api_key_skip)],
|
||||
indirect=True,
|
||||
ids=["azure", "openai"],
|
||||
)
|
||||
async def test_get_response(self, chat_completion_agent: ChatCompletionAgent, agent_test_base: AgentTestBase):
|
||||
"""Test get response of the agent."""
|
||||
response = await agent_test_base.get_response_with_retry(chat_completion_agent, messages="Hello")
|
||||
@@ -65,7 +72,12 @@ class TestChatCompletionAgentIntegration:
|
||||
assert response.message.role == AuthorRole.ASSISTANT
|
||||
assert response.message.content is not None
|
||||
|
||||
@pytest.mark.parametrize("chat_completion_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
|
||||
@pytest.mark.parametrize(
|
||||
"chat_completion_agent",
|
||||
["azure", pytest.param("openai", marks=openai_api_key_skip)],
|
||||
indirect=True,
|
||||
ids=["azure", "openai"],
|
||||
)
|
||||
async def test_get_response_with_thread(
|
||||
self, chat_completion_agent: ChatCompletionAgent, agent_test_base: AgentTestBase
|
||||
):
|
||||
@@ -85,7 +97,12 @@ class TestChatCompletionAgentIntegration:
|
||||
assert response.message.content is not None
|
||||
await thread.delete() if thread else None
|
||||
|
||||
@pytest.mark.parametrize("chat_completion_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
|
||||
@pytest.mark.parametrize(
|
||||
"chat_completion_agent",
|
||||
["azure", pytest.param("openai", marks=openai_api_key_skip)],
|
||||
indirect=True,
|
||||
ids=["azure", "openai"],
|
||||
)
|
||||
async def test_invoke(self, chat_completion_agent: ChatCompletionAgent, agent_test_base: AgentTestBase):
|
||||
"""Test invoke of the agent."""
|
||||
responses = await agent_test_base.get_invoke_with_retry(chat_completion_agent, messages="Hello")
|
||||
@@ -100,7 +117,12 @@ class TestChatCompletionAgentIntegration:
|
||||
assert usage.prompt_tokens > 0
|
||||
assert usage.completion_tokens > 0
|
||||
|
||||
@pytest.mark.parametrize("chat_completion_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
|
||||
@pytest.mark.parametrize(
|
||||
"chat_completion_agent",
|
||||
["azure", pytest.param("openai", marks=openai_api_key_skip)],
|
||||
indirect=True,
|
||||
ids=["azure", "openai"],
|
||||
)
|
||||
async def test_invoke_with_thread(self, chat_completion_agent: ChatCompletionAgent, agent_test_base: AgentTestBase):
|
||||
"""Test invoke of the agent with a thread."""
|
||||
thread = None
|
||||
@@ -119,7 +141,12 @@ class TestChatCompletionAgentIntegration:
|
||||
|
||||
await thread.delete() if thread else None
|
||||
|
||||
@pytest.mark.parametrize("chat_completion_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
|
||||
@pytest.mark.parametrize(
|
||||
"chat_completion_agent",
|
||||
["azure", pytest.param("openai", marks=openai_api_key_skip)],
|
||||
indirect=True,
|
||||
ids=["azure", "openai"],
|
||||
)
|
||||
async def test_invoke_stream(self, chat_completion_agent: ChatCompletionAgent, agent_test_base: AgentTestBase):
|
||||
"""Test invoke stream of the agent."""
|
||||
responses = await agent_test_base.get_invoke_stream_with_retry(chat_completion_agent, messages="Hello")
|
||||
@@ -134,7 +161,12 @@ class TestChatCompletionAgentIntegration:
|
||||
assert usage.prompt_tokens > 0
|
||||
assert usage.completion_tokens > 0
|
||||
|
||||
@pytest.mark.parametrize("chat_completion_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
|
||||
@pytest.mark.parametrize(
|
||||
"chat_completion_agent",
|
||||
["azure", pytest.param("openai", marks=openai_api_key_skip)],
|
||||
indirect=True,
|
||||
ids=["azure", "openai"],
|
||||
)
|
||||
async def test_invoke_stream_with_thread(
|
||||
self, chat_completion_agent: ChatCompletionAgent, agent_test_base: AgentTestBase
|
||||
):
|
||||
@@ -163,7 +195,7 @@ class TestChatCompletionAgentIntegration:
|
||||
"chat_completion_agent",
|
||||
[
|
||||
("azure", {"enable_kernel_function": True}),
|
||||
("openai", {"enable_kernel_function": True}),
|
||||
pytest.param(("openai", {"enable_kernel_function": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["chat_completion_agent"],
|
||||
ids=["azure-function-calling", "openai-function-calling"],
|
||||
@@ -185,7 +217,7 @@ class TestChatCompletionAgentIntegration:
|
||||
"chat_completion_agent",
|
||||
[
|
||||
("azure", {"enable_kernel_function": True}),
|
||||
("openai", {"enable_kernel_function": True}),
|
||||
pytest.param(("openai", {"enable_kernel_function": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["chat_completion_agent"],
|
||||
ids=["azure-function-calling", "openai-function-calling"],
|
||||
@@ -209,7 +241,7 @@ class TestChatCompletionAgentIntegration:
|
||||
"chat_completion_agent",
|
||||
[
|
||||
("azure", {"enable_kernel_function": True}),
|
||||
("openai", {"enable_kernel_function": True}),
|
||||
pytest.param(("openai", {"enable_kernel_function": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["chat_completion_agent"],
|
||||
ids=["azure-function-calling", "openai-function-calling"],
|
||||
@@ -240,7 +272,10 @@ class TestChatCompletionAgentIntegration:
|
||||
("azure", {"enable_kernel_function": True}),
|
||||
pytest.param(
|
||||
("openai", {"enable_kernel_function": True}),
|
||||
marks=pytest.mark.xfail(reason="OpenAI service raise error for downloading image from URL"),
|
||||
marks=[
|
||||
pytest.mark.xfail(reason="OpenAI service raise error for downloading image from URL"),
|
||||
openai_api_key_skip,
|
||||
],
|
||||
),
|
||||
],
|
||||
indirect=["chat_completion_agent"],
|
||||
|
||||
+48
-16
@@ -15,6 +15,8 @@ from semantic_kernel.contents.text_content import TextContent
|
||||
from semantic_kernel.functions import kernel_function
|
||||
from tests.integration.agents.agent_test_base import AgentTestBase
|
||||
|
||||
openai_api_key_skip = pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401).")
|
||||
|
||||
|
||||
class WeatherPlugin:
|
||||
"""A sample Mock weather plugin."""
|
||||
@@ -99,7 +101,12 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
|
||||
# region Simple 'Hello' messages tests
|
||||
|
||||
@pytest.mark.parametrize("responses_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
|
||||
@pytest.mark.parametrize(
|
||||
"responses_agent",
|
||||
["azure", pytest.param("openai", marks=openai_api_key_skip)],
|
||||
indirect=True,
|
||||
ids=["azure", "openai"],
|
||||
)
|
||||
async def test_get_response(self, responses_agent: OpenAIResponsesAgent, agent_test_base: AgentTestBase):
|
||||
"""Test get response of the agent."""
|
||||
response = await agent_test_base.get_response_with_retry(responses_agent, messages="Hello")
|
||||
@@ -108,7 +115,12 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
assert response.message.content is not None
|
||||
assert "thread_id" in response.message.metadata
|
||||
|
||||
@pytest.mark.parametrize("responses_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
|
||||
@pytest.mark.parametrize(
|
||||
"responses_agent",
|
||||
["azure", pytest.param("openai", marks=openai_api_key_skip)],
|
||||
indirect=True,
|
||||
ids=["azure", "openai"],
|
||||
)
|
||||
async def test_get_response_with_thread(
|
||||
self, responses_agent: OpenAIResponsesAgent, agent_test_base: AgentTestBase
|
||||
):
|
||||
@@ -127,7 +139,12 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
|
||||
await thread.delete() if thread else None
|
||||
|
||||
@pytest.mark.parametrize("responses_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
|
||||
@pytest.mark.parametrize(
|
||||
"responses_agent",
|
||||
["azure", pytest.param("openai", marks=openai_api_key_skip)],
|
||||
indirect=True,
|
||||
ids=["azure", "openai"],
|
||||
)
|
||||
async def test_invoke(self, responses_agent: OpenAIResponsesAgent, agent_test_base: AgentTestBase):
|
||||
"""Test invoke of the agent."""
|
||||
async for response in responses_agent.invoke(messages="Hello"):
|
||||
@@ -135,7 +152,12 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
assert response.message.role == AuthorRole.ASSISTANT
|
||||
assert response.message.content is not None
|
||||
|
||||
@pytest.mark.parametrize("responses_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
|
||||
@pytest.mark.parametrize(
|
||||
"responses_agent",
|
||||
["azure", pytest.param("openai", marks=openai_api_key_skip)],
|
||||
indirect=True,
|
||||
ids=["azure", "openai"],
|
||||
)
|
||||
async def test_invoke_with_thread(self, responses_agent: OpenAIResponsesAgent, agent_test_base: AgentTestBase):
|
||||
"""Test invoke of the agent with a thread."""
|
||||
thread = None
|
||||
@@ -154,7 +176,12 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
|
||||
await thread.delete() if thread else None
|
||||
|
||||
@pytest.mark.parametrize("responses_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
|
||||
@pytest.mark.parametrize(
|
||||
"responses_agent",
|
||||
["azure", pytest.param("openai", marks=openai_api_key_skip)],
|
||||
indirect=True,
|
||||
ids=["azure", "openai"],
|
||||
)
|
||||
async def test_invoke_stream(self, responses_agent: OpenAIResponsesAgent, agent_test_base: AgentTestBase):
|
||||
"""Test invoke stream of the agent."""
|
||||
responses = await agent_test_base.get_invoke_stream_with_retry(responses_agent, messages="Hello")
|
||||
@@ -164,7 +191,12 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
assert response.message.role == AuthorRole.ASSISTANT
|
||||
assert response.message.content is not None
|
||||
|
||||
@pytest.mark.parametrize("responses_agent", ["azure", "openai"], indirect=True, ids=["azure", "openai"])
|
||||
@pytest.mark.parametrize(
|
||||
"responses_agent",
|
||||
["azure", pytest.param("openai", marks=openai_api_key_skip)],
|
||||
indirect=True,
|
||||
ids=["azure", "openai"],
|
||||
)
|
||||
async def test_invoke_stream_with_thread(
|
||||
self, responses_agent: OpenAIResponsesAgent, agent_test_base: AgentTestBase
|
||||
):
|
||||
@@ -193,7 +225,7 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
"responses_agent",
|
||||
[
|
||||
# Azure OpenAI Responses API doesn't yet support the web search tool
|
||||
("openai", {"enable_web_search": True}),
|
||||
pytest.param(("openai", {"enable_web_search": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["responses_agent"],
|
||||
ids=["openai-web-search-get-response"],
|
||||
@@ -215,7 +247,7 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
"responses_agent",
|
||||
[
|
||||
("azure", {"enable_file_search": True}),
|
||||
("openai", {"enable_file_search": True}),
|
||||
pytest.param(("openai", {"enable_file_search": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["responses_agent"],
|
||||
ids=["azure-file-search-get-response", "openai-file-search-get-response"],
|
||||
@@ -234,7 +266,7 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
"responses_agent",
|
||||
[
|
||||
("azure", {"enable_file_search": True}),
|
||||
("openai", {"enable_file_search": True}),
|
||||
pytest.param(("openai", {"enable_file_search": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["responses_agent"],
|
||||
ids=["azure-file-search-invoke", "openai-file-search-invoke"],
|
||||
@@ -253,7 +285,7 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
"responses_agent",
|
||||
[
|
||||
("azure", {"enable_file_search": True}),
|
||||
("openai", {"enable_file_search": True}),
|
||||
pytest.param(("openai", {"enable_file_search": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["responses_agent"],
|
||||
ids=["azure-file-search-invoke-stream", "openai-file-search-invoke-stream"],
|
||||
@@ -278,7 +310,7 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
"responses_agent",
|
||||
[
|
||||
("azure", {"enable_kernel_function": True}),
|
||||
("openai", {"enable_kernel_function": True}),
|
||||
pytest.param(("openai", {"enable_kernel_function": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["responses_agent"],
|
||||
ids=["azure-function-calling-get-response", "openai-function-calling-get-response"],
|
||||
@@ -300,7 +332,7 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
"responses_agent",
|
||||
[
|
||||
("azure", {"enable_kernel_function": True}),
|
||||
("openai", {"enable_kernel_function": True}),
|
||||
pytest.param(("openai", {"enable_kernel_function": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["responses_agent"],
|
||||
ids=["azure-function-calling-invoke", "openai-function-calling-invoke"],
|
||||
@@ -322,7 +354,7 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
"responses_agent",
|
||||
[
|
||||
("azure", {"enable_kernel_function": True}),
|
||||
("openai", {"enable_kernel_function": True}),
|
||||
pytest.param(("openai", {"enable_kernel_function": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["responses_agent"],
|
||||
ids=["azure-function-calling-invoke-stream", "openai-function-calling-invoke-stream"],
|
||||
@@ -349,7 +381,7 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
"responses_agent",
|
||||
[
|
||||
("azure", {"enable_structured_outputs": True}),
|
||||
("openai", {"enable_structured_outputs": True}),
|
||||
pytest.param(("openai", {"enable_structured_outputs": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["responses_agent"],
|
||||
ids=["azure-structured-outputs-get-response", "openai-structured-outputs-get-response"],
|
||||
@@ -371,7 +403,7 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
"responses_agent",
|
||||
[
|
||||
("azure", {"enable_structured_outputs": True}),
|
||||
("openai", {"enable_structured_outputs": True}),
|
||||
pytest.param(("openai", {"enable_structured_outputs": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["responses_agent"],
|
||||
ids=["azure-structured-outputs-invoke", "openai-structured-outputs-invoke"],
|
||||
@@ -395,7 +427,7 @@ class TestOpenAIResponsesAgentIntegration:
|
||||
"responses_agent",
|
||||
[
|
||||
("azure", {"enable_structured_outputs": True}),
|
||||
("openai", {"enable_structured_outputs": True}),
|
||||
pytest.param(("openai", {"enable_structured_outputs": True}), marks=openai_api_key_skip),
|
||||
],
|
||||
indirect=["responses_agent"],
|
||||
ids=["azure-structured-outputs-invoke-stream", "openai-structured-outputs-invoke-stream"],
|
||||
|
||||
@@ -15,6 +15,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
"openai",
|
||||
AudioContent.from_audio_file(os.path.join(os.path.dirname(__file__), "../../", "assets/sample_audio.mp3")),
|
||||
["hi", "how", "are", "you", "doing"],
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai",
|
||||
),
|
||||
pytest.param(
|
||||
|
||||
@@ -75,6 +75,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
]
|
||||
],
|
||||
{"test_type": FunctionChoiceTestTypes.AUTO},
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai_tool_call_auto",
|
||||
),
|
||||
pytest.param(
|
||||
@@ -97,6 +98,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
]
|
||||
],
|
||||
{"test_type": FunctionChoiceTestTypes.NON_AUTO},
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai_tool_call_non_auto",
|
||||
),
|
||||
pytest.param(
|
||||
@@ -123,6 +125,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
],
|
||||
],
|
||||
{"test_type": FunctionChoiceTestTypes.FLOW},
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai_tool_call_flow",
|
||||
),
|
||||
pytest.param(
|
||||
@@ -141,6 +144,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
]
|
||||
],
|
||||
{"test_type": FunctionChoiceTestTypes.AUTO},
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai_tool_call_auto_complex_return_type",
|
||||
),
|
||||
# endregion
|
||||
|
||||
+2
@@ -49,6 +49,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
ChatMessageContent(role=AuthorRole.USER, items=[TextContent(text="Where was it made?")]),
|
||||
],
|
||||
{},
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai_image_input_uri",
|
||||
),
|
||||
pytest.param(
|
||||
@@ -67,6 +68,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
ChatMessageContent(role=AuthorRole.USER, items=[TextContent(text="Where was it made?")]),
|
||||
],
|
||||
{},
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai_image_input_file",
|
||||
),
|
||||
pytest.param(
|
||||
|
||||
@@ -49,6 +49,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
ChatMessageContent(role=AuthorRole.USER, items=[TextContent(text="How are you today?")]),
|
||||
],
|
||||
{},
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai_text_input",
|
||||
),
|
||||
pytest.param(
|
||||
@@ -59,6 +60,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
ChatMessageContent(role=AuthorRole.USER, items=[TextContent(text="How are you today?")]),
|
||||
],
|
||||
{},
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai_json_schema_response_format",
|
||||
),
|
||||
# endregion
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
import pytest
|
||||
|
||||
import semantic_kernel.connectors.ai.open_ai as sk_oai
|
||||
from semantic_kernel.connectors.ai.prompt_execution_settings import PromptExecutionSettings
|
||||
@@ -47,6 +48,7 @@ Jane: That's a good idea. Let me see if I can find one. Maybe Lorem Ipsum?
|
||||
John: Yeah, that's a good idea."""
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401).")
|
||||
async def test_azure_summarize_conversation_using_plugin(kernel):
|
||||
service_id = "text_completion"
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
{},
|
||||
["Repeat the word Hello once"],
|
||||
{},
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai_text_completion",
|
||||
),
|
||||
pytest.param(
|
||||
|
||||
@@ -26,6 +26,8 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
OPENAI_MODEL_ID = "gpt-4.1-nano"
|
||||
|
||||
openai_api_key_skip = pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401).")
|
||||
|
||||
# region Test Prompts
|
||||
|
||||
simple_prompt = "Can you help me tell the time in Seattle right now?"
|
||||
@@ -188,6 +190,7 @@ class City:
|
||||
# region Test Prompt With Chat Roles
|
||||
|
||||
|
||||
@openai_api_key_skip
|
||||
@pytest.mark.parametrize(
|
||||
"is_inline, is_streaming, template_format, prompt",
|
||||
[
|
||||
@@ -299,6 +302,7 @@ async def test_prompt_with_chat_roles(
|
||||
# region Test Prompt With Complex Objects
|
||||
|
||||
|
||||
@openai_api_key_skip
|
||||
@pytest.mark.parametrize(
|
||||
"is_inline, is_streaming, template_format, prompt",
|
||||
[
|
||||
@@ -411,6 +415,7 @@ async def test_prompt_with_complex_objects(
|
||||
# region Test Prompt With Helper Functions
|
||||
|
||||
|
||||
@openai_api_key_skip
|
||||
@pytest.mark.parametrize(
|
||||
"is_inline, is_streaming, template_format, prompt",
|
||||
[
|
||||
@@ -497,6 +502,7 @@ async def test_prompt_with_helper_functions(
|
||||
# region Test Prompt With Simple Variable
|
||||
|
||||
|
||||
@openai_api_key_skip
|
||||
@pytest.mark.parametrize(
|
||||
"is_inline, is_streaming, template_format, prompt",
|
||||
[
|
||||
@@ -562,6 +568,7 @@ async def test_prompt_with_simple_variable(
|
||||
# region Test Simple Prompt
|
||||
|
||||
|
||||
@openai_api_key_skip
|
||||
@pytest.mark.parametrize(
|
||||
"is_inline, is_streaming, template_format, prompt",
|
||||
[
|
||||
@@ -626,6 +633,7 @@ async def test_simple_prompt(
|
||||
# region Test YAML Prompts
|
||||
|
||||
|
||||
@openai_api_key_skip
|
||||
@pytest.mark.parametrize(
|
||||
"is_streaming, prompt_path, expected_result_path",
|
||||
[
|
||||
|
||||
@@ -22,6 +22,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
"openai",
|
||||
{},
|
||||
1536, # text-embedding-ada-002 doesn't support custom output dimensionality
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai",
|
||||
),
|
||||
pytest.param(
|
||||
|
||||
@@ -23,6 +23,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
pytest.param(
|
||||
"openai",
|
||||
{},
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai",
|
||||
),
|
||||
pytest.param(
|
||||
|
||||
@@ -13,6 +13,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
pytest.param(
|
||||
"openai",
|
||||
"Hello World!",
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai",
|
||||
),
|
||||
pytest.param(
|
||||
|
||||
@@ -12,6 +12,7 @@ pytestmark = pytest.mark.parametrize(
|
||||
pytest.param(
|
||||
"openai",
|
||||
"A cute tuxedo cat driving a race car.",
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
id="openai",
|
||||
),
|
||||
pytest.param(
|
||||
|
||||
@@ -77,17 +77,23 @@ concepts = [
|
||||
semantic_caching,
|
||||
[],
|
||||
id="semantic_caching",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
simple_chatbot,
|
||||
["Why is the sky blue in one sentence?", "exit"],
|
||||
id="simple_chatbot",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
simple_chatbot_streaming,
|
||||
@@ -133,9 +139,12 @@ concepts = [
|
||||
auto_function_invoke_filters,
|
||||
["What is 3+3?", "exit"],
|
||||
id="auto_function_invoke_filters",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
function_invocation_filters,
|
||||
@@ -157,18 +166,24 @@ concepts = [
|
||||
prompt_filters,
|
||||
["What is the fastest animal?", "exit"],
|
||||
id="prompt_filters",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
retry_with_different_model,
|
||||
[],
|
||||
id="retry_with_different_model",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None,
|
||||
reason="Not running completion samples.",
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None,
|
||||
reason="Not running completion samples.",
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
kernel_arguments,
|
||||
@@ -182,25 +197,34 @@ concepts = [
|
||||
grounded,
|
||||
[],
|
||||
id="grounded",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
openai_function_calling_with_custom_plugin,
|
||||
[],
|
||||
id="openai_function_calling_with_custom_plugin",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
plugins_from_dir,
|
||||
[],
|
||||
id="plugins_from_dir",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
azure_chat_gpt_api_handlebars,
|
||||
@@ -230,33 +254,50 @@ concepts = [
|
||||
configuring_prompts,
|
||||
["What is my name?", "exit"],
|
||||
id="configuring_prompts",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
load_yaml_prompt,
|
||||
[],
|
||||
id="load_yaml_prompt",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
template_language,
|
||||
[],
|
||||
id="template_language",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
simple_memory,
|
||||
[],
|
||||
id="simple_memory",
|
||||
marks=pytest.mark.skipif(os.getenv(MEMORY_CONCEPT_SAMPLE, None) is None, reason="Not running memory samples."),
|
||||
marks=[
|
||||
pytest.mark.skipif(os.getenv(MEMORY_CONCEPT_SAMPLE, None) is None, reason="Not running memory samples."),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
rag_with_vector_collection,
|
||||
[],
|
||||
id="rag_with_vector_collection",
|
||||
marks=pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
),
|
||||
param(rag_with_vector_collection, [], id="rag_with_vector_collection"),
|
||||
param(
|
||||
custom_service_selector,
|
||||
[],
|
||||
@@ -269,17 +310,23 @@ concepts = [
|
||||
function_defined_in_json_prompt,
|
||||
["What is 3+3?", "exit"],
|
||||
id="function_defined_in_json_prompt",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
function_defined_in_yaml_prompt,
|
||||
["What is 3+3?", "exit"],
|
||||
id="function_defined_in_yaml_prompt",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
step1_chat_completion_agent_simple,
|
||||
@@ -352,25 +399,34 @@ concepts = [
|
||||
image_generation,
|
||||
[],
|
||||
id="image_generation",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
text_completion,
|
||||
[],
|
||||
id="text_completion",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
text_embedding_generation,
|
||||
[],
|
||||
id="text_embedding_generation",
|
||||
marks=pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
pytest.mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
pytest.mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@@ -81,15 +81,17 @@ notebooks = [
|
||||
),
|
||||
param(
|
||||
"09-multiple-results-per-prompt.ipynb",
|
||||
marks=mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
mark.skipif(os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."),
|
||||
mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
param(
|
||||
"10-streaming-completions.ipynb",
|
||||
marks=mark.skipif(
|
||||
os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."
|
||||
),
|
||||
marks=[
|
||||
mark.skipif(os.getenv(COMPLETIONS_CONCEPT_SAMPLE, None) is None, reason="Not running completion samples."),
|
||||
mark.skip(reason="Temporarily disabled due to invalid OpenAI API key (HTTP 401)."),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user