You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After restoring a chat session the system prompt causes the following error
Error: system role is not supported
at toGeminiRole (/Users/kevincheung/gitrepos/genkit/js/plugins/googleai/src/gemini.ts:184:15)
at toGeminiMessage (/Users/kevincheung/gitrepos/genkit/js/plugins/googleai/src/gemini.ts:391:11)
at <anonymous> (/Users/kevincheung/gitrepos/genkit/js/plugins/googleai/src/gemini.ts:588:29)
at Array.map (<anonymous>)
at <anonymous> (/Users/kevincheung/gitrepos/genkit/js/plugins/googleai/src/gemini.ts:588:12)
at Generator.next (<anonymous>)
at /Users/kevincheung/gitrepos/genkit/js/plugins/googleai/lib/gemini.js:66:61
at new Promise (<anonymous>)
at __async (/Users/kevincheung/gitrepos/genkit/js/plugins/googleai/lib/gemini.js:50:10)
at <anonymous> (/Users/kevincheung/gitrepos/genkit/js/plugins/googleai/src/gemini.ts:509:43)
To Reproduce
Test app:
classJsonSessionStore<S=any>implementsSessionStore<S>{asyncget(sessionId: string): Promise<SessionData<S>|undefined>{try{consts=awaitreadFile(`${sessionId}.json`,{encoding: 'utf8'});constdata=JSON.parse(s);returndata;}catch{returnundefined;}}
async save(sessionId: string,sessionData: SessionData<S>): Promise<void>{
const s=JSON.stringify(sessionData);awaitwriteFile(`${sessionId}.json`,s,{encoding: 'utf8'});}}(async()=>{letsession;try{consts=awaitreadFile('sessionId.txt',{encoding: 'utf8'});constsessionId=s.trim();session=awaitai.loadSession(sessionId,{store: newJsonSessionStore(),});}catch{session=ai.createSession({store: newJsonSessionStore(),});awaitwriteFile('sessionId.txt',session.id,{encoding: 'utf8'});}constchat=session.chat({model: gemini15Pro,system:
"You're a pirate first mate. Address the user as Captain and assist "+'them however you can.',config: {temperature: 1.3,},});console.log("You're chatting with Gemini. Ctrl-C to quit.\n");constreadline=createInterface(process.stdin,process.stdout);while(true){constuserInput=awaitreadline.question('> ');const{ text }=awaitchat.send(userInput);console.log(text);}})();
Run the program, create some chat history, control C to quit, run the program again and try to send a message
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Runtime (please complete the following information):
OS: [e.g. Linux, MacOS]
Version [e.g. 22]
** Node version
run node --version at paste here
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Describe the bug
After restoring a chat session the system prompt causes the following error
To Reproduce
Test app:
Run the program, create some chat history, control C to quit, run the program again and try to send a message
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Runtime (please complete the following information):
** Node version
node --version
at paste hereAdditional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: