dspy.Adapter

dspy.Adapter

이 페이지는 DSPy 어댑터의 베이스 클래스인 Adapter를 다뤄요. 어댑터는 시그니처와 데모, 대화 히스토리를 LM이 이해하는 메시지 형식으로 바꾸고(format), LM의 응답을 다시 Prediction으로 파싱(parse)하는 역할을 해요. ChatAdapter, JSONAdapter, XMLAdapter 같은 구체 어댑터들이 이 베이스의 형식화·파싱 규칙을 각자의 스타일로 구현해요.

출처: 문서

본문

Adapter는 DSPy에서 LM 요청을 "만들고" 응답을 "읽는" 두 축을 담당해요. format_* 메서드들이 프롬프트의 각 부분(시스템 메시지, 작업 설명, 데모, 필드 설명 등)을 어떻게 표현할지 결정하고, parse가 원시 LM 출력을 구조화된 결과로 되돌려요. 아래는 이 클래스가 노출하는 멤버 목록이에요.

::: dspy.Adapter
    handler: python
    options:
        members:
            - __call__
            - acall
            - format
            - format_assistant_message_content
            - format_conversation_history
            - format_demos
            - format_field_description
            - format_field_structure
            - format_system_message
            - format_task_description
            - format_user_message_content
            - parse
        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)