068. Mistral AI 텍스트 완성 (Mistral AI text completion)
- 원문: English
- 위치: References/Advanced › Advanced inference topics › Inference parameters › Mistral AI models › Mistral AI text completion
한 줄 요약
Mistral 텍스트 완성 API는 prompt 하나에 [INST]...[/INST] 태그로 대화를 표현하고, max_tokens/stop/temperature/top_p/top_k로 생성을 제어합니다. 기본값과 최대값이 모델마다 다릅니다.
쉽게 말하면
사용자 말은 [INST]와 [/INST] 사이에, 모델 답은 그 밖에 씁니다. 문장 시작과 끝은 <s>, </s>로 표시합니다.
핵심 내용
지원 모델
Mistral 7B Instruct, Mixtral 8X7B Instruct, Mistral Large, Mistral Small (Apache 2.0 라이선스)
요청 본문
{
"prompt": string,
"max_tokens": int,
"stop": [string],
"temperature": float,
"top_p": float,
"top_k": int
}
프롬프트 예시 (멀티턴):
<s>[INST] What is your favourite condiment? [/INST]
Well, I'm quite partial to a good squeeze of fresh lemon juice.</s>
[INST] Do you have mayonnaise recipes? [/INST]
파라미터 기본값/범위
| 파라미터 | Mistral 7B | Mixtral 8X7B | Mistral Large | Mistral Small | 범위 |
|---|---|---|---|---|---|
max_tokens 기본 | 512 | 512 | 8,192 | 8,192 | 최소 1 |
max_tokens 최대 | 8,192 | 4,096 | 8,192 | 8,192 | |
temperature 기본 | 0.5 | 0.5 | 0.7 | 0.7 | 0~1 |
top_p 기본 | 0.9 | 0.9 | 1 | 1 | 0~1 |
top_k 기본 | 50 | 50 | 비활성 | 비활성 | 1~200 |
stop: 정지 시퀀스 리스트, 최대 10개(기본 0개).
응답 본문
{ "outputs": [ { "text": string, "stop_reason": string } ] }
stop_reason:stop(생성 완료 또는stop시퀀스 생성) /length(max_tokens초과로 잘림)
예제
- Python(boto3)
invoke_model로mistral.mistral-7b-instruct-v0:2를 호출하는 예제가 있습니다.
SA 관점
- Mixtral 8X7B만
max_tokens최대가 4,096으로 작으니 긴 출력 워크로드에서는 주의하세요. - 채팅·도구 호출이 필요하면 이 형식 대신 069 또는 Converse API를 쓰는 것이 낫습니다.