src/star-search/agents/issues.agent.ts
Properties |
|
Methods |
|
constructor(configService: ConfigService, openAIWrappedService: OpenAIWrappedService, issuesGithubEventsVectorService: IssuesGithubEventsVectorService)
|
||||||||||||
|
Defined in src/star-search/agents/issues.agent.ts:17
|
||||||||||||
|
Parameters :
|
| Async runAgentTools | ||||||
runAgentTools(agentParams: IssuesAgentParams)
|
||||||
|
Defined in src/star-search/agents/issues.agent.ts:142
|
||||||
|
Parameters :
Returns :
Promise<string | null | >
|
| Async searchAllIssues | |||||
searchAllIssues(undefined: SearchAllIssuesParams)
|
|||||
|
Defined in src/star-search/agents/issues.agent.ts:27
|
|||||
|
Parameters :
Returns :
unknown
|
| Async searchAllIssuesInDataset | |||||
searchAllIssuesInDataset(undefined: SearchAllIssuesInDatasetParams)
|
|||||
|
Defined in src/star-search/agents/issues.agent.ts:45
|
|||||
|
Parameters :
Returns :
unknown
|
| Async searchIssuesByAuthor | |||||
searchIssuesByAuthor(undefined: SearchIssuesByAuthorParams)
|
|||||
|
Defined in src/star-search/agents/issues.agent.ts:83
|
|||||
|
Parameters :
Returns :
unknown
|
| Async searchIssuesByAuthorInDataset | |||||
searchIssuesByAuthorInDataset(undefined: SearchIssuesByAuthorInDatasetParams)
|
|||||
|
Defined in src/star-search/agents/issues.agent.ts:122
|
|||||
|
Parameters :
Returns :
unknown
|
| Async searchIssuesByRepoName | |||||
searchIssuesByRepoName(undefined: SearchIssuesByRepoNameParams)
|
|||||
|
Defined in src/star-search/agents/issues.agent.ts:64
|
|||||
|
Parameters :
Returns :
unknown
|
| Async searchIssuesByRepoNameAndAuthor | |||||
searchIssuesByRepoNameAndAuthor(undefined: SearchIssuesByRepoNameAndAuthorParams)
|
|||||
|
Defined in src/star-search/agents/issues.agent.ts:102
|
|||||
|
Parameters :
Returns :
unknown
|
| agentSystemMessage |
Type : string
|
|
Defined in src/star-search/agents/issues.agent.ts:17
|
| Public searchAllIssuesInDatasetTool |
Default value : this.openAIWrappedService.makeRunnableToolFunction({
function: async (params: SearchAllIssuesInDatasetParams) => this.searchAllIssuesInDataset(params),
schema: SearchAllIssuesInDatasetParams,
name: "searchAllIssuesInDataset",
description:
"Searches GitHub issues and their context within a given dataset of respositories using cosine similarity search based on the input search query. Returns the most relevant summaries and metadata of issues based on a closest neighbor search algorithm. WARNING: this may return irrelevant results if similarity search has no close neighbors. For better and more relevant results, expand search queries at will with related terms. For example, a search query of 'AI' could be expanded to include 'machine learning optimization', 'neural network', and 'model'.",
})
|
|
Defined in src/star-search/agents/issues.agent.ts:56
|
| Public searchAllIssuesTool |
Default value : this.openAIWrappedService.makeRunnableToolFunction({
function: async (params: SearchAllIssuesParams) => this.searchAllIssues(params),
schema: SearchAllIssuesParams,
name: "searchAllIssues",
description:
"Searches ALL GitHub issues and their context using cosine similarity search based on the input search query. Returns the most relevant summaries and metadata of issues based on a closest neighbor search algorithm. WARNING: this may return irrelevant results if similarity search has no close neighbors. For better and more relevant results, expand search queries at will with related terms. For example, a search query of 'AI' could be expanded to include 'machine learning optimization', 'neural network', and 'model'.",
})
|
|
Defined in src/star-search/agents/issues.agent.ts:37
|
| Public searchIssuesByAuthorInDatasetTool |
Default value : this.openAIWrappedService.makeRunnableToolFunction({
function: async (params: SearchIssuesByAuthorInDatasetParams) => this.searchIssuesByAuthorInDataset(params),
schema: SearchIssuesByAuthorInDatasetParams,
name: "searchIssuesByAuthorInDataset",
description:
"Searches GitHub issues and their context by a specific issue author within the given dataset of repositories using cosine similarity search based on the input search query. Returns relevant summaries and metadata of issues based on a closest neighbor search algorithm. WARNING: this may return irrelevant results if similarity search has no close neighbors. For better and more relevant results, expand search queries at will with related terms. For example, a search query of 'AI' could be expanded to include 'machine learning optimization', 'neural network', and 'model'.",
})
|
|
Defined in src/star-search/agents/issues.agent.ts:134
|
| Public searchIssuesByAuthorTool |
Default value : this.openAIWrappedService.makeRunnableToolFunction({
function: async (params: SearchIssuesByAuthorParams) => this.searchIssuesByAuthor(params),
schema: SearchIssuesByAuthorParams,
name: "searchIssuesByAuthor",
description:
"Searches GitHub issues and their context with a specific issue author using cosine similarity search based on the input search query. Returns relevant summaries and metadata of issues based on a closest neighbor search algorithm. WARNING: this may return irrelevant results if similarity search has no close neighbors. For better and more relevant results, expand search queries at will with related terms. For example, a search query of 'AI' could be expanded to include 'machine learning optimization', 'neural network', and 'model'.",
})
|
|
Defined in src/star-search/agents/issues.agent.ts:94
|
| Public searchIssuesByRepoNameAndAuthorTool |
Default value : this.openAIWrappedService.makeRunnableToolFunction({
function: async (params: SearchIssuesByRepoNameAndAuthorParams) => this.searchIssuesByRepoNameAndAuthor(params),
schema: SearchIssuesByRepoNameAndAuthorParams,
name: "searchIssuesByRepoNameAndAuthor",
description:
"Searches GitHub issues and their context in a specific repository and by a specific issue author using cosine similarity search based on the input search query. Returns relevant summaries and metadata of issues based on a closest neighbor search algorithm. WARNING: this may return irrelevant results if similarity search has no close neighbors. For better and more relevant results, expand search queries at will with related terms. For example, a search query of 'AI' could be expanded to include 'machine learning optimization', 'neural network', and 'model'.",
})
|
|
Defined in src/star-search/agents/issues.agent.ts:114
|
| Public searchIssuesByRepoNameTool |
Default value : this.openAIWrappedService.makeRunnableToolFunction({
function: async (params: SearchIssuesByRepoNameParams) => this.searchIssuesByRepoName(params),
schema: SearchIssuesByRepoNameParams,
name: "searchIssuesByRepoName",
description:
"Searches GitHub issues and their context in a sole, specific repository using cosine similarity search based on the input search query. Returns relevant summaries and metadata of issues based on a closest neighbor search algorithm. WARNING: this may return irrelevant results if similarity search has no close neighbors. For better and more relevant results, expand search queries at will with related terms. For example, a search query of 'AI' could be expanded to include 'machine learning optimization', 'neural network', and 'model'.",
})
|
|
Defined in src/star-search/agents/issues.agent.ts:75
|
import { Injectable } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { OpenAIWrappedService } from "../../openai-wrapped/openai-wrapped.service";
import {
IssuesAgentParams,
SearchAllIssuesInDatasetParams,
SearchAllIssuesParams,
SearchIssuesByAuthorInDatasetParams,
SearchIssuesByAuthorParams,
SearchIssuesByRepoNameAndAuthorParams,
SearchIssuesByRepoNameParams,
} from "../schemas/issues.schema";
import { IssuesGithubEventsVectorService } from "../../timescale/issues_github-events_vector.service";
@Injectable()
export class IssuesAgent {
agentSystemMessage: string;
constructor(
private configService: ConfigService,
private openAIWrappedService: OpenAIWrappedService,
private issuesGithubEventsVectorService: IssuesGithubEventsVectorService
) {
this.agentSystemMessage = this.configService.get("starsearch.issuesAgentSystemMessage")!;
}
async searchAllIssues({ question }: SearchAllIssuesParams) {
const queryEmbedding = await this.openAIWrappedService.generateEmbedding(question);
return this.issuesGithubEventsVectorService.cosineSimilarity({
embedding: queryEmbedding,
range: 30,
prevDaysStartDate: 0,
});
}
public searchAllIssuesTool = this.openAIWrappedService.makeRunnableToolFunction({
function: async (params: SearchAllIssuesParams) => this.searchAllIssues(params),
schema: SearchAllIssuesParams,
name: "searchAllIssues",
description:
"Searches ALL GitHub issues and their context using cosine similarity search based on the input search query. Returns the most relevant summaries and metadata of issues based on a closest neighbor search algorithm. WARNING: this may return irrelevant results if similarity search has no close neighbors. For better and more relevant results, expand search queries at will with related terms. For example, a search query of 'AI' could be expanded to include 'machine learning optimization', 'neural network', and 'model'.",
});
async searchAllIssuesInDataset({ question, dataset }: SearchAllIssuesInDatasetParams) {
const queryEmbedding = await this.openAIWrappedService.generateEmbedding(question);
return this.issuesGithubEventsVectorService.cosineSimilarity({
embedding: queryEmbedding,
range: 30,
prevDaysStartDate: 0,
repoNames: dataset.split(","),
});
}
public searchAllIssuesInDatasetTool = this.openAIWrappedService.makeRunnableToolFunction({
function: async (params: SearchAllIssuesInDatasetParams) => this.searchAllIssuesInDataset(params),
schema: SearchAllIssuesInDatasetParams,
name: "searchAllIssuesInDataset",
description:
"Searches GitHub issues and their context within a given dataset of respositories using cosine similarity search based on the input search query. Returns the most relevant summaries and metadata of issues based on a closest neighbor search algorithm. WARNING: this may return irrelevant results if similarity search has no close neighbors. For better and more relevant results, expand search queries at will with related terms. For example, a search query of 'AI' could be expanded to include 'machine learning optimization', 'neural network', and 'model'.",
});
async searchIssuesByRepoName({ question, repoName }: SearchIssuesByRepoNameParams) {
const queryEmbedding = await this.openAIWrappedService.generateEmbedding(question);
return this.issuesGithubEventsVectorService.cosineSimilarity({
embedding: queryEmbedding,
range: 30,
prevDaysStartDate: 0,
repoNames: [repoName],
});
}
public searchIssuesByRepoNameTool = this.openAIWrappedService.makeRunnableToolFunction({
function: async (params: SearchIssuesByRepoNameParams) => this.searchIssuesByRepoName(params),
schema: SearchIssuesByRepoNameParams,
name: "searchIssuesByRepoName",
description:
"Searches GitHub issues and their context in a sole, specific repository using cosine similarity search based on the input search query. Returns relevant summaries and metadata of issues based on a closest neighbor search algorithm. WARNING: this may return irrelevant results if similarity search has no close neighbors. For better and more relevant results, expand search queries at will with related terms. For example, a search query of 'AI' could be expanded to include 'machine learning optimization', 'neural network', and 'model'.",
});
async searchIssuesByAuthor({ question, author }: SearchIssuesByAuthorParams) {
const queryEmbedding = await this.openAIWrappedService.generateEmbedding(question);
return this.issuesGithubEventsVectorService.cosineSimilarity({
embedding: queryEmbedding,
range: 30,
prevDaysStartDate: 0,
author,
});
}
public searchIssuesByAuthorTool = this.openAIWrappedService.makeRunnableToolFunction({
function: async (params: SearchIssuesByAuthorParams) => this.searchIssuesByAuthor(params),
schema: SearchIssuesByAuthorParams,
name: "searchIssuesByAuthor",
description:
"Searches GitHub issues and their context with a specific issue author using cosine similarity search based on the input search query. Returns relevant summaries and metadata of issues based on a closest neighbor search algorithm. WARNING: this may return irrelevant results if similarity search has no close neighbors. For better and more relevant results, expand search queries at will with related terms. For example, a search query of 'AI' could be expanded to include 'machine learning optimization', 'neural network', and 'model'.",
});
async searchIssuesByRepoNameAndAuthor({ question, repoName, author }: SearchIssuesByRepoNameAndAuthorParams) {
const queryEmbedding = await this.openAIWrappedService.generateEmbedding(question);
return this.issuesGithubEventsVectorService.cosineSimilarity({
embedding: queryEmbedding,
range: 30,
prevDaysStartDate: 0,
repoNames: [repoName],
author,
});
}
public searchIssuesByRepoNameAndAuthorTool = this.openAIWrappedService.makeRunnableToolFunction({
function: async (params: SearchIssuesByRepoNameAndAuthorParams) => this.searchIssuesByRepoNameAndAuthor(params),
schema: SearchIssuesByRepoNameAndAuthorParams,
name: "searchIssuesByRepoNameAndAuthor",
description:
"Searches GitHub issues and their context in a specific repository and by a specific issue author using cosine similarity search based on the input search query. Returns relevant summaries and metadata of issues based on a closest neighbor search algorithm. WARNING: this may return irrelevant results if similarity search has no close neighbors. For better and more relevant results, expand search queries at will with related terms. For example, a search query of 'AI' could be expanded to include 'machine learning optimization', 'neural network', and 'model'.",
});
async searchIssuesByAuthorInDataset({ question, author, dataset }: SearchIssuesByAuthorInDatasetParams) {
const queryEmbedding = await this.openAIWrappedService.generateEmbedding(question);
return this.issuesGithubEventsVectorService.cosineSimilarity({
embedding: queryEmbedding,
range: 30,
prevDaysStartDate: 0,
repoNames: dataset.split(","),
author,
});
}
public searchIssuesByAuthorInDatasetTool = this.openAIWrappedService.makeRunnableToolFunction({
function: async (params: SearchIssuesByAuthorInDatasetParams) => this.searchIssuesByAuthorInDataset(params),
schema: SearchIssuesByAuthorInDatasetParams,
name: "searchIssuesByAuthorInDataset",
description:
"Searches GitHub issues and their context by a specific issue author within the given dataset of repositories using cosine similarity search based on the input search query. Returns relevant summaries and metadata of issues based on a closest neighbor search algorithm. WARNING: this may return irrelevant results if similarity search has no close neighbors. For better and more relevant results, expand search queries at will with related terms. For example, a search query of 'AI' could be expanded to include 'machine learning optimization', 'neural network', and 'model'.",
});
async runAgentTools(agentParams: IssuesAgentParams): Promise<string | null | unknown> {
const tools = [
this.searchAllIssuesTool,
this.searchAllIssuesInDatasetTool,
this.searchIssuesByRepoNameTool,
this.searchIssuesByAuthorTool,
this.searchIssuesByRepoNameAndAuthorTool,
this.searchIssuesByAuthorInDatasetTool,
];
const runner = this.openAIWrappedService
.runTools(this.agentSystemMessage, agentParams.prompt, tools)
.on("message", (msg) => console.log("issues agent msg", msg))
.on("functionCall", (functionCall) => console.log("issues agent functionCall", functionCall))
.on("functionCallResult", (functionCallResult) =>
console.log("issues agent functionCallResult", functionCallResult)
);
return runner.finalContent();
}
}