Skip to content

Commit bc26767

Browse files
GitLab and SWE fixes. Update Vertex LLMs
1 parent c184739 commit bc26767

File tree

14 files changed

+96
-134
lines changed

14 files changed

+96
-134
lines changed

frontend/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/functions/cloud/google/google-cloud.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class GoogleCloud {
5858
*/
5959
@func()
6060
async executeGcloudCommandModification(gcloudModifyCommand: string): Promise<string> {
61-
await waitForConsoleInput(`Agent "${agentContext().name}" is requesting to run the command ${gcloudModifyCommand}`);
61+
await humanInTheLoop(`Agent "${agentContext().name}" is requesting to run the command ${gcloudModifyCommand}`);
6262
if (!gcloudModifyCommand.includes('--project='))
6363
throw new Error('When calling executeGcloudCommandQuery the gcloudQueryCommand parameter must include the --project=<projectId> argument');
6464

src/functions/scm/gitlab.ts

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -185,24 +185,32 @@ export class GitLab implements SourceControlManagement {
185185
async cloneProject(projectPathWithNamespace: string): Promise<string> {
186186
if (!projectPathWithNamespace) throw new Error('Parameter "projectPathWithNamespace" must be truthy');
187187
const path = join(systemDir(), 'gitlab', projectPathWithNamespace);
188+
const fss = getFileSystem();
188189

189190
// If the project already exists pull updates from the main/dev branch
190191
if (existsSync(path) && existsSync(join(path, '.git'))) {
191-
logger.info(`${projectPathWithNamespace} exists at ${path}. Pulling updates`);
192-
193-
// If the repo has a projectInfo.json file with a devBranch defined, then switch to that
194-
// else switch to the default branch defined in the GitLab project
195-
const projectInfo = await getProjectInfo();
196-
if (projectInfo.devBranch) {
197-
await getFileSystem().vcs.switchToBranch(projectInfo.devBranch);
198-
} else {
199-
const gitProject = await this.getProject(projectPathWithNamespace);
200-
const switchResult = await execCommand(`git switch ${gitProject.defaultBranch}`, { workingDirectory: path });
201-
if (switchResult.exitCode === 0) logger.info(`Switched to branch ${gitProject.defaultBranch}`);
202-
}
192+
const currentWorkingDir = fss.getWorkingDirectory();
193+
try {
194+
fss.setWorkingDirectory(path);
195+
logger.info(`${projectPathWithNamespace} exists at ${path}. Pulling updates`);
196+
197+
// If the repo has a projectInfo.json file with a devBranch defined, then switch to that
198+
// else switch to the default branch defined in the GitLab project
199+
const projectInfo = await getProjectInfo();
200+
if (projectInfo.devBranch) {
201+
await getFileSystem().vcs.switchToBranch(projectInfo.devBranch);
202+
} else {
203+
const gitProject = await this.getProject(projectPathWithNamespace);
204+
const switchResult = await execCommand(`git switch ${gitProject.defaultBranch}`, { workingDirectory: path });
205+
if (switchResult.exitCode === 0) logger.info(`Switched to branch ${gitProject.defaultBranch}`);
206+
}
203207

204-
const result = await execCommand(`git -C ${path} pull`);
205-
if (result.exitCode !== 0) logger.warn('Failed to pull updates');
208+
const result = await execCommand(`git -C ${path} pull`);
209+
if (result.exitCode !== 0) logger.warn('Failed to pull updates');
210+
} finally {
211+
// Current behaviour of this function is to not change the working directory
212+
fss.setWorkingDirectory(currentWorkingDir);
213+
}
206214
} else {
207215
logger.info(`Cloning project: ${projectPathWithNamespace} to ${path}`);
208216
await fs.promises.mkdir(path, { recursive: true });
@@ -242,6 +250,7 @@ export class GitLab implements SourceControlManagement {
242250
)}`;
243251
const { exitCode, stdout, stderr } = await execCommand(cmd);
244252
if (exitCode > 0) throw new Error(`${stdout}\n${stderr}`);
253+
logger.info(stdout);
245254

246255
const url = await new LlmTools().processText(stdout, 'Respond only with the URL where the merge request is.');
247256

src/functions/storage/fileSystemService.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,24 @@ export class FileSystemService {
114114
setWorkingDirectory(dir: string): void {
115115
if (!dir) throw new Error('dir must be provided');
116116
let relativeDir = dir;
117+
let isAbsolute = false;
117118
// Check absolute directory path
118119
if (dir.startsWith('/')) {
119120
if (existsSync(dir)) {
120121
this.workingDirectory = dir;
122+
isAbsolute = true;
121123
} else {
122124
// try it as a relative path
123125
relativeDir = dir.substring(1);
124126
}
125127
}
126-
const relativePath = path.join(this.getWorkingDirectory(), relativeDir);
127-
if (existsSync(relativePath)) {
128-
this.workingDirectory = relativePath;
129-
} else {
130-
throw new Error(`New working directory ${dir} does not exist (current working directory ${this.workingDirectory}`);
128+
if (!isAbsolute) {
129+
const relativePath = path.join(this.getWorkingDirectory(), relativeDir);
130+
if (existsSync(relativePath)) {
131+
this.workingDirectory = relativePath;
132+
} else {
133+
throw new Error(`New working directory ${dir} does not exist (current working directory ${this.workingDirectory}`);
134+
}
131135
}
132136

133137
// After setting the working directory, update the vcs (version control system) property

src/llm/multi-agent/blackberry.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { GenerateTextOptions, LLM } from '#llm/llm';
33
import { Claude3_5_Sonnet_Vertex } from '#llm/services/anthropic-vertex';
44
import { fireworksLlama3_405B } from '#llm/services/fireworks';
55
import { GPT4o } from '#llm/services/openai';
6-
import { Gemini_1_5_Pro } from '#llm/services/vertexai';
76
import { logger } from '#o11y/logger';
87

98
const MIND_OVER_DATA_SYS_PROMPT = `When addressing a problem, employ "Comparative Problem Analysis and Direct Reasoning" as follows:
@@ -66,7 +65,7 @@ const MIND_OVER_DATA_SYS_PROMPT = `When addressing a problem, employ "Comparativ
6665
`;
6766

6867
export class Blackberry extends BaseLLM {
69-
llms: LLM[] = [Claude3_5_Sonnet_Vertex(), GPT4o(), Gemini_1_5_Pro(), Claude3_5_Sonnet_Vertex(), fireworksLlama3_405B()];
68+
llms: LLM[] = [Claude3_5_Sonnet_Vertex(), GPT4o(), Claude3_5_Sonnet_Vertex(), fireworksLlama3_405B()];
7069
mediator: LLM = Claude3_5_Sonnet_Vertex();
7170

7271
constructor() {

src/llm/multi-agent/blueberry.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import { BaseLLM } from '#llm/base-llm';
22
import { GenerateTextOptions, LLM } from '#llm/llm';
33
import { getLLM } from '#llm/llmFactory';
4-
import { Claude3_5_Sonnet_Vertex } from '#llm/services/anthropic-vertex';
54
import { cerebrasLlama3_3_70b } from '#llm/services/cerebras';
6-
import { fireworksLlama3_405B } from '#llm/services/fireworks';
7-
import { GPT4o } from '#llm/services/openai';
8-
import { Gemini_1_5_Flash, Gemini_1_5_Pro } from '#llm/services/vertexai';
5+
import { Gemini_2_0_Flash } from '#llm/services/vertexai';
96
import { logger } from '#o11y/logger';
10-
import { withActiveSpan } from '#o11y/trace';
117

128
// sparse multi-agent debate https://arxiv.org/abs/2406.11776
139
// self-refine https://arxiv.org/pdf/2303.17651
@@ -114,7 +110,7 @@ export class Blueberry extends BaseLLM {
114110
// if (!this.llms) this.llms = [Claude3_5_Sonnet_Vertex(), GPT4o(), Gemini_1_5_Pro(), Claude3_5_Sonnet_Vertex(), fireworksLlama3_405B()];
115111
let llm = cerebrasLlama3_3_70b();
116112
// llm = groqLlama3_1_70B();
117-
llm = Gemini_1_5_Flash();
113+
llm = Gemini_2_0_Flash();
118114
if (!this.llms) this.llms = [llm, llm, llm, llm, llm];
119115
if (!this.mediator) this.mediator = llm;
120116
}

src/llm/multi-agent/deepSeekR1_Fallbacks.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { BaseLLM } from '../base-llm';
33
import { GenerateTextOptions, LLM, LlmMessage } from '../llm';
44
import { fireworksDeepSeekR1 } from '../services/fireworks';
55

6+
import { nebiusDeepSeekR1 } from '#llm/services/nebius';
67
import { togetherDeepSeekR1 } from '#llm/services/together';
78

89
export function deepSeekFallbackRegistry(): Record<string, () => LLM> {
@@ -22,12 +23,13 @@ export function DeepSeekR1_Together_Fireworks(): LLM {
2223
export class DeepSeekR1_Fallbacks extends BaseLLM {
2324
private together: LLM = togetherDeepSeekR1();
2425
private fireworks: LLM = fireworksDeepSeekR1();
26+
private nebius: LLM = nebiusDeepSeekR1();
2527

2628
constructor() {
2729
super(
28-
'DeepSeek R1 (Together, Fireworks)',
30+
'DeepSeek R1 (Together, Fireworks, Nebius)',
2931
'DeepSeekFallback',
30-
'deepseek-r1-together-fireworks',
32+
'deepseek-r1-together-fireworks-nebius',
3133
0, // Initialized later
3234
() => 0,
3335
() => 0,
@@ -48,8 +50,11 @@ export class DeepSeekR1_Fallbacks extends BaseLLM {
4850
} catch (e) {
4951
const errMsg = e.statuCode === '429' ? 'rate limited' : `error: ${e.message}`;
5052
logger.error(`Together DeepSeek ${errMsg}`);
51-
52-
return await this.fireworks.generateText(messages, opts);
53+
try {
54+
return await this.fireworks.generateText(messages, opts);
55+
} catch (e) {
56+
return await this.nebius.generateText(messages, opts);
57+
}
5358
}
5459
}
5560
}

src/llm/multi-agent/reasoning-debate.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { DeepSeekR1_Together_Fireworks } from '#llm/multi-agent/deepSeekR1_Fallb
55
import { Claude3_5_Sonnet_Vertex } from '#llm/services/anthropic-vertex';
66
import { deepSeekR1, deepSeekV3 } from '#llm/services/deepseek';
77
import { fireworksDeepSeek, fireworksDeepSeekR1 } from '#llm/services/fireworks';
8-
import { openAIo1 } from '#llm/services/openai';
8+
import { openAIo1, openAIo3mini } from '#llm/services/openai';
99
import { togetherDeepSeekR1 } from '#llm/services/together';
1010
import { Gemini_2_0_Flash_Thinking } from '#llm/services/vertexai';
1111
import { logger } from '#o11y/logger';
@@ -14,10 +14,10 @@ import { logger } from '#o11y/logger';
1414

1515
export function MoA_reasoningLLMRegistry(): Record<string, () => LLM> {
1616
return {
17-
'MoA:R1x3': () => new ReasonerDebateLLM('R1x3', deepSeekV3, [deepSeekR1, deepSeekR1, deepSeekR1], 'MoA R1x3'),
17+
'MoA:R1x3 DeepSeek': () => new ReasonerDebateLLM('R1x3 DeepSeek', deepSeekV3, [deepSeekR1, deepSeekR1, deepSeekR1], 'MoA R1x3'),
1818
'MoA:R1x3-Together-Fireworks': Together_R1x3_Together_Fireworks,
1919
'MoA:R1x3-Together': () => Together_R1x3(),
20-
'MoA:Sonnet_R1,o1,Gemini_Together': TogetherMoA_Claude_Sonnet_R1x2_o1,
20+
'MoA:Sonnet_Sonnet,o3-mini,R1': MoA_Sonnet__Sonnet_R1_o3mini,
2121
'MoA:Sonnet-Claude-R1,o1,Gemini': () =>
2222
new ReasonerDebateLLM(
2323
'Sonnet-Claude-R1,o1,Gemini',
@@ -37,12 +37,12 @@ export function Together_R1x3_Together_Fireworks(): LLM {
3737
);
3838
}
3939

40-
export function TogetherMoA_Claude_Sonnet_R1x2_o1(): LLM {
40+
export function MoA_Sonnet__Sonnet_R1_o3mini(): LLM {
4141
return new ReasonerDebateLLM(
42-
'Sonnet_R1,o1,Gemini_Together',
42+
'Sonnet_Sonnet,o3-mini,R1',
4343
Claude3_5_Sonnet_Vertex,
44-
[DeepSeekR1_Together_Fireworks, openAIo1, DeepSeekR1_Together_Fireworks],
45-
'MoA:Claude-R1,o1,Gemini (Together, Fireworks)',
44+
[DeepSeekR1_Together_Fireworks, openAIo3mini, Claude3_5_Sonnet_Vertex],
45+
'MoA:Sonnet-Sonnet,o3-mini,R1(Together, Fireworks)',
4646
);
4747
}
4848

src/llm/services/llm.int.ts

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { nebiusDeepSeekR1 } from '#llm/services/nebius';
1212
import { Ollama_Phi3 } from '#llm/services/ollama';
1313
import { GPT4oMini } from '#llm/services/openai';
1414
import { togetherLlama3_70B } from '#llm/services/together';
15-
import { Gemini_1_5_Flash, Gemini_2_0_Flash } from '#llm/services/vertexai';
15+
import { Gemini_2_0_Experimental, Gemini_2_0_Flash, Gemini_2_0_Flash_Lite, Gemini_2_0_Flash_Thinking } from '#llm/services/vertexai';
1616

1717
const elephantBase64 = fs.readFileSync('test/llm/elephant.jpg', 'base64');
1818
const pdfBase64 = fs.readFileSync('test/llm/purple.pdf', 'base64');
@@ -192,21 +192,38 @@ describe('LLMs', () => {
192192
});
193193

194194
describe('VertexAI', () => {
195-
const llm = Gemini_2_0_Flash();
195+
describe('Flash 2.0', () => {
196+
const llm = Gemini_2_0_Flash();
196197

197-
it('should generateText', async () => {
198-
const response = await llm.generateText(SKY_PROMPT, { temperature: 0 });
198+
it('should generateText', async () => {
199+
const response = await llm.generateText(SKY_PROMPT, { temperature: 0 });
200+
expect(response.toLowerCase()).to.include('blue');
201+
});
202+
203+
it('should handle image attachments', async () => {
204+
const response = await llm.generateText(IMAGE_BASE64_PROMPT, { temperature: 0 });
205+
expect(response.toLowerCase()).to.include('elephant');
206+
});
207+
208+
it('should handle PDF attachments', async () => {
209+
const response = await llm.generateText(PDF_PROMPT, { temperature: 0 });
210+
expect(response.toLowerCase()).to.include('purple');
211+
});
212+
});
213+
214+
it('Gemini 2.0 experimental should generateText', async () => {
215+
const response = await Gemini_2_0_Experimental().generateText(SKY_PROMPT, { temperature: 0 });
199216
expect(response.toLowerCase()).to.include('blue');
200217
});
201218

202-
it('should handle image attachments', async () => {
203-
const response = await llm.generateText(IMAGE_BASE64_PROMPT, { temperature: 0 });
204-
expect(response.toLowerCase()).to.include('elephant');
219+
it('Gemini 2.0 Flash Lite should generateText', async () => {
220+
const response = await Gemini_2_0_Flash_Lite().generateText(SKY_PROMPT, { temperature: 0 });
221+
expect(response.toLowerCase()).to.include('blue');
205222
});
206223

207-
it('should handle PDF attachments', async () => {
208-
const response = await llm.generateText(PDF_PROMPT, { temperature: 0 });
209-
expect(response.toLowerCase()).to.include('purple');
224+
it('Gemini 2.0 thinking experimental should generateText', async () => {
225+
const response = await Gemini_2_0_Flash_Thinking().generateText(SKY_PROMPT, { temperature: 0 });
226+
expect(response.toLowerCase()).to.include('blue');
210227
});
211228
});
212229
});

0 commit comments

Comments
 (0)