{"record":{"id":"4c97e25da7d76cd0","repo":"microsoft/semantic-kernel","slug":"unsupported-service-name-service-name-4c97e2","errorCode":null,"errorMessage":"Unsupported service name: {service_name}","messagePattern":"Unsupported service name: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/samples/concepts/setup/text_embedding_services.py","lineNumber":53,"sourceCode":"    Returns:\n        Tuple[EmbeddingGeneratorBase, PromptExecutionSettings]: The embedding service and request settings.\n    \"\"\"\n    # Use lambdas to delay instantiation of the services until needed.\n    embedding_services = {\n        Services.OPENAI: lambda: get_openai_text_embedding_service_and_request_settings(),\n        Services.AZURE_OPENAI: lambda: get_azure_openai_text_embedding_service_and_request_settings(),\n        Services.AZURE_AI_INFERENCE: lambda: get_azure_ai_inference_text_embedding_service_and_request_settings(),\n        Services.BEDROCK: lambda: get_bedrock_text_embedding_service_and_request_settings(),\n        Services.GOOGLE_AI: lambda: get_google_ai_text_embedding_service_and_request_settings(),\n        Services.HUGGING_FACE: lambda: get_hugging_face_text_embedding_service_and_request_settings(),\n        Services.MISTRAL_AI: lambda: get_mistral_ai_text_embedding_service_and_request_settings(),\n        Services.OLLAMA: lambda: get_ollama_text_embedding_service_and_request_settings(),\n        Services.VERTEX_AI: lambda: get_vertex_ai_text_embedding_service_and_request_settings(),\n    }\n\n    # Call the appropriate lambda or function based on the service name\n    if service_name not in embedding_services:\n        raise ValueError(f\"Unsupported service name: {service_name}\")\n    return embedding_services[service_name]()\n\n\ndef get_openai_text_embedding_service_and_request_settings() -> tuple[\n    \"EmbeddingGeneratorBase\", \"PromptExecutionSettings\"\n]:\n    \"\"\"Return OpenAI embedding service and request settings.\n\n    The service credentials can be read by 3 ways:\n    1. Via the constructor\n    2. Via the environment variables\n    3. Via an environment file\n\n    The request settings control the behavior of the service. The default settings are sufficient to get started.\n    However, you can adjust the settings to suit your needs.\n    Note: Some of the settings are NOT meant to be set by the user.\n    Please refer to the Semantic Kernel Python documentation for more information:\n    https://learn.microsoft.com/en-us/python/api/semantic-kernel/semantic_kernel?view=semantic-kernel-python","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/samples/concepts/setup/text_embedding_services.py#L35-L71","documentation":"A ValueError from the text-embedding setup dispatcher when service_name is not among its supported keys. The embedding dispatcher supports a different set than text completion: AZURE_OPENAI, AZURE_AI_INFERENCE, BEDROCK, GOOGLE_AI, HUGGING_FACE, MISTRAL_AI, OLLAMA, VERTEX_AI. Notably it omits OPENAI (base) and ONNX but adds the Azure variants and Mistral.","triggerScenarios":"Calling the embedding dispatcher with Services.OPENAI or Services.ONNX (not wired here), or any value outside the supported set.","commonSituations":"Assuming the embedding dispatcher supports the same services as the text-completion one; passing Services.OPENAI expecting base OpenAI embeddings when only AZURE_OPENAI is wired; typo in the enum value.","solutions":["Pass a supported Services member for embeddings: AZURE_OPENAI, AZURE_AI_INFERENCE, BEDROCK, GOOGLE_AI, HUGGING_FACE, MISTRAL_AI, OLLAMA, or VERTEX_AI.","If you need base OpenAI embeddings, add a get_openai_text_embedding_service_and_request_settings lambda to the dict.","Cross-check the requested enum member against the dict keys shown in the error's source region."],"exampleFix":"// before\nembedding_services(Services.OPENAI)\n\n// after\nembedding_services(Services.AZURE_OPENAI)","handlingStrategy":"validation","validationCode":"SUPPORTED_EMBED = {Services.AZURE_OPENAI, Services.AZURE_AI_INFERENCE, Services.BEDROCK, Services.GOOGLE_AI, Services.HUGGING_FACE, Services.MISTRAL_AI, Services.OLLAMA, Services.VERTEX_AI}\nassert service_name in SUPPORTED_EMBED, f\"{service_name} not supported for embeddings\"","typeGuard":"def is_supported_embedding_service(name) -> bool:\n    return name in {Services.AZURE_OPENAI, Services.AZURE_AI_INFERENCE, Services.BEDROCK, Services.GOOGLE_AI, Services.HUGGING_FACE, Services.MISTRAL_AI, Services.OLLAMA, Services.VERTEX_AI}","tryCatchPattern":"try:\n    svc, settings = text_embedding_services(service_name)\nexcept ValueError:\n    # notify that the embedding dispatcher supports a different set than text completion\n    ...","preventionTips":["Remember the embedding dispatcher set differs from text completion (adds Azure/Mistral, omits base OpenAI/ONNX).","Validate against the specific dict keys for the dispatcher you call."],"tags":["configuration","dispatch","validation","embeddings","semantic-kernel"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}