GenerativeModel


class GenerativeModel : AutoCloseable


지정된 시스템 모델의 진행자입니다.

요약

공개 생성자

GenerativeModel(
    generationConfig: GenerationConfig,
    downloadConfig: DownloadConfig
)

공개 함수

open Unit

클라이언트를 닫고 리소스를 해제합니다.

suspend GenerateContentResponse
generateContent(vararg prompt: Content)

제공된 Content를 사용하여 시스템 모델에서 응답을 생성합니다.

suspend GenerateContentResponse

제공된 텍스트를 Content로 나타내 시스템 모델에서 응답을 생성합니다.

Flow<GenerateContentResponse>
generateContentStream(vararg prompt: Content)

제공된 Content를 사용하여 시스템 모델에서 스트리밍 응답을 생성합니다.

Flow<GenerateContentResponse>

제공된 텍스트(Content로 표시됨)를 사용하여 시스템 모델에서 스트리밍 응답을 생성합니다.

suspend <Error class: unknown class>

추론에서 타이밍 오버헤드를 제거하기 위해 엔진을 미리 준비합니다.

공개 속성

DownloadConfig

시스템 모델 다운로드 구성

GenerationConfig

콘텐츠 생성에 사용할 구성 매개변수

공개 생성자

GenerativeModel

GenerativeModel(
    generationConfig: GenerationConfig,
    downloadConfig: DownloadConfig = DownloadConfig()
)

공개 함수

닫기

open fun close(): Unit

클라이언트를 닫고 리소스를 해제합니다.

generateContent

suspend fun generateContent(vararg prompt: Content): GenerateContentResponse

제공된 Content를 사용하여 시스템 모델에서 응답을 생성합니다.

매개변수
vararg prompt: Content

모델에 전송할 Content 그룹입니다.

반환 값
GenerateContentResponse

지연 후 GenerateContentResponse 동시 실행을 적절하게 관리하려면 함수를 정지 컨텍스트 내에서 호출해야 합니다.

generateContent

suspend fun generateContent(prompt: String): GenerateContentResponse

제공된 텍스트를 Content로 나타내 시스템 모델에서 응답을 생성합니다.

매개변수
prompt: String

모델에 전송할 단일 Content로 변환할 텍스트입니다.

반환 값
GenerateContentResponse

지연 후 GenerateContentResponse 동시 실행을 올바르게 관리하려면 함수를 정지 컨텍스트 내에서 호출해야 합니다.

generateContentStream

fun generateContentStream(vararg prompt: Content): Flow<GenerateContentResponse>

제공된 Content를 사용하여 시스템 모델에서 스트리밍 응답을 생성합니다.

매개변수
vararg prompt: Content

모델에 전송할 Content 그룹입니다.

반환 값
Flow<GenerateContentResponse>

모델에서 반환될 때 응답을 내보내는 Flow입니다.

generateContentStream

fun generateContentStream(prompt: String): Flow<GenerateContentResponse>

제공된 텍스트(Content로 표시됨)를 사용하여 시스템 모델에서 스트리밍 응답을 생성합니다.

매개변수
prompt: String

모델에 전송할 단일 Content로 변환할 텍스트입니다.

반환 값
Flow<GenerateContentResponse>

모델에서 반환될 때 응답을 내보내는 Flow입니다.

prepareInferenceEngine

suspend fun prepareInferenceEngine(): <Error class: unknown class>

추론에서 타이밍 오버헤드를 제거하기 위해 엔진을 미리 준비합니다. 이 메서드를 호출하는 것은 선택사항이지만 첫 번째 추론의 지연 시간을 최소화하려면 첫 번째 추론 호출 전에 호출하는 것이 좋습니다.

공개 속성

downloadConfig

val downloadConfigDownloadConfig

시스템 모델 다운로드 구성

generationConfig

val generationConfigGenerationConfig

콘텐츠 생성에 사용할 구성 매개변수