생성 모델 API의 클래스입니다.
서명:
export declare class GenerativeModel
생성자
생성자 | 특수키 | 설명 |
---|---|---|
(생성자)(vertexAI, modelParams, requestOptions) | GenerativeModel 클래스의 새 인스턴스를 구성합니다. |
속성
속성 | 특수키 | 유형 | 설명 |
---|---|---|---|
generationConfig | 생성형 구성 | ||
model | 문자열 | ||
요청 옵션 | RequestOptions에 추가되었습니다. | ||
safetySettings | 안전 설정[] | ||
system 안내 | Content | ||
도구 구성 | 도구 구성 | ||
도구 | 도구[] |
방법
방법 | 특수키 | 설명 |
---|---|---|
countTokens(요청) | 제공된 요청의 토큰을 계산합니다. | |
generateContent(request) | 모델에 비 스트리밍 단일 호출을 실행하고 단일 GenerateContentResponse가 포함된 객체를 반환합니다. | |
generateContentStream(request) | 모델에 단일 스트리밍 호출을 수행하고, 스트리밍 응답의 모든 청크를 반복하는 반복 가능한 스트림과 집계된 최종 응답을 반환하는 프로미스를 포함하는 객체를 반환합니다. | |
startChat(startChatParams) | 멀티턴 채팅에 사용할 수 있는 새로운 ChatSession 인스턴스를 가져옵니다. |
GenerativeModel.(생성자)
GenerativeModel
클래스의 새 인스턴스를 구성합니다.
서명:
constructor(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions);
매개변수
매개변수 | 유형 | 설명 |
---|---|---|
Vertex AI | VertexAI | |
modelParams | ModelParams | |
requestOptions | RequestOptions에 추가되었습니다. |
생성형 모델.생성 구성
서명:
generationConfig: GenerationConfig;
생성 모델.모델
서명:
model: string;
GenerativeModel.requestOptions
서명:
requestOptions?: RequestOptions;
GenerativeModel.safetySettings
서명:
safetySettings: SafetySetting[];
생성 모델.시스템 안내
서명:
systemInstruction?: Content;
생성형 모델.도구 구성
서명:
toolConfig?: ToolConfig;
GenerativeModel.tools
서명:
tools?: Tool[];
GenerativeModel.countTokens()
제공된 요청의 토큰을 계산합니다.
서명:
countTokens(request: CountTokensRequest | string | Array<string | Part>): Promise<CountTokensResponse>;
매개변수
매개변수 | 유형 | 설명 |
---|---|---|
요청 | CountTokensRequest | string | 배열<string | Part> |
반환:
프로미스<CountTokensResponse>
GenerativeModel.generateContent()
모델에 비 스트리밍 단일 호출을 실행하고 단일 GenerateContentResponse가 포함된 객체를 반환합니다.
서명:
generateContent(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentResult>;
매개변수
매개변수 | 유형 | 설명 |
---|---|---|
요청 | GenerateContentRequest | string | Array<string | Part> |
반환:
프로미스<GenerateContentResult>
GenerativeModel.generateContentStream()
모델에 단일 스트리밍 호출을 수행하고, 스트리밍 응답의 모든 청크를 반복하는 반복 가능한 스트림과 집계된 최종 응답을 반환하는 프로미스를 포함하는 객체를 반환합니다.
서명:
generateContentStream(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentStreamResult>;
매개변수
매개변수 | 유형 | 설명 |
---|---|---|
요청 | GenerateContentRequest | string | Array<string | Part> |
반환:
프로미스<GenerateContentStreamResult>
GenerativeModel.startChat()
멀티턴 채팅에 사용할 수 있는 새로운 ChatSession 인스턴스를 가져옵니다.
서명:
startChat(startChatParams?: StartChatParams): ChatSession;
매개변수
매개변수 | 유형 | 설명 |
---|---|---|
startChatParams | StartChatParams |
반환: