/batchPredictionJobs
/batchPredictionJobs
LiteLLM은 passthrough 엔드포인트를 통해 Vertex AI 배치 예측 작업을 지원하여, proxy 서버를 통해 직접 배치 작업을 만들고 관리할 수 있게 해줍니다.
기능
- 배치 작업 생성: Vertex AI 모델을 사용한 배치 예측 작업 생성
- 비용 추적: 배치 연산에 대한 자동 비용 계산과 사용량 추적
- 상태 모니터링: 작업 상태 추적 및 결과 조회
- 모델 지원: 모든 지원 Vertex AI 모델(Gemini, Text Embedding)과 함께 동작
비용 추적 지원
| Feature | Supported | Notes | | Cost Tracking | ✅ | Automatic cost calculation for batch operations | | Usage Monitoring | ✅ | Track token usage and costs across batch jobs | | Logging | ✅ | Supported |
빠른 시작
- proxy 구성에서 모델을 설정하세요:
model_list:
- model_name: gemini-3.8-flash
litellm_params:
model: vertex_ai/gemini-3.8-flash
vertex_project: your-project-id
vertex_location: us-central1
vertex_credentials: path/to/service-account.json
- 배치 작업 생성:
curl -X POST "http://localhost:4000/v1/projects/your-project/locations/us-central1/batchPredictionJobs" \
-H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
-d '{
"displayName": "my-batch-job",
"model": "projects/your-project/locations/us-central1/publishers/google/models/gemini-3.8-flash",
"inputConfig": {
"gcsSource": {
"uris": ["gs://my-bucket/input.jsonl"]
},
"instancesFormat": "jsonl"
},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": "gs://my-bucket/output/"
},
"predictionsFormat": "jsonl"
}
}'
- 작업 상태 모니터링:
curl -X GET "http://localhost:4000/v1/projects/your-project/locations/us-central1/batchPredictionJobs/job-id" \
-H "Authorization: Bearer ***"
모델 구성
배치 작업용 모델을 구성할 때 다음 명명 규칙을 사용하세요:
model_name: 기본 모델 이름(예:gemini-3.8-flash)model: 전체 LiteLLM 식별자(예:vertex_ai/gemini-3.8-flash)
지원 모델
gemini-3.8-flash/vertex_ai/gemini-3.8-flashgemini-3.1-pro-preview/vertex_ai/gemini-3.1-pro-preview
고급 사용법
커스텀 파라미터가 있는 배치 작업
curl -X POST "http://localhost:4000/v1/projects/your-project/locations/us-central1/batchPredictionJobs" \
-H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
-d '{
"displayName": "advanced-batch-job",
"model": "projects/your-project/locations/us-central1/publishers/google/models/gemini-3.1-pro-preview",
"inputConfig": {
"gcsSource": {
"uris": ["gs://my-bucket/advanced-input.jsonl"]
},
"instancesFormat": "jsonl"
},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": "gs://my-bucket/advanced-output/"
},
"predictionsFormat": "jsonl"
},
"labels": {
"environment": "production",
"team": "ml-engineering"
}
}'
모든 배치 작업 나열
curl -X GET "http://localhost:4000/v1/projects/your-project/locations/us-central1/batchPredictionJobs" \
-H "Authorization: Bearer ***"
배치 작업 취소
curl -X POST "http://localhost:4000/v1/projects/your-project/locations/us-central1/batchPredictionJobs/job-id:cancel" \
-H "Authorization: Bearer ***"
비용 추적 세부 사항
LiteLLM은 Vertex AI 배치 연산의 비용을 추적합니다:
- 토큰 사용량: 각 배치 요청의 입력/출력 토큰 추적
- 비용 계산: 현재 Vertex AI 가격을 기반으로 자동 계산
- 사용량 집계: 배치 작업의 모든 요청에 걸쳐 비용 집계
- 실시간 모니터링: 배치 작업이 진행되는 동안 비용 모니터링
비용 추적은 generateContent API와 함께 동작하며 배치 처리 비용을 상세히 보고합니다.
오류 처리
흔한 오류 시나리오와 해결책:
| Error | Description | Solution |
| INVALID_ARGUMENT | Invalid model or configuration | Verify model name and project settings |
| PERMISSION_DENIED | Insufficient permissions | Check Vertex AI IAM roles |
| RESOURCE_EXHAUSTED | Quota exceeded | Check Vertex AI quotas and limits |
| NOT_FOUND | Job or resource not found | Verify job ID and project configuration |
모범 사례
- 적절한 배치 크기 사용: 처리 효율과 리소스 사용 사이의 균형 유지
- 작업 상태 모니터링: 실패를 신속히 처리하기 위해 정기적으로 작업 상태 확인
- 알림 설정: 작업 완료와 실패에 대한 모니터링 구성
- 비용 최적화: 비용 추적으로 최적화 기회 식별
- 소규모 배치로 테스트: 먼저 소규모 테스트 배치로 설정 검증
관련 문서
- Vertex AI Provider Documentation
- General Batches API Documentation
- Cost Tracking and Monitoring