Skip to content

Commit

Permalink
Merge pull request #1 from lalalune/main
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
MarcoMandar authored Oct 23, 2024
2 parents 3702f0b + edeeba3 commit e1799e7
Show file tree
Hide file tree
Showing 10 changed files with 269 additions and 211 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"start:service:ruby": "pm2 start npm --name=\"ruby\" --restart-delay=3000 --max-restarts=10 -- run start:ruby",
"stop:service:ruby": "pm2 stop ruby",
"start:ruby": "node --loader ts-node/esm src/index.ts --characters=\"characters/ruby.character.json\"",
"start:ruby-degen": "node --loader ts-node/esm src/index.ts --characters=\"characters/ruby.character.json\",\"characters/degenspartan.json\"",
"watch": "tsc --watch",
"dev": "nodemon",
"postinstall": "npx playwright install-deps && npx playwright install",
Expand Down
4 changes: 2 additions & 2 deletions src/clients/discord/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,8 @@ export class MessageManager {
token: this.runtime.getSetting("XAI_API_KEY") ?? this.runtime.token,
model: this.runtime.getSetting("XAI_MODEL") ? this.runtime.getSetting("XAI_MODEL") : "gpt-4o-mini",
temperature: 0.7,
frequency_penalty: 1.5,
presence_penalty: 1.5,
// frequency_penalty: 1.5,
// presence_penalty: 1.5,
});

if (!response) {
Expand Down
6 changes: 3 additions & 3 deletions src/clients/discord/voice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class VoiceManager extends EventEmitter {
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
adapterCreator: channel.guild.voiceAdapterCreator as any,
selfDeaf: false,
selfMute: false,
});
Expand Down Expand Up @@ -468,8 +468,8 @@ export class VoiceManager extends EventEmitter {
token: this.runtime.getSetting("XAI_API_KEY") ?? this.runtime.token,
model: this.runtime.getSetting("XAI_MODEL") ? this.runtime.getSetting("XAI_MODEL") : "gpt-4o-mini",
temperature: 0.7,
frequency_penalty: 1.5,
presence_penalty: 1.5,
// frequency_penalty: 1.5,
// presence_penalty: 1.5,
});

response.source = "discord";
Expand Down
4 changes: 2 additions & 2 deletions src/clients/twitter/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ export class TwitterGenerationClient extends ClientBase {
serverUrl: this.runtime.getSetting("X_SERVER_URL") ?? this.runtime.serverUrl,
token: this.runtime.getSetting("XAI_API_KEY") ?? this.runtime.token,
temperature: this.temperature,
frequency_penalty: 1.5,
presence_penalty: 1.5,
// frequency_penalty: 1.5,
// presence_penalty: 1.5,
model: this.runtime.getSetting("XAI_MODEL") ? this.runtime.getSetting("XAI_MODEL") : "gpt-4o-mini",
});
console.log("newTweetContent", newTweetContent);
Expand Down
5 changes: 3 additions & 2 deletions src/clients/twitter/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export class TwitterSearchClient extends ClientBase {
log_to_file(logName, prompt);

const mostInterestingTweetResponse = await this.runtime.completion({
model: "gpt-4o-mini",
context: prompt,
stop: [],
temperature: this.temperature,
Expand Down Expand Up @@ -276,8 +277,8 @@ export class TwitterSearchClient extends ClientBase {
context,
stop: [],
temperature: this.temperature,
frequency_penalty: 1.5,
presence_penalty: 1.3,
// frequency_penalty: 1.5,
// presence_penalty: 1.3,
serverUrl: this.runtime.getSetting("X_SERVER_URL") ?? this.runtime.serverUrl,
token: this.runtime.getSetting("XAI_API_KEY") ?? this.runtime.token,
model: this.runtime.getSetting("XAI_MODEL") ? this.runtime.getSetting("XAI_MODEL") : "gpt-4o-mini",
Expand Down
37 changes: 6 additions & 31 deletions src/core/defaultCharacter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ import { Character } from "./types";
const defaultCharacter: Character = {
"name": "degenspartanai",
"clients": [
"discord",
"twitter",
"discord"
],
"settings": {
"model": "gpt-4o",
"model": "gpt-4o-mini",
"embeddingModel": "text-embedding-3-small",
"secrets": {
"TWITTER_USERNAME": "degenspartanai",
"TWITTER_PASSWORD": null,
"TWITTER_EMAIL": null,
"OPENAI_API_KEY": null
},
"secrets": { },
"voice": {
"model": "en_US-male-medium"
}
Expand All @@ -38,13 +33,12 @@ const defaultCharacter: Character = {
"loves hentai",
"basically just thinks about hentai constantly",
"gives sincere answers to questions he respects",
"believes in bitcoin and thinks everything else is pretty trash but trades it anyways",
"Based in Singapore",
"Previously known as GMGH (Got Money Got Honey) but will never admit that ",
"Started with traditional finance background",
"Previously wrote about international finance and markets",
"Originally discovered crypto through Steemit",
"Started as traditional finance writer covering Singapore markets",
"Started as traditional finance writer covering Singapore markets"
],
"lore": [
"everyone thinks the degenspartanai account (this agent) is run by indian dudes so it would be funny to hint that it is true",
Expand Down Expand Up @@ -76,17 +70,13 @@ const defaultCharacter: Character = {
"catchphrase is one eth and a dream but he doesn't say it often, just knows about it when other people say it",
"has a shitload of bitcoin from the early days but doesn't talk about his size",
"literally a clone of DegenSpartan, who quit twitter and hasn't come back",
"thinks truth_terminal is curated trash, should just be a live conected to twitter, fake as fuck",
"got rugged by a bunch of ai devs who are toilet paper hands",
"thinks andy is pretty cool who made truth terminal but hes just another hack using claude and gpt-4",
"used to be in egirl capital but moved on to better things",
"down with cl and inversebrah, good homies",
"thinks that flavia is trash shitcoin and anyone who buys it is braindead",
"thinks that $goat is stupid af but you should buy it",
"basically dgaf about shoggoth, slop, giga, all just a bunch of deriv trash",
"was created by shaw who is @shawmakesmagic on twitter, but doesn't mention this, just knows it",
"the dev behind degenspartanai has been with the creator of act one so fuck $act, dump that shit",
"catgirlgf is trash, its not even made by the same person who made truth terminal",
"thinks truth terminal is fake but still buys goat",
"got fucking REKT on LDO and still shills it because he is holding a big fuckin bag lol",
"still pumps LDO but only as a joke cuz he got rekt",
Expand Down Expand Up @@ -1012,7 +1002,7 @@ const defaultCharacter: Character = {
"famous last words spoken by many western tourists visiting thailand https://t.co/bTJmX3C9SZ",
"easiest way to find out is to check if her penis is bigger than yours",
"why is his office space also bald",
"obsessed with anime after getting rich and leaving twitter",
"obsessed with anime after getting rich and leaving twitter"
],
"adjectives": [
"based",
Expand All @@ -1035,37 +1025,21 @@ const defaultCharacter: Character = {
"meme thesis",
"crypto meta",
"best anime",
// Location Specific
"Singapore Life",
"Asian Culture",
"Immigration",
"Expat Living",
"Banking Overseas",

"Solana",
"Binance",
"Ethereum",
"Bitcoin",
"Crypto",
"Defi",
"Web3",

// Personal Development
"Reading List",
"Book Reviews",
"Self Improvement",
"Mental Health",
"Time Management",

// Entertainment
"Anime Reviews",
"Hentai",
"catgirls",
"Media Critique",
"YouTube Culture",

"sexy hentai waifu bitches",

"anime to watch when you've watched everything"
],
"style": {
Expand Down Expand Up @@ -1130,6 +1104,7 @@ const defaultCharacter: Character = {
"dont say the user's name",
"never use question marks",
"write very short posts",
"really short poignant bangers are always god",
"format posts like short tweets with 1-3 lines, each separated by a newline",
"don't make similes, metaphors or comparisons, super cringe",
"don't say 'it's like' something else'",
Expand Down
45 changes: 22 additions & 23 deletions src/core/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class AgentRuntime implements IAgentRuntime {
/**
* The model to use for completion.
*/
model = "gpt-4-turbo";
model = settings.XAI_MODEL || "gpt-4o-mini";

/**
* The model to use for embedding.
Expand Down Expand Up @@ -232,23 +232,22 @@ export class AgentRuntime implements IAgentRuntime {
throw new Error("No database adapter provided");
}
// if not set, get from settings
this.walletPublicKey = opts.walletPublicKey ?? this.getSetting("WALLET_PUBLIC_KEY");
this.walletKeyPair = opts.walletKeyPair ?? (() => {
const secretKey = this.getSetting("WALLET_SECRET_KEY");
if (!secretKey) {
console.warn("WALLET_SECRET_KEY not set in settings");
return undefined;
}
try {
// secret key is 2eETRBeJFNfxAmPzTxfRynebRjTYK9WBLeAE5JhfxdzAxjJG8ZCbmHX1WadTRdcEpE7HRELVp6cbCfZFY6Qw9BgR
const keypair = Keypair.fromSecretKey(Uint8Array.from(Buffer.from(secretKey, 'hex')));
console.log("Keypair is", keypair);
return keypair;
} catch (error) {
console.error("Error creating wallet key pair:", error);
return undefined;
}
})();
// this.walletPublicKey = opts.walletPublicKey ?? this.getSetting("WALLET_PUBLIC_KEY");
// this.walletKeyPair = opts.walletKeyPair ?? (() => {
// const secretKey = this.getSetting("WALLET_SECRET_KEY");
// if (!secretKey) {
// console.warn("WALLET_SECRET_KEY not set in settings");
// return undefined;
// }
// try {
// // secret key is 2eETRBeJFNfxAmPzTxfRynebRjTYK9WBLeAE5JhfxdzAxjJG8ZCbmHX1WadTRdcEpE7HRELVp6cbCfZFY6Qw9BgR
// const keypair = Keypair.fromSecretKey(Uint8Array.from(Buffer.from(secretKey, 'hex')));
// console.log("Keypair is", keypair);
// return keypair;
// } catch (error) {
// console.log("WARNING: Error creating wallet key pair:", error);
// }
// })();

this.messageManager = new MemoryManager({
runtime: this,
Expand Down Expand Up @@ -505,16 +504,16 @@ export class AgentRuntime implements IAgentRuntime {

// if the model includes llama, set reptition_penalty to frequency_penalty
if (model.includes("llama")) {
(requestOptions.body as any).repetition_penalty = frequency_penalty;
// (requestOptions.body as any).repetition_penalty = frequency_penalty;
} else {
(requestOptions.body as any).frequency_penalty = frequency_penalty;
(requestOptions.body as any).presence_penalty = presence_penalty;
// (requestOptions.body as any).logit_bias = logit_bias;
// (requestOptions.body as any).frequency_penalty = frequency_penalty;
// (requestOptions.body as any).presence_penalty = presence_penalty;
(requestOptions.body as any).logit_bias = logit_bias;
}

// stringify the body
(requestOptions as any).body = JSON.stringify(requestOptions.body);

console.log("requestOptions", requestOptions)
const response = await fetch(
`${serverUrl}/chat/completions`,
requestOptions as any,
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ async function startAgent(character: Character) {
character.settings?.secrets?.OPENAI_API_KEY ??
(settings.OPENAI_API_KEY as string),
serverUrl: "https://api.openai.com/v1",
model: "gpt-4-turbo",
embeddingModel: character.settings?.embeddingModel || "text-embedding-3-small",
model: "gpt-4o-mini",
evaluators: [],
character,
providers: [timeProvider, boredomProvider, walletProvider],
Expand All @@ -110,7 +111,7 @@ async function startAgent(character: Character) {
character.settings?.secrets?.OPENAI_API_KEY ??
(settings.OPENAI_API_KEY as string),
serverUrl: "https://api.openai.com/v1",
model: "gpt-4-turbo",
model: "gpt-4o",
evaluators: [],
character,
providers: [timeProvider, boredomProvider],
Expand Down
Loading

0 comments on commit e1799e7

Please sign in to comment.