Skip to content

Commit 75a4655

Browse files
authored
Merge pull request #920 from Sifchain/realitySpiral/deprecateGenerateObject
chore: deprecate text based way of generating JSON
2 parents a585a6f + 1525a80 commit 75a4655

File tree

11 files changed

+30
-30
lines changed

11 files changed

+30
-30
lines changed

packages/core/src/generation.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ export async function generateTextArray({
690690
}
691691
}
692692

693-
export async function generateObject({
693+
export async function generateObjectDEPRECATED({
694694
runtime,
695695
context,
696696
modelClass,
@@ -700,7 +700,7 @@ export async function generateObject({
700700
modelClass: string;
701701
}): Promise<any> {
702702
if (!context) {
703-
elizaLogger.error("generateObject context is empty");
703+
elizaLogger.error("generateObjectDEPRECATED context is empty");
704704
return null;
705705
}
706706
let retryDelay = 1000;
@@ -1129,7 +1129,7 @@ export const generateObjectV2 = async ({
11291129
mode = "json",
11301130
}: GenerationOptions): Promise<GenerateObjectResult<unknown>> => {
11311131
if (!context) {
1132-
const errorMessage = "generateObject context is empty";
1132+
const errorMessage = "generateObjectV2 context is empty";
11331133
console.error(errorMessage);
11341134
throw new Error(errorMessage);
11351135
}
@@ -1222,7 +1222,7 @@ export async function handleProvider(
12221222
case ModelProviderName.GROQ:
12231223
return await handleGroq(options);
12241224
case ModelProviderName.LLAMALOCAL:
1225-
return await generateObject({
1225+
return await generateObjectDEPRECATED({
12261226
runtime,
12271227
context,
12281228
modelClass,

packages/plugin-aptos/src/actions/transfer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
type Action,
1111
} from "@ai16z/eliza";
1212
import { composeContext } from "@ai16z/eliza";
13-
import { generateObject } from "@ai16z/eliza";
13+
import { generateObjectDEPRECATED } from "@ai16z/eliza";
1414
import {
1515
Account,
1616
Aptos,
@@ -111,7 +111,7 @@ export default {
111111
});
112112

113113
// Generate transfer content
114-
const content = await generateObject({
114+
const content = await generateObjectDEPRECATED({
115115
runtime,
116116
context: transferContext,
117117
modelClass: ModelClass.SMALL,

packages/plugin-flow/src/actions/transfer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
composeContext,
33
Content,
44
elizaLogger,
5-
generateObject,
5+
generateObjectDEPRECATED,
66
ModelClass,
77
type Action,
88
type ActionExample,
@@ -87,7 +87,7 @@ export class TransferAction {
8787
});
8888

8989
// Generate transfer content
90-
const content = await generateObject({
90+
const content = await generateObjectDEPRECATED({
9191
runtime,
9292
context: transferContext,
9393
modelClass: ModelClass.SMALL,

packages/plugin-icp/src/actions/createToken.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
composeContext,
33
generateImage,
44
generateText,
5-
generateObject,
5+
generateObjectDEPRECATED,
66
} from "@ai16z/eliza";
77
import {
88
ActionExample,
@@ -148,7 +148,7 @@ export const executeCreateToken: Action = {
148148
template: createTokenTemplate,
149149
});
150150

151-
const response = await generateObject({
151+
const response = await generateObjectDEPRECATED({
152152
runtime,
153153
context: createTokenContext,
154154
modelClass: ModelClass.LARGE,

packages/plugin-solana/src/actions/pumpfun.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
Memory,
1616
ModelClass,
1717
State,
18-
generateObject,
18+
generateObjectDEPRECATED,
1919
composeContext,
2020
type Action,
2121
} from "@ai16z/eliza";
@@ -262,8 +262,8 @@ Example response:
262262
Given the recent messages, extract or generate (come up with if not included) the following information about the requested token creation:
263263
- Token name
264264
- Token symbol
265-
- Token description
266-
- Token image description
265+
- Token description
266+
- Token image description
267267
- Amount of SOL to buy
268268
269269
Respond with a JSON markdown block containing only the extracted values.`;
@@ -302,7 +302,7 @@ export default {
302302
template: pumpfunTemplate,
303303
});
304304

305-
const content = await generateObject({
305+
const content = await generateObjectDEPRECATED({
306306
runtime,
307307
context: pumpContext,
308308
modelClass: ModelClass.LARGE,
@@ -325,7 +325,7 @@ export default {
325325
height: 512,
326326
count: 1
327327
}, runtime);
328-
328+
329329
if (imageResult.success && imageResult.data && imageResult.data.length > 0) {
330330
// Remove the "data:image/png;base64," prefix if present
331331
tokenMetadata.file = imageResult.data[0].replace(/^data:image\/[a-z]+;base64,/, '');

packages/plugin-solana/src/actions/swap.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
State,
1818
type Action,
1919
composeContext,
20-
generateObject,
20+
generateObjectDEPRECATED,
2121
settings,
2222
} from "@ai16z/eliza";
2323
import { TokenProvider } from "../providers/token.ts";
@@ -110,7 +110,7 @@ Example response:
110110
\`\`\`json
111111
{
112112
"inputTokenSymbol": "SOL",
113-
"outputTokenSymbol": "USDC",
113+
"outputTokenSymbol": "USDC",
114114
"inputTokenCA": "So11111111111111111111111111111111111111112",
115115
"outputTokenCA": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
116116
"amount": 1.5
@@ -125,7 +125,7 @@ Given the recent messages and wallet information below:
125125
126126
Extract the following information about the requested token swap:
127127
- Input token symbol (the token being sold)
128-
- Output token symbol (the token being bought)
128+
- Output token symbol (the token being bought)
129129
- Input token contract address if provided
130130
- Output token contract address if provided
131131
- Amount to swap
@@ -134,7 +134,7 @@ Respond with a JSON markdown block containing only the extracted values. Use nul
134134
\`\`\`json
135135
{
136136
"inputTokenSymbol": string | null,
137-
"outputTokenSymbol": string | null,
137+
"outputTokenSymbol": string | null,
138138
"inputTokenCA": string | null,
139139
"outputTokenCA": string | null,
140140
"amount": number | string | null
@@ -209,7 +209,7 @@ export const executeSwap: Action = {
209209
template: swapTemplate,
210210
});
211211

212-
const response = await generateObject({
212+
const response = await generateObjectDEPRECATED({
213213
runtime,
214214
context: swapContext,
215215
modelClass: ModelClass.LARGE,

packages/plugin-solana/src/actions/transfer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
type Action,
2525
} from "@ai16z/eliza";
2626
import { composeContext } from "@ai16z/eliza";
27-
import { generateObject } from "@ai16z/eliza";
27+
import { generateObjectDEPRECATED } from "@ai16z/eliza";
2828

2929
export interface TransferContent extends Content {
3030
tokenAddress: string;
@@ -119,7 +119,7 @@ export default {
119119
});
120120

121121
// Generate transfer content
122-
const content = await generateObject({
122+
const content = await generateObjectDEPRECATED({
123123
runtime,
124124
context: transferContext,
125125
modelClass: ModelClass.LARGE,

packages/plugin-starknet/src/actions/subdomain.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
State,
1010
type Action,
1111
composeContext,
12-
generateObject,
12+
generateObjectDEPRECATED,
1313
Content,
1414
elizaLogger,
1515
} from "@ai16z/eliza";
@@ -107,7 +107,7 @@ export default {
107107
});
108108

109109
// Generate transfer content
110-
const content = await generateObject({
110+
const content = await generateObjectDEPRECATED({
111111
runtime,
112112
context: transferContext,
113113
modelClass: ModelClass.MEDIUM,

packages/plugin-starknet/src/actions/swap.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
ActionExample,
44
composeContext,
55
elizaLogger,
6-
generateObject,
6+
generateObjectDEPRECATED,
77
HandlerCallback,
88
IAgentRuntime,
99
Memory,
@@ -105,7 +105,7 @@ export const executeSwap: Action = {
105105
template: swapTemplate,
106106
});
107107

108-
const response = await generateObject({
108+
const response = await generateObjectDEPRECATED({
109109
runtime,
110110
context: swapContext,
111111
modelClass: ModelClass.MEDIUM,

packages/plugin-starknet/src/actions/transfer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
composeContext,
88
Content,
99
elizaLogger,
10-
generateObject,
10+
generateObjectDEPRECATED,
1111
HandlerCallback,
1212
IAgentRuntime,
1313
Memory,
@@ -136,7 +136,7 @@ export default {
136136
});
137137

138138
// Generate transfer content
139-
const content = await generateObject({
139+
const content = await generateObjectDEPRECATED({
140140
runtime,
141141
context: transferContext,
142142
modelClass: ModelClass.MEDIUM,

packages/plugin-starknet/src/actions/unruggable.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
ActionExample,
44
composeContext,
55
elizaLogger,
6-
generateObject,
6+
generateObjectDEPRECATED,
77
HandlerCallback,
88
IAgentRuntime,
99
Memory,
@@ -102,7 +102,7 @@ export const deployToken: Action = {
102102
template: deployTemplate,
103103
});
104104

105-
const response = await generateObject({
105+
const response = await generateObjectDEPRECATED({
106106
runtime,
107107
context: deployContext,
108108
modelClass: ModelClass.MEDIUM,

0 commit comments

Comments
 (0)