dspy.ChatAdapter

dspy.ChatAdapter

이 페이지는 DSPy의 기본 어댑터인 ChatAdapter를 다뤄요. 시그니처와 데모를 채팅 메시지(시스템/사용자/어시스턴트) 형식으로 변환하고, LM의 채팅 응답을 Prediction으로 파싱해요. 대화 히스토리와 다중 턴을 자연스럽게 다루기 때문에, 대부분의 채팅 기반 LM 작업에서 기본으로 쓰여요.

출처: 문서

본문

ChatAdapter는 시스템 메시지에 작업 설명과 데모를 담고, 각 필드를 사용자/어시스턴트 메시지로 표현한 뒤, 채팅 형식의 응답을 시그니처 필드에 맞게 파싱해요. 아래는 이 클래스가 노출하는 멤버 목록이에요.

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