[goose-llm] system prompt override (#2791)
This commit is contained in:
@@ -130,8 +130,8 @@ fun main() = runBlocking {
|
||||
providerConfig,
|
||||
modelConfig,
|
||||
systemPreamble,
|
||||
msgs,
|
||||
extensions
|
||||
messages = msgs,
|
||||
extensions = extensions
|
||||
)
|
||||
|
||||
val response = completion(req)
|
||||
@@ -140,6 +140,32 @@ fun main() = runBlocking {
|
||||
|
||||
// ---- UI Extraction (custom schema) ----
|
||||
runUiExtraction(providerName, providerConfig)
|
||||
|
||||
|
||||
// --- Prompt Override ---
|
||||
val prompt_req = createCompletionRequest(
|
||||
providerName,
|
||||
providerConfig,
|
||||
modelConfig,
|
||||
systemPreamble = null,
|
||||
systemPromptOverride = "You are a bot named Tile Creator. Your task is to create a tile based on the user's input.",
|
||||
messages=listOf(
|
||||
Message(
|
||||
role = Role.USER,
|
||||
created = now,
|
||||
content = listOf(
|
||||
MessageContent.Text(
|
||||
TextContent("What's your name?")
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
extensions=emptyList()
|
||||
)
|
||||
|
||||
val prompt_resp = completion(prompt_req)
|
||||
|
||||
println("\nPrompt Override Response:\n${prompt_resp.message}")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -830,6 +830,7 @@ internal interface UniffiLib : Library {
|
||||
`providerConfig`: RustBuffer.ByValue,
|
||||
`modelConfig`: RustBuffer.ByValue,
|
||||
`systemPreamble`: RustBuffer.ByValue,
|
||||
`systemPromptOverride`: RustBuffer.ByValue,
|
||||
`messages`: RustBuffer.ByValue,
|
||||
`extensions`: RustBuffer.ByValue,
|
||||
uniffi_out_err: UniffiRustCallStatus,
|
||||
@@ -1100,7 +1101,7 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
|
||||
if (lib.uniffi_goose_llm_checksum_func_completion() != 47457.toShort()) {
|
||||
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
||||
}
|
||||
if (lib.uniffi_goose_llm_checksum_func_create_completion_request() != 39068.toShort()) {
|
||||
if (lib.uniffi_goose_llm_checksum_func_create_completion_request() != 50798.toShort()) {
|
||||
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
||||
}
|
||||
if (lib.uniffi_goose_llm_checksum_func_create_tool_config() != 49910.toShort()) {
|
||||
@@ -2955,7 +2956,8 @@ fun `createCompletionRequest`(
|
||||
`providerName`: kotlin.String,
|
||||
`providerConfig`: Value,
|
||||
`modelConfig`: ModelConfig,
|
||||
`systemPreamble`: kotlin.String,
|
||||
`systemPreamble`: kotlin.String? = null,
|
||||
`systemPromptOverride`: kotlin.String? = null,
|
||||
`messages`: List<Message>,
|
||||
`extensions`: List<ExtensionConfig>,
|
||||
): CompletionRequest =
|
||||
@@ -2965,7 +2967,8 @@ fun `createCompletionRequest`(
|
||||
FfiConverterString.lower(`providerName`),
|
||||
FfiConverterTypeValue.lower(`providerConfig`),
|
||||
FfiConverterTypeModelConfig.lower(`modelConfig`),
|
||||
FfiConverterString.lower(`systemPreamble`),
|
||||
FfiConverterOptionalString.lower(`systemPreamble`),
|
||||
FfiConverterOptionalString.lower(`systemPromptOverride`),
|
||||
FfiConverterSequenceTypeMessage.lower(`messages`),
|
||||
FfiConverterSequenceTypeExtensionConfig.lower(`extensions`),
|
||||
_status,
|
||||
|
||||
Reference in New Issue
Block a user