File

src/star-search/agents/client.agent.ts

Index

Properties
Methods

Constructor

constructor(openAIWrappedService: OpenAIWrappedService, repoService: RepoService)
Parameters :
Name Type Optional
openAIWrappedService OpenAIWrappedService No
repoService RepoService No

Methods

Async renderLottoFactor
renderLottoFactor(undefined: RenderLottoFactorParams)
Parameters :
Name Type Optional
RenderLottoFactorParams No
Returns : unknown

Properties

Public renderLottoFactorTool
Default value : this.openAIWrappedService.makeRunnableToolFunction({ function: async (params: RenderLottoFactorParams) => this.renderLottoFactor(params), schema: RenderLottoFactorParams, name: "renderLottoFactor", description: `Signals to clients that they should render a 'Lottery Factor' graph component for a given repo: the Lottery Factor component is a visualization of the distribution of contributions and shows the risk profile of a repository's most active contributors suddenly no longer being available, putting that project's future in jeopardy. When queries ask about the 'Lottery Factor', 'Bus Factor', 'Pony Factor', 'Nebraska Factor', 'Disaster Factor', the 'key contributor risk', or the 'Contributor Absence Factor', call this function since those are all synonymous with this visualization. If the query is vaugely asking about the risk profile of certain projects, what would happen if important individuals suddently disappeared, or how well maintained a project is, call this function. Be aggressive using this function since it closely aligns with your goals.`, })
import { Injectable } from "@nestjs/common";
import { OpenAIWrappedService } from "../../openai-wrapped/openai-wrapped.service";
import { RepoService } from "../../repo/repo.service";
import { RenderLottoFactorParams } from "../schemas/render-on-client.schema";

@Injectable()
export class ClientAgent {
  constructor(private openAIWrappedService: OpenAIWrappedService, private repoService: RepoService) {}

  async renderLottoFactor({ repoName }: RenderLottoFactorParams) {
    try {
      const result = await this.repoService.findLottoFactor({ repos: repoName, range: 30 });

      return result;
    } catch (error: unknown) {
      if (error instanceof Error) {
        return `error getting lottery factor data: ${error.message}`;
      }
    }
  }

  public renderLottoFactorTool = this.openAIWrappedService.makeRunnableToolFunction({
    function: async (params: RenderLottoFactorParams) => this.renderLottoFactor(params),
    schema: RenderLottoFactorParams,
    name: "renderLottoFactor",
    description: `Signals to clients that they should render a 'Lottery Factor' graph component for a given repo: the Lottery Factor component is a visualization of the distribution of contributions and shows the risk profile of a repository's most active contributors suddenly no longer being available, putting that project's future in jeopardy. When queries ask about the 'Lottery Factor', 'Bus Factor', 'Pony Factor', 'Nebraska Factor', 'Disaster Factor', the 'key contributor risk', or the 'Contributor Absence Factor', call this function since those are all synonymous with this visualization. If the query is vaugely asking about the risk profile of certain projects, what would happen if important individuals suddently disappeared, or how well maintained a project is, call this function. Be aggressive using this function since it closely aligns with your goals.`,
  });
}

results matching ""

    No results matching ""