Skip to content

Commit

Permalink
Add LLM integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcampagnolitg committed Aug 19, 2024
1 parent 41682f1 commit 414738d
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/functions/scm/github.int.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('GitHub Integration Tests', () => {
expect(projects).to.be.an('array');
expect(projects.length).to.be.greaterThan(0);
expect(projects[0]).to.have.property('name');
expect(projects[0]).to.have.property('full_name');
expect(projects[0]).to.have.property('namespace');
});

it('should throw an error for invalid organization', async () => {
Expand All @@ -51,7 +51,7 @@ describe('GitHub Integration Tests', () => {
expect(projects.length).to.be.greaterThan(0);
// console.log(projects[0]);
const firstProject = projects[0];
const clonePath = await github.cloneProject(`${firstProject.name}`, 'main');
const clonePath = await github.cloneProject(`${firstProject.namespace}/${firstProject.name}`, 'main');
expect(clonePath).to.be.a('string');
expect(existsSync(clonePath)).to.be.true;
});
Expand Down
6 changes: 4 additions & 2 deletions src/functions/scm/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ export class GitHub implements SourceControlManagement {
const result = await execCommand(command, { workingDirectory: path });
failOnError(`Failed to clone ${projectPathWithOrg}`, result);
}
agentContext().memory[`GitHub_project_${org}_${project}_FileSystem_directory`] = path;
const agent = agentContext();
if (agent) agentContext().memory[`GitHub_project_${org}_${project}_FileSystem_directory`] = path;

return path;
}

Expand Down Expand Up @@ -216,7 +218,7 @@ function convertGitHubToGitProject(repo: GitHubRepository): GitProject {
return {
id: repo.id,
name: repo.name,
namespace: repo.full_name,
namespace: repo.full_name.split('/')[0],
description: repo.description,
defaultBranch: repo.default_branch,
visibility: repo.private ? 'private' : 'public',
Expand Down
4 changes: 2 additions & 2 deletions src/llm/models/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ export class Anthropic extends BaseLLM {
userPrompt,
systemPrompt,
llmId: this.getId(),
agentId: agentContext().agentId,
callStack: agentContext().callStack.join(' > '),
agentId: agentContext()?.agentId,
callStack: agentContext()?.callStack.join(' > '),
});
const requestTime = Date.now();

Expand Down
4 changes: 2 additions & 2 deletions src/llm/models/deepseek.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export class DeepseekLLM extends BaseLLM {
userPrompt,
systemPrompt,
llmId: this.getId(),
agentId: agentContext().agentId,
callStack: agentContext().callStack.join(' > '),
agentId: agentContext()?.agentId,
callStack: agentContext()?.callStack.join(' > '),
});
const requestTime = Date.now();

Expand Down
4 changes: 2 additions & 2 deletions src/llm/models/fireworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export class FireworksLLM extends BaseLLM {
userPrompt,
systemPrompt,
llmId: this.getId(),
agentId: agentContext().agentId,
callStack: agentContext().callStack.join(' > '),
agentId: agentContext()?.agentId,
callStack: agentContext()?.callStack.join(' > '),
});
const requestTime = Date.now();

Expand Down
4 changes: 2 additions & 2 deletions src/llm/models/groq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ export class GroqLLM extends BaseLLM {
userPrompt,
systemPrompt,
llmId: this.getId(),
agentId: agentContext().agentId,
callStack: agentContext().callStack.join(' > '),
agentId: agentContext()?.agentId,
callStack: agentContext()?.callStack.join(' > '),
});
const requestTime = Date.now();

Expand Down
5 changes: 3 additions & 2 deletions src/llm/models/llm.int.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import { GPT4oMini } from '#llm/models/openai';
import { togetherLlama3_70B } from '#llm/models/together';
import { Gemini_1_5_Flash } from '#llm/models/vertexai';

describe('LLMs', () => {
const SKY_PROMPT = 'What colour is the day sky? Answer in one word.';
// Skip until API keys are configured in CI
describe.skip('LLMs', () => {
const SKY_PROMPT = 'What colour is the day sky? Answer in one word. (Hint: starts with b)';

describe('Anthropic', () => {
const llm = Claude3_Haiku();
Expand Down
4 changes: 2 additions & 2 deletions src/llm/models/ollama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export class OllamaLLM extends BaseLLM {
userPrompt,
systemPrompt,
llmId: this.getId(),
agentId: agentContext().agentId,
callStack: agentContext().callStack.join(' > '),
agentId: agentContext()?.agentId,
callStack: agentContext()?.callStack.join(' > '),
});
const requestTime = Date.now();

Expand Down
4 changes: 2 additions & 2 deletions src/llm/models/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export class OpenAI extends BaseLLM {
userPrompt,
systemPrompt,
llmId: this.getId(),
agentId: agentContext().agentId,
callStack: agentContext().callStack.join(' > '),
agentId: agentContext()?.agentId,
callStack: agentContext()?.callStack.join(' > '),
});
const requestTime = Date.now();

Expand Down
4 changes: 2 additions & 2 deletions src/llm/models/together.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export class TogetherLLM extends BaseLLM {
userPrompt,
systemPrompt,
llmId: this.getId(),
agentId: agentContext().agentId,
callStack: agentContext().callStack.join(' > '),
agentId: agentContext()?.agentId,
callStack: agentContext()?.callStack.join(' > '),
});
const requestTime = Date.now();

Expand Down
4 changes: 2 additions & 2 deletions src/llm/models/vertexai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ class VertexLLM extends BaseLLM {
userPrompt,
systemPrompt,
llmId: this.getId(),
agentId: agentContext().agentId,
callStack: agentContext().callStack.join(' > '),
agentId: agentContext()?.agentId,
callStack: agentContext()?.callStack.join(' > '),
});
const requestTime = Date.now();

Expand Down

0 comments on commit 414738d

Please sign in to comment.