Changesets · Branches · Tags · Compare
| Changeset | 567b310f64779f1a897c63c775e0425b998440b4b1d23136de69ee416754c5d4 |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-06-11 16:16 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-06-11 16:16 -07:00 |
| Parents | 0d2a295a29a9, 3cf95f0b2a97 |
4 files changed
modified core/data/log.test.ts +30 −0
| @@ -18,6 +18,19 @@ | ||
| 18 | 18 | provider: "openai", |
| 19 | 19 | }, |
| 20 | 20 | }; |
| 21 | + | |
| 22 | +const TEST_AGENT_INTERACTION_EVENT: DevDataLogEvent = { | |
| 23 | + name: 'chatInteraction', | |
| 24 | + data: { | |
| 25 | + prompt: "Hello, world!", | |
| 26 | + completion: "Hello, world!", | |
| 27 | + modelProvider: "openai", | |
| 28 | + modelTitle: "gpt-4", | |
| 29 | + sessionId: "1234", | |
| 30 | + tools: ['test-tool1'] | |
| 31 | + }, | |
| 32 | +} | |
| 33 | + | |
| 21 | 34 | const SCHEMA = "0.2.0"; |
| 22 | 35 | |
| 23 | 36 | describe("DataLogger", () => { |
| @@ -157,6 +170,23 @@ | ||
| 157 | 170 | expect(fileContent).toContain('"model":"gpt-4"'); |
| 158 | 171 | expect(fileContent).toContain('"eventName":"tokensGenerated"'); |
| 159 | 172 | }); |
| 173 | + | |
| 174 | + it('should write agent interaction data to local file', async () => { | |
| 175 | + // Call the method to log data locally | |
| 176 | + await dataLogger.logLocalData(TEST_AGENT_INTERACTION_EVENT); | |
| 177 | + | |
| 178 | + // Verify the file was created | |
| 179 | + const filepath = getDevDataFilePath(TEST_AGENT_INTERACTION_EVENT.name, SCHEMA); | |
| 180 | + expect(fs.existsSync(filepath)).toBe(true); | |
| 181 | + | |
| 182 | + // Read file contents and verify | |
| 183 | + const fileContent = fs.readFileSync(filepath, "utf8"); | |
| 184 | + console.log('debug1 filecontent', fileContent) | |
| 185 | + expect(fileContent).toContain('"eventName":"chatInteraction"'); | |
| 186 | + expect(fileContent).toContain('"prompt":"Hello, world!"'); | |
| 187 | + expect(fileContent).toContain('"completion":"Hello, world!"'); | |
| 188 | + expect(fileContent).toContain('"tools":["test-tool1"]'); | |
| 189 | + }) | |
| 160 | 190 | }); |
| 161 | 191 | |
| 162 | 192 | describe("logDevData", () => { |
modified gui/src/redux/thunks/streamNormalInput.ts +3 −0
| @@ -82,6 +82,9 @@ | ||
| 82 | 82 | modelProvider: selectedChatModel.underlyingProviderName, |
| 83 | 83 | modelTitle: selectedChatModel.title, |
| 84 | 84 | sessionId: state.session.id, |
| 85 | + ...(state.session.mode === 'agent' && { | |
| 86 | + tools: activeTools.map((tool) => tool.function.name), | |
| 87 | + }), | |
| 85 | 88 | }, |
| 86 | 89 | }); |
| 87 | 90 | } |
modified packages/config-yaml/src/schemas/data/chatInteraction/index.ts +1 −0
| @@ -7,4 +7,5 @@ | ||
| 7 | 7 | prompt: z.string(), |
| 8 | 8 | completion: z.string(), |
| 9 | 9 | sessionId: z.string(), |
| 10 | + tools: z.array(z.string()).optional() | |
| 10 | 11 | }); |
modified packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts +1 −0
| @@ -16,6 +16,7 @@ | ||
| 16 | 16 | modelTitle: true, |
| 17 | 17 | modelProvider: true, |
| 18 | 18 | sessionId: true, |
| 19 | + tools: true | |
| 19 | 20 | }); |
| 20 | 21 | |
| 21 | 22 | export const chatInteractionEventSchema_0_2_0_noCode = |