Streaming 은 키워드 하나
client.chat_completion(..., stream=True) 가 ChatCompletionStreamOutput 객체 yield 하는 generator 돌려줌. 각 chunk 가 .choices[0].delta.content. 모양이 OpenAI streaming 포맷 mirror — OpenAI stream 핸들하는 같은 UI 코드가 HF 도 핸들.
Tool calling
tools=[{...}] 를 JSON-schema-shaped dict 로 넘기기. 모델이 assistant 메시지에 tool_calls 로 응답. 로컬에서 실행, 결과를 {"role": "tool", ...} 메시지로 append, loop. 계약이 OpenAI 호환: 같은 dict 모양.
Structured output
JSON 모드엔 세 접근: (1) 프롬프트 + 검증, (2) 프로바이더 지원하면 response_format={"type": "json_object"}, (3) outlines 또는 instructor 같은 Pydantic-driven 라이브러리. 접근 3 이 프로바이더 간 가장 reliable.