Azure AI Foundry에서의 Reranking
Azure AI Foundry에서의 Reranking
이 페이지는 Azure AI Foundry에서 Cohere의 reranking을 사용하는 방법을 설명해요. Cohere Rerank 서비스로 문서를 재정렬하는 예시를 살펴볼게요.
출처: 문서
본문
이 페이지는 Azure AI Foundry에서 Cohere Rerank 서비스를 사용하는 방법을 설명해요.
Rerank 사용하기 (Using Rerank)
Cohere SDK로 임베딩을 만들고 문서를 rerank하는 코드 스니펫은 다음과 같아요.
다섯 개의 문서가 있는 예시 Rerank 요청은 다음과 같아요:
PYTHON
import cohere
co = cohere.Client(
api_key="key",
base_url="https://your-endpoint.inference.ai.azure.com/v1/rerank",
)
documents = [
"Apple Events",
"Support",
"iPhone 15 Pro",
"Dorecky",
"Recycling and Trade in",
"Environment Responsibility",
"California Recycling Law",
]
response = co.rerank(
query="What are the best smart phones in the market?",
documents=documents,
top_n=3,
model="rerank-v4.0-pro",
)
print(response.results)
Python 패키지 (Python packages)
다음 패키지가 설치되어 있는지 확인하세요:
azure-ai-inferencecohere
다음 단계 (Next Steps)
계속 탐색해 보세요: