feat: if-rules
This commit is contained in:
parent
ccdc1b953e
commit
0a13a4604d
2 changed files with 8 additions and 2 deletions
|
|
@ -434,6 +434,7 @@ const getSystemMessage = ({
|
|||
userMessage?: UserChatMessage;
|
||||
rules: Rule[];
|
||||
}) => {
|
||||
debugger;
|
||||
return "Respond in Spanish";
|
||||
// if (systemMessage) {
|
||||
// return "";
|
||||
|
|
@ -464,6 +465,7 @@ function compileChatMessages({
|
|||
prompt,
|
||||
functions,
|
||||
systemMessage,
|
||||
rules,
|
||||
}: {
|
||||
modelName: string;
|
||||
msgs: ChatMessage[] | undefined;
|
||||
|
|
@ -473,6 +475,7 @@ function compileChatMessages({
|
|||
prompt: string | undefined;
|
||||
functions: any[] | undefined;
|
||||
systemMessage: string | undefined;
|
||||
rules: Rule[];
|
||||
}): ChatMessage[] {
|
||||
debugger;
|
||||
let msgsCopy = msgs
|
||||
|
|
@ -499,7 +502,7 @@ function compileChatMessages({
|
|||
systemMessage ??
|
||||
getSystemMessage({
|
||||
userMessage: lastUserMessage,
|
||||
rules: [],
|
||||
rules,
|
||||
}),
|
||||
originalMessages: msgs,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ModelRole } from "@continuedev/config-yaml";
|
||||
import { ModelRole, Rule } from "@continuedev/config-yaml";
|
||||
import { fetchwithRequestOptions } from "@continuedev/fetch";
|
||||
import { findLlmInfo } from "@continuedev/llm-info";
|
||||
import {
|
||||
|
|
@ -143,6 +143,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
cacheBehavior?: CacheBehavior;
|
||||
capabilities?: ModelCapability;
|
||||
roles?: ModelRole[];
|
||||
rules?: Rule[];
|
||||
|
||||
deployment?: string;
|
||||
apiVersion?: string;
|
||||
|
|
@ -244,6 +245,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
this.accountId = options.accountId;
|
||||
this.capabilities = options.capabilities;
|
||||
this.roles = options.roles;
|
||||
this.rules = options.rules;
|
||||
|
||||
this.deployment = options.deployment;
|
||||
this.apiVersion = options.apiVersion;
|
||||
|
|
@ -297,6 +299,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
prompt: undefined,
|
||||
functions,
|
||||
systemMessage: this.systemMessage,
|
||||
rules: this.rules ?? [],
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue