
/ 목차 /
- POST /api/generate
- POST /api/chat
POST /api/generate
매개 변수 model: (필수) 모델명 prompt: 에 대한 응답을 생성하라는 프롬프트 images: (선택 사항) base64로 인코딩된 이미지 목록(다음과 같은 다중 모드 모델의 경우) llava) 고급 매개 변수(선택 사항): format: 응답을 반환할 형식입니다. 현재 유일하게 허용되는 값은 json options: Modelfile에 대한 설명서에 나열된 추가 모델 매개변수(예: temperature system: 시스템 메시지를 (에 정의된 내용을 재정의합니다. Modelfile) template: 사용할 프롬프트 템플릿(에 정의된 내용을 재정의합니다. Modelfile) context: 이전 요청에서 반환된 컨텍스트 매개 변수로, 짧은 대화 메모리를 유지하는 데 사용할 수 있습니다./generate stream: 응답이 객체 스트림이 아닌 단일 응답 객체로 반환되는 경우false raw: 프롬프트에 서식이 적용되지 않는 경우입니다. API에 대한 요청에서 전체 템플릿 프롬프트를 지정하는 경우 매개 변수를 사용하도록 선택할 수 있습니다trueraw keep_alive: 요청 후 모델이 메모리에 로드된 상태로 유지되는 시간을 제어합니다(기본값: 5m) 요청command curl http://localhost:11434/api/generate -d '{ "model": "llama3", "prompt": "Why is the sky blue?" }'
응답{ "model": "llama3", "created_at": "2023-08-04T08:52:19.385406455-07:00", "response": "The", "done": false }
하나의 문장으로 응답 처리 - "stream": false
command curl http://localhost:11434/api/generate -d '{ "model": "llama3", "prompt": "Why is the sky blue?", "stream": false }'
응답{ "model": "llama3", "created_at": "2023-08-04T19:22:45.499127Z", "response": "The sky is blue because it is the color of the sky.", "done": true, "context": [1, 2, 3], "total_duration": 5043500667, "load_duration": 5025959, "prompt_eval_count": 26, "prompt_eval_duration": 325953000, "eval_count": 290, "eval_duration": 4709213000 }
![]()
POST /api/chat
매개 변수 model: (필수) 모델명 messages: 채팅 메시지, 채팅 메모리를 유지하는 데 사용할 수 있습니다. 개체에는 다음과 같은 필드가 있습니다.message role: 메시지의 역할( 또는 systemuserassistant content: 메시지의 내용 images (선택 사항): 메시지에 포함할 이미지 목록( llava) 고급 매개 변수(선택 사항): format: 응답을 반환할 형식입니다. 현재 유일하게 허용되는 값은 json options: Modelfile에 대한 설명서에 나열된 추가 모델 매개변수(예: temperature stream: 응답이 객체 스트림이 아닌 단일 응답 객체로 반환되는 경우false keep_alive: 요청 후 모델이 메모리에 로드된 상태로 유지되는 시간을 제어합니다(기본값: 5m) 요청command curl http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ { "role": "user", "content": "why is the sky blue?" } ] }'
응답{ "model": "llama3", "created_at": "2023-08-04T08:52:19.385406455-07:00", "message": { "role": "assistant", "content": "The", "images": null }, "done": false }
하나의 문장으로 응답 처리 - "stream": false 요청
command curl http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ { "role": "user", "content": "why is the sky blue?" } ], "stream": false }'
응답{ "model": "llama3", "created_at": "2023-12-12T14:13:43.416799Z", "message": { "role": "assistant", "content": "Hello! How are you today?" }, "done": true, "total_duration": 5191566416, "load_duration": 2154458, "prompt_eval_count": 26, "prompt_eval_duration": 383809000, "eval_count": 298, "eval_duration": 4799921000 }
![]()
Comment