Dr Nic Williams e8aaea030e Update 'llama2' -> 'llama3' in most places (#4116) | 8 months ago | |
---|---|---|
.. | ||
.gitignore | 1 year ago | |
README.md | 8 months ago | |
character-generator.ts | 8 months ago | |
mentors.ts | 1 year ago | |
package.json | 1 year ago |
This example demonstrates how one would create a set of 'mentors' you can have a conversation with. The mentors are generated using the character-generator.ts
file. This will use Stable Beluga 70b to create a bio and list of verbal ticks and common phrases used by each person. Then mentors.ts
will take a question, and choose three of the 'mentors' and start a conversation with them. Occasionally, they will talk to each other, and other times they will just deliver a set of monologues. It's fun to see what they do and say.
ollama pull llama3
npm install
npm start "what is a jackalope"
You can also add your own character to be chosen at random when you ask a question.
ollama pull stablebeluga2:70b-q4_K_M
npm run charactergen "Lorne Greene"
You can choose any well-known person you like. This example will create lornegreene/Modelfile
.
ollama create <username>/lornegreene -f lornegreene/Modelfile
username
is whatever name you set up when you signed up at https://ollama.com/signup.
mentors.ts
, add an object to the array, replacing <username>
with the username you used above. {ns: "<username>", char: "Lorne Greene"}
There are two scripts you can run in this example. The first is the main script to ask the mentors a question. The other one lets you generate a character to add to the mentors. Both scripts are mostly about adjusting the prompts at each inference stage.
In the main function, it starts by generating a list of mentors. This chooses 3 from a list of interesting characters. Then we ask for a question, and then things get interesting. We set the prompt for each of the 3 mentors a little differently. And the 2nd and 3rd mentors see what the previous folks said. The other functions in mentors sets the prompts for each mentor.
Character Generator simply customizes the prompt to build a character profile for any famous person. And most of the script is just tweaking the prompt. This uses Stable Beluga 2 70b parameters. The 70b models tend to do better writing a bio about a character than smaller models, and Stable Beluga seemed to do better than Llama 2. Since this is used at development time for the characters, it doesn't affect the runtime of asking the mentors for their input.