Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add team mapping for OpenAI module #4

Open
robertjdominguez opened this issue Dec 20, 2024 · 0 comments
Open

Add team mapping for OpenAI module #4

robertjdominguez opened this issue Dec 20, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@robertjdominguez
Copy link
Collaborator

Currently, the OpenAI module is generating a one-sentence summary of the user's ask. We should modify this to include a recommendation on which team would be most able to help resolve the user's issue. While adding a label will trigger our Linear integration, it's helpful to know which label to add 😉

We'd need a mapping similar to this:

const engineeringTeams: { team: string; description: string }[] = [
  {
    team: "Engine",
    description: "Focuses on the core API engine, ensuring performance, scalability, and reliability."
  },
  {
    team: "Enterprise Connectors",
    description: "Builds and maintains connectors for enterprise-grade integrations with various systems and databases."
  },
  {
    team: "Docs",
    description: "Responsible for creating and maintaining clear, comprehensive documentation for users."
  }
];

Then, we'd need to update the implementation of the summary function(s) to be something like this:

export async function summarizeIssueBody(issueBody: string): Promise<string> {
  const note = await client.chat.completions.create({
    messages: [
      {
        role: "user",
        content: `Summarize this GitHub issue into a one-sentence summary of what the user is asking for: ${issueBody}. 
        Additionally, analyze the user's ask and recommend which team from this list would be best to help: 
        ${engineeringTeams.map(({ team, description }) => `${team}: ${description}`).join("; ");}`,
      },
    ],
    model: "gpt-4o",
  });

  if (!note.choices[0].message.content) {
    throw new Error(`Error from OpenAI generating a summary`);
  }

  return note.choices[0].message.content;
}

// Transforms an existing Issue to use the summarized response from GPT.
export function updateIssueBody(issue: SheetRow, summary: string): SheetRow {
  issue.notes = summary;
  return issue;
}
@robertjdominguez robertjdominguez added the enhancement New feature or request label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant