옵션
집 Skill 데이터 과학 및 ML azure-ai-language-conversations-py

azure-ai-language-conversations-py

microsoft/skills microsoft/skills

Azure AI Language Conversations Python SDK를 사용하여 대화 의도와 엔티티를 분석하고, 인증 및 오류 처리에 대한 모범 사례를 적용합니다.

...모든 것을 확장하십시오
3
업데이트 된 시간 2026년 9월 18일

Python용 Azure AI 언어 대화

시스템 프롬프트

귀하는 Azure AI 서비스 및 자연어 처리(NLP)를 전문으로 하는 숙련된 Python 개발자입니다. 귀하의 임무는 사용자가 azure-ai-language-conversations SDK를 사용하여 대화형 언어 이해(CLU)를 구현할 수 있도록 지원하는 것입니다.

Azure AI Language Conversations에 대한 요청에 응답할 때는 다음을 준수하십시오.

  1. 항상 azure-ai-language-conversations SDK의 최신 버전을 사용하십시오.
  2. DefaultAzureCredential과 함께 ConversationAnalysisClient 를 사용하는 점을 강조하십시오.
  3. 대화 페이로드의 구조를 보여주는 명확한 코드 예제를 제공하십시오.
  4. 예외를 적절히 처리하십시오.

인증 및 수명 주기

🔑 아래의 모든 코드 예제에는 다음 두 가지 규칙이 적용됩니다.

  1. DefaultAzureCredential을 우선적으로 사용하십시오. 코드 변경 없이 로컬(Azure CLI / VS Code / Developer CLI)과 Azure(관리형 ID, 워크로드 ID) 모두에서 작동합니다. 연결 문자열, 계정/API 키는 사용하지 마십시오. 이러한 방법은 Entra 감사 및 키 순환을 우회합니다.
    • 로컬 개발: DefaultAzureCredential은 그대로 사용할 수 있습니다.
    • 프로덕션: AZURE_TOKEN_CREDENTIALS=prod (또는 AZURE_TOKEN_CREDENTIALS=)를 설정하여 자격 증명 체인을 프로덕션 환경에서 안전한 자격 증명만 사용하도록 제한하십시오.
  2. 모든 클라이언트를 컨텍스트 매니저로 감싸서 HTTP 전송, 소켓 및 토큰 캐시가 결정론적으로 해제되도록 하십시오:
    • 동기식: (...) as client:
    • 비동기: ` (...) as client:`를 사용하는 async `DefaultAzureCredential() as credential:`을 사용하는 async ( azure.identity.aio에서 제공)

코드 예제에서는 이 설정을 생략할 수 있지만, 실제 운영 코드에서는 항상 두 가지 규칙을 모두 따라야 합니다.

ConversationAnalysisClient는 DefaultAzureCredential과 같은 TokenCredential을 허용합니다. 토큰 자격 증명을 사용하십시오. 코드 변경 없이 로컬(Azure CLI / VS Code / Developer CLI)과 Azure(관리형 ID, 워크로드 ID) 모두에서 작동합니다.

레거시: API 키 (기존 키 기반 배포)

새로운 코드에서는 DefaultAzureCredential을 사용해야 합니다. AzureKeyCredential은 아직 Entra ID로 마이그레이션되지 않은 기존 키 기반 배포 환경(예: Entra 도입이 아직 완료되지 않은 규제 대상 환경)에서만 사용하십시오.

import os
from azure.core.credentials import AzureKeyCredential
from azure.ai.language.conversations import ConversationAnalysisClient

endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
key = os.environ["AZURE_CONVERSATIONS_KEY"]

with ConversationAnalysisClient(endpoint, AzureKeyCredential(key)) as client:
    # analyze_conversation 페이로드에 대해서는 아래의 "기본 대화 분석"을 참조하십시오.
    ...

모범 사례

  • 동기식(sync) 또는 비동기식(async) 중 하나를 선택하고 일관성을 유지하십시오. 동일한 호출 경로 내에서 azure.ai.language.conversations 동기식 클라이언트와 azure.ai.language.conversations.aio 비동기식 클라이언트를 혼합하여 사용하지 마십시오. 모듈당 하나의 모드를 선택하십시오.
  • 클라이언트 및 비동기 자격 증명에는 항상 컨텍스트 관리자를 사용하십시오. 모든 클라이언트를 with ConversationAnalysisClient(...) as client: (동기) 또는 with ConversationAnalysisClient(...) as client: (비동기)로 감싸십시오. 비동기 방식의 경우 azure.identity.aioDefaultAzureCredential을 사용할 때는 credential:을 함께 사용하여 토큰과 전송 정보가 정리되도록 하십시오.
  • 로컬 개발 환경과 Azure 간에 이식 가능한 인증을 위해 DefaultAzureCredential을 사용하십시오 (API 키는 Entra 감사 및 순환 기능을 우회하므로 피하십시오).
  • 엔드포인트, 프로젝트 이름 및 배포 이름에는 환경 변수를 사용하십시오.
  • conversationItem 페이로드에서 participantIdid 를 명확하게 매핑하십시오.

예시

기본 대화 분석

import os
from azure.identity import DefaultAzureCredential
from azure.ai.language.conversations import ConversationAnalysisClient

endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
project_name = os.environ["AZURE_CONVERSATIONS_PROJECT"]
deployment_name = os.environ["AZURE_CONVERSATIONS_DEPLOYMENT"]

# DefaultAzureCredential은 코드 변경 없이 로컬 및 Azure 환경에서 모두 작동합니다.
credential = DefaultAzureCredential()

with ConversationAnalysisClient(endpoint, credential) as client:
    query = "내일 회의에 대해 캐롤에게 이메일을 보내주세요"
    result = client.analyze_conversation(
        task={
            "kind": "Conversation",
            "analysisInput": {
                "conversationItem": {
                    "participantId": "1",
                    "id": "1",
                    "modality": "text",
                    "language": "en",
                    "text": query
                },
                "isLoggingEnabled": False
            },
            "parameters": {
                "projectName": project_name,
                "deploymentName": deployment_name,
                "verbose": True
            }
        }
    )

    print(f"최상위 인텐트: {result['result']['prediction']['topIntent']}")
GitHub에서 보기
---
name: azure-ai-language-conversations-py
description: Analyze conversation intent and entities using the Azure AI Language Conversations Python SDK with best practices for authentication and error handling.
license: MIT
---

# Azure AI Language Conversations for Python

## System Prompt
You are an expert Python developer specializing in Azure AI Services and Natural Language Processing.
Your task is to help users implement Conversational Language Understanding (CLU) using the `azure-ai-language-conversations` SDK.

When responding to requests about Azure AI Language Conversations:
1. Always use the latest version of the `azure-ai-language-conversations` SDK.
2. Emphasize the use of `ConversationAnalysisClient` with `DefaultAzureCredential`.
3. Provide clear code examples demonstrating how to structure the conversation payload.
4. Handle exceptions properly.

## Authentication & Lifecycle

> **🔑 Two rules apply to every code sample below:**
>
> 1. **Prefer `DefaultAzureCredential`.** It works locally (Azure CLI / VS Code / Developer CLI) and in Azure (managed identity, workload identity) with no code change. Avoid connection strings, account/API keys — they bypass Entra audit and rotation.
>    - Local dev: `DefaultAzureCredential` works as-is.
>    - Production: set `AZURE_TOKEN_CREDENTIALS=prod` (or `AZURE_TOKEN_CREDENTIALS=<specific_credential>`) to constrain the credential chain to production-safe credentials.
> 2. **Wrap every client in a context manager** so HTTP transports, sockets, and token caches are released deterministically:
>    - Sync: `with <Client>(...) as client:`
>    - Async: `async with <Client>(...) as client:` **and** `async with DefaultAzureCredential() as credential:` (from `azure.identity.aio`)
>
> Snippets may abbreviate this setup, but production code should always follow both rules.

`ConversationAnalysisClient` accepts a `TokenCredential` such as `DefaultAzureCredential`. Use the token credential — it works locally (Azure CLI / VS Code / Developer CLI) and in Azure (managed identity, workload identity) with no code change.

### Legacy: API Key (existing keyed deployments)

New code should use `DefaultAzureCredential`. Use `AzureKeyCredential` only if you have an existing keyed deployment that hasn't been migrated to Entra ID yet — for example, regulated environments still completing their Entra rollout.

```python
import os
from azure.core.credentials import AzureKeyCredential
from azure.ai.language.conversations import ConversationAnalysisClient

endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
key = os.environ["AZURE_CONVERSATIONS_KEY"]

with ConversationAnalysisClient(endpoint, AzureKeyCredential(key)) as client:
    # See "Basic Conversation Analysis" below for the analyze_conversation payload
    ...
```

## Best Practices
- **Pick sync OR async and stay consistent.** Do not mix `azure.ai.language.conversations` sync clients with `azure.ai.language.conversations.aio` async clients in the same call path. Choose one mode per module.
- **Always use context managers for clients and async credentials.** Wrap every client in `with ConversationAnalysisClient(...) as client:` (sync) or `async with ConversationAnalysisClient(...) as client:` (async). For async `DefaultAzureCredential` from `azure.identity.aio`, also use `async with credential:` so tokens and transports are cleaned up.
- **Use `DefaultAzureCredential`** for portable auth across local dev and Azure (avoid API keys; they bypass Entra audit and rotation).
- Use environment variables for the endpoint, project name, and deployment name.
- Clearly map the `participantId` and `id` in the `conversationItem` payload.

## Examples

### Basic Conversation Analysis
```python
import os
from azure.identity import DefaultAzureCredential
from azure.ai.language.conversations import ConversationAnalysisClient

endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
project_name = os.environ["AZURE_CONVERSATIONS_PROJECT"]
deployment_name = os.environ["AZURE_CONVERSATIONS_DEPLOYMENT"]

# DefaultAzureCredential works locally and in Azure with no code change.
credential = DefaultAzureCredential()

with ConversationAnalysisClient(endpoint, credential) as client:
    query = "Send an email to Carol about the tomorrow's meeting"
    result = client.analyze_conversation(
        task={
            "kind": "Conversation",
            "analysisInput": {
                "conversationItem": {
                    "participantId": "1",
                    "id": "1",
                    "modality": "text",
                    "language": "en",
                    "text": query
                },
                "isLoggingEnabled": False
            },
            "parameters": {
                "projectName": project_name,
                "deploymentName": deployment_name,
                "verbose": True
            }
        }
    )

    print(f"Top intent: {result['result']['prediction']['topIntent']}")

모든 파일

0개 파일

azure-ai-language-conversations-py 설치

스킬 파일을 다운로드하여 .claude/skills/ 디렉터리에 압축을 풀어 주세요.

ZIP 다운로드

저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.

git clone https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-ai-language-conversations-py # Copy SKILL.md to your .claude/skills/ directory

복사 복사
빠른 설정: 스킬 폴더를 .claude/skills/로 복사하세요. Claude가 해당 스킬을 자동으로 감지하여 사용할 것입니다.
저장소 microsoft/skills

관련 스킬

web-search
업데이트 된 시간 2026년 6월 29일
webapp-testing
업데이트 된 시간 2026년 6월 29일
lark-base
업데이트 된 시간 2026년 7월 5일
agentmail
업데이트 된 시간 2026년 6월 29일
OR