dspy.XMLAdapter
dspy.XMLAdapter
이 페이지는 DSPy의 XMLAdapter를 다뤄요. 시그니처와 데모를 XML 태그로 감싼 형식으로 변환하고, LM의 XML 응답을 파싱해서 Prediction으로 만들어요. XML 구조는 각 필드의 경계가 명확해서, 복잡한 필드 조합을 다룰 때 유용해요.
출처: 문서
본문
XMLAdapter는 각 입력/출력 필드를 XML 요소로 표현하고, 어시스턴트의 답변을 XML로 요구한 뒤 파싱해 시그니처 필드에 채워 넣어요. XML이 주는 명시적 구조 덕분에 중첩된 리스트나 여러 필드가 나오는 출력에서 파싱이 단단해져요. 아래는 이 클래스가 노출하는 멤버 목록이에요.
::: dspy.XMLAdapter
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