디렉터리 구조

디렉터리 구조 (Directory Structure)

새 공급자(provider)를 추가할 때는 저장소에서 일정한 디렉터리 구조를 따라야 해요. 엔드포인트의 유형에 맞춰 handler.pytransformation.py를 배치하면, LiteLLM이 각 공급자를 일관된 방식으로 처리할 수 있답니다.

출처: 문서

본문

새 공급자를 추가할 때는 다음 구조를 따르는 공급자용 디렉터리를 만들어야 합니다:

litellm/llms/
└── provider_name/
    ├── completion/ # use when endpoint is equivalent to openai's `/v1/completions`
    │   ├── handler.py
    │   └── transformation.py
    ├── chat/ # use when endpoint is equivalent to openai's `/v1/chat/completions`
    │   ├── handler.py
    │   └── transformation.py
    ├── embed/ # use when endpoint is equivalent to openai's `/v1/embeddings`
    │   ├── handler.py
    │   └── transformation.py
    ├── audio_transcription/ # use when endpoint is equivalent to openai's `/v1/audio/transcriptions`
    │   ├── handler.py
    │   └── transformation.py
    └── rerank/ # use when endpoint is equivalent to cohere's `/rerank` endpoint.
        ├── handler.py
        └── transformation.py
  • completion/: 엔드포인트가 OpenAI의 /v1/completions와 동등할 때 사용해요.
  • chat/: 엔드포인트가 OpenAI의 /v1/chat/completions와 동등할 때 사용해요.
  • embed/: 엔드포인트가 OpenAI의 /v1/embeddings와 동등할 때 사용해요.
  • audio_transcription/: 엔드포인트가 OpenAI의 /v1/audio/transcriptions와 동등할 때 사용해요.
  • rerank/: 엔드포인트가 Cohere의 /rerank와 동등할 때 사용해요.

각 디렉터리에는 요청을 처리하는 handler.py와 요청/응답을 변환하는 transformation.py가 들어가요.

더 알아보기 (Learn more)