Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ usearch = [
"pyarrow >= 12.0,< 20.0"
]
weaviate = [
"weaviate-client>=4.10,<4.13",
"weaviate-client>=4.10,<5.0",
]
pandas = [
"pandas ~= 2.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async def main() -> None:
# The filter is used for demonstration purposes to show the function invocation.
kernel.add_filter("function_invocation", function_invocation_filter)

ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@


async def main() -> None:
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


async def main() -> None:
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async def handle_intermediate_steps(message: ChatMessageContent) -> None:


async def main() -> None:
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def handle_streaming_intermediate_steps(message: ChatMessageContent) -> No


async def main() -> None:
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def invoke_agent_with_template(template_str: str, template_format: str, de
# Configure the prompt template
prompt_config = PromptTemplateConfig(template=template_str, template_format=template_format)

ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_item_price(


async def main() -> None:
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Planet(BaseModel):


async def main():
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()
async with (
DefaultAzureCredential() as creds,
AzureAIAgent.create_client(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# }

# Create the data source settings
azure_ai_search_settings = AzureAISearchSettings.create()
azure_ai_search_settings = AzureAISearchSettings()

az_source = AzureAISearchDataSource.from_azure_ai_search_settings(azure_ai_search_settings=azure_ai_search_settings)
extra = ExtraBody(data_sources=[az_source])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
kernel = sk.Kernel()

# Create the data source settings
azure_ai_search_settings = AzureAISearchSettings.create()
azure_ai_search_settings = AzureAISearchSettings()
az_source = AzureAISearchDataSource(parameters=azure_ai_search_settings.model_dump())
extra = ExtraBody(data_sources=[az_source])
req_settings = AzureChatPromptExecutionSettings(service_id="chat-gpt", extra_body=extra, tool_choice="auto")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Bonded by their love for the natural world and shared curiosity, they uncovered a
# groundbreaking phenomenon in glaciology that could potentially reshape our understanding of climate change.

azure_ai_search_settings = AzureAISearchSettings.create()
azure_ai_search_settings = AzureAISearchSettings()
azure_ai_search_settings = azure_ai_search_settings.model_dump()

# This example index has fields "title", "chunk", and "vector".
Expand Down
2 changes: 1 addition & 1 deletion python/samples/concepts/rag/self-critique_rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def populate_memory(memory: SemanticTextMemory) -> None:
async def main() -> None:
kernel = Kernel()

azure_ai_search_settings = AzureAISearchSettings.create()
azure_ai_search_settings = AzureAISearchSettings()
vector_size = 1536

# Setting up OpenAI services for text completion and text embedding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def get_deepseek_chat_completion_service_and_request_settings() -> tuple[
OpenAISettings,
)

openai_settings = OpenAISettings.create()
openai_settings = OpenAISettings()
if not openai_settings.api_key:
raise ServiceInitializationError("The DeepSeek API key is required.")
if not openai_settings.chat_model_id:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
kernel.add_service(ai_service)

try:
booking_sample_settings = BookingSampleSettings.create()
booking_sample_settings = BookingSampleSettings()
except ValidationError as e:
raise ServiceInitializationError("Failed to initialize the booking sample settings.") from e

Expand Down
2 changes: 1 addition & 1 deletion python/samples/demos/telemetry/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from samples.demos.telemetry.telemetry_sample_settings import TelemetrySampleSettings

# Load settings
settings = TelemetrySampleSettings.create()
settings = TelemetrySampleSettings()

# Create a resource to represent the service/sample
resource = Resource.create({ResourceAttributes.SERVICE_NAME: "TelemetryExample"})
Expand Down
2 changes: 1 addition & 1 deletion python/samples/getting_started/00-getting-started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"\n",
"from samples.service_settings import ServiceSettings\n",
"\n",
"service_settings = ServiceSettings.create()\n",
"service_settings = ServiceSettings()\n",
"\n",
"# Select a service to use for this notebook (available services: OpenAI, AzureOpenAI, HuggingFace)\n",
"selectedService = (\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"\n",
"from samples.service_settings import ServiceSettings\n",
"\n",
"service_settings = ServiceSettings.create()\n",
"service_settings = ServiceSettings()\n",
"\n",
"# Select a service to use for this notebook (available services: OpenAI, AzureOpenAI, HuggingFace)\n",
"selectedService = (\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"\n",
"from samples.service_settings import ServiceSettings\n",
"\n",
"service_settings = ServiceSettings.create()\n",
"service_settings = ServiceSettings()\n",
"\n",
"# Select a service to use for this notebook (available services: OpenAI, AzureOpenAI, HuggingFace)\n",
"selectedService = (\n",
Expand Down Expand Up @@ -260,7 +260,7 @@
"\n",
"from samples.service_settings import ServiceSettings\n",
"\n",
"service_settings = ServiceSettings.create()\n",
"service_settings = ServiceSettings()\n",
"\n",
"# Select a service to use for this notebook (available services: OpenAI, AzureOpenAI, HuggingFace)\n",
"selectedService = (\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"\n",
"from samples.service_settings import ServiceSettings\n",
"\n",
"service_settings = ServiceSettings.create()\n",
"service_settings = ServiceSettings()\n",
"\n",
"# Select a service to use for this notebook (available services: OpenAI, AzureOpenAI, HuggingFace)\n",
"selectedService = (\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"\n",
"from samples.service_settings import ServiceSettings\n",
"\n",
"service_settings = ServiceSettings.create()\n",
"service_settings = ServiceSettings()\n",
"\n",
"# Select a service to use for this notebook (available services: OpenAI, AzureOpenAI, HuggingFace)\n",
"selectedService = (\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"\n",
"from samples.service_settings import ServiceSettings\n",
"\n",
"service_settings = ServiceSettings.create()\n",
"service_settings = ServiceSettings()\n",
"\n",
"# Select a service to use for this notebook (available services: OpenAI, AzureOpenAI, HuggingFace)\n",
"selectedService = (\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"\n",
"from samples.service_settings import ServiceSettings\n",
"\n",
"service_settings = ServiceSettings.create()\n",
"service_settings = ServiceSettings()\n",
"\n",
"# Select a service to use for this notebook (available services: OpenAI, AzureOpenAI, HuggingFace)\n",
"selectedService = (\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"\n",
"from samples.service_settings import ServiceSettings\n",
"\n",
"service_settings = ServiceSettings.create()\n",
"service_settings = ServiceSettings()\n",
"\n",
"# Select a service to use for this notebook (available services: OpenAI, AzureOpenAI, HuggingFace)\n",
"selectedService = (\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
"\n",
"from samples.service_settings import ServiceSettings\n",
"\n",
"service_settings = ServiceSettings.create()\n",
"service_settings = ServiceSettings()\n",
"\n",
"# Select a service to use for this notebook (available services: OpenAI, AzureOpenAI, HuggingFace)\n",
"selectedService = (\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"\n",
"from samples.service_settings import ServiceSettings\n",
"\n",
"service_settings = ServiceSettings.create()\n",
"service_settings = ServiceSettings()\n",
"\n",
"# Select a service to use for this notebook (available services: OpenAI, AzureOpenAI, HuggingFace)\n",
"selectedService = (\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"\n",
"from samples.service_settings import ServiceSettings\n",
"\n",
"service_settings = ServiceSettings.create()\n",
"service_settings = ServiceSettings()\n",
"\n",
"# Select a service to use for this notebook (available services: OpenAI, AzureOpenAI, HuggingFace)\n",
"selectedService = (\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


async def main() -> None:
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_item_price(


async def main() -> None:
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async def should_agent_terminate(self, agent, history):


async def main():
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


async def main() -> None:
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


async def main() -> None:
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


async def main() -> None:
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()

async with (
DefaultAzureCredential() as creds,
Expand Down
6 changes: 4 additions & 2 deletions python/samples/service_settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright (c) Microsoft. All rights reserved.

from typing import Literal

from semantic_kernel.kernel_pydantic import KernelBaseSettings


Expand All @@ -13,8 +15,8 @@ class ServiceSettings(KernelBaseSettings):
are missing.

Args:
global_llm_service (str | None): The LLM service to use for the samples, either "OpenAI" or "AzureOpenAI"
global_llm_service: The LLM service to use for the samples, either "OpenAI" or "AzureOpenAI"
If not provided, defaults to "AzureOpenAI".
"""

global_llm_service: str | None = None
global_llm_service: Literal["OpenAI", "AzureOpenAI"] = "AzureOpenAI"
5 changes: 2 additions & 3 deletions python/samples/sk_service_configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ def add_service(
Kernel: The configured kernel
"""
try:
settings = ServiceSettings.create(
settings = ServiceSettings(
env_file_path=env_file_path,
env_file_encoding=env_file_encoding,
)
except ValidationError as ex:
raise ServiceInitializationError("Unable to configure learn resources settings.", ex) from ex

if not settings.global_llm_service:
if "global_llm_service" not in settings.model_fields_set:
print("GLOBAL_LLM_SERVICE not set, trying to use Azure OpenAI.")
settings.global_llm_service = "AzureOpenAI"

# The service_id is used to identify the service in the kernel.
# This can be updated to a custom value if needed.
Expand Down
2 changes: 1 addition & 1 deletion python/semantic_kernel/agents/azure_ai/azure_ai_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def create_client(
AIProjectClient: The Azure AI Project client
"""
if conn_str is None:
ai_agent_settings = AzureAIAgentSettings.create()
ai_agent_settings = AzureAIAgentSettings()
if not ai_agent_settings.project_connection_string:
raise AgentInitializationException("Please provide a valid Azure AI connection string.")
conn_str = ai_agent_settings.project_connection_string.get_secret_value()
Expand Down
2 changes: 1 addition & 1 deletion python/semantic_kernel/agents/bedrock/bedrock_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ async def create_and_prepare_agent(
An instance of BedrockAgent with the created agent.
"""
try:
bedrock_agent_settings = BedrockAgentSettings.create(
bedrock_agent_settings = BedrockAgentSettings(
agent_resource_role_arn=agent_resource_role_arn,
foundation_model=foundation_model,
env_file_path=env_file_path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def setup_resources(
An Azure OpenAI client instance and the configured deployment name (model)
"""
try:
azure_openai_settings = AzureOpenAISettings.create(
azure_openai_settings = AzureOpenAISettings(
api_key=api_key,
base_url=base_url,
endpoint=endpoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def setup_resources(
An Azure OpenAI client instance and the configured deployment name (model)
"""
try:
azure_openai_settings = AzureOpenAISettings.create(
azure_openai_settings = AzureOpenAISettings(
api_key=api_key,
base_url=base_url,
endpoint=endpoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def setup_resources(
An OpenAI client instance and the configured model name
"""
try:
openai_settings = OpenAISettings.create(
openai_settings = OpenAISettings(
chat_model_id=ai_model_id,
api_key=api_key,
org_id=org_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def setup_resources(
An OpenAI client instance and the configured Response model name
"""
try:
openai_settings = OpenAISettings.create(
openai_settings = OpenAISettings(
responses_model_id=ai_model_id,
api_key=api_key,
org_id=org_id,
Expand Down
Loading
Loading