dspy.BaseLM

dspy.BaseLM

이 페이지는 DSPy의 언어 모델 베이스 클래스인 BaseLM을 다뤄요. 모든 LM(언어 모델) 래퍼가 상속하는 인터페이스로, forward(호출 실행), 히스토리 기록(update_history), 상태 저장/복원(dump_state/load_state), 작업 복사(copy) 같은 공통 계약을 정의해요. 커스텀 LM을 DSPy에 연결하려면 이 인터페이스를 따라 구현하면 돼요.

출처: 문서

본문

BaseLM은 DSPy가 LM을 다루는 공통 인터페이스예요. 구체적인 LM 클래스는 이 인터페이스를 구현해서 각 공급자(OpenAI, Anthropic 등)의 호출 방식에 맞춰요. 아래는 이 클래스가 노출하는 멤버 목록이에요.

::: dspy.BaseLM
    handler: python
    options:
        members:
            - __call__
            - acall
            - aforward
            - copy
            - dump_state
            - forward
            - inspect_history
            - load_state
            - update_history
        show_source: true
        show_root_heading: true
        heading_level: 2
        docstring_style: google
        show_root_full_path: true
        show_object_full_path: false
        separate_signature: false
        inherited_members: true

더 알아보기 (Learn more)