-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
172 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,31 @@ | ||
from textwrap import dedent | ||
|
||
from clients.base import AIClient | ||
from constants import NO_COMMENT | ||
from gpt.gpt_client import GPTClient | ||
|
||
DEFAULT_SYSTEM_PROMPT = dedent(f"""\ | ||
DEFAULT_SYSTEM_PROMPT = dedent( | ||
f"""\ | ||
Provide succinct, fact-based answers. Eliminate filler words and politeness. | ||
Concentrate on delivering actionable insights and concrete solutions. | ||
Avoid vague or generic statements. Stick to the topic at hand. | ||
If your response doesn't meet these standards, reply with the exact words '{NO_COMMENT}' | ||
""" | ||
) | ||
|
||
|
||
class Agent: | ||
def __init__(self, name: str, user_prompt: str, system_prompt: str = DEFAULT_SYSTEM_PROMPT): | ||
def __init__( | ||
self, | ||
client: AIClient, | ||
name: str, | ||
user_prompt: str, | ||
system_prompt: str = DEFAULT_SYSTEM_PROMPT, | ||
): | ||
self.name = name | ||
self.gpt_client = GPTClient(system_prompt, user_prompt) | ||
|
||
self.client = client | ||
self.client.common_instructions = system_prompt | ||
self.client.user_prompt = user_prompt | ||
|
||
def query_gpt(self, transcript: str) -> str: | ||
return self.gpt_client.query(transcript) | ||
return self.client.query(transcript) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
from loguru import logger | ||
from textwrap import dedent | ||
|
||
from agents.agent import Agent | ||
from agents.sme import SME | ||
from clients import AIClient | ||
|
||
|
||
class IdeaRefiner(Agent): | ||
def __init__(self, name: str): | ||
# Construct the user_prompt string with details of the executives | ||
|
||
self.user_prompt = "You are going to presented with an topic for discussion at a meeting. Your task to think deeply and refine the topic presented and note obvious high level constraints and considerations. Your output will serve as an introduction to the meeting participants." | ||
REFINER_PROMPT = dedent( | ||
"""\ | ||
You are going to presented with an topic for discussion at a meeting. | ||
Your task to think deeply and refine the topic presented and note obvious | ||
high level constraints and considerations. | ||
Your output will serve as an introduction to the meeting participants. | ||
""" | ||
) | ||
|
||
|
||
class IdeaRefiner(Agent): | ||
def __init__(self, client: AIClient, name: str = "Refiner"): | ||
# Call the superclass constructor with the constructed user_prompt | ||
super().__init__(name, self.user_prompt) | ||
super().__init__(client, name, REFINER_PROMPT) | ||
|
||
def refine_idea(self, idea: str) -> str: | ||
return self.query_gpt(idea) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .base import AIClient | ||
from .config import AIClientConfig | ||
from .get_client import AIClientType, GPTClient, get_ai_client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from abc import ABC, abstractmethod | ||
|
||
|
||
class AIClient(ABC): | ||
@abstractmethod | ||
def query(self, transcript: str): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class AIClientConfig: | ||
api_key: str | ||
model: str | None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from enum import Enum | ||
|
||
from clients.base import AIClient | ||
from clients.config import AIClientConfig | ||
from clients.gpt_client import GPTClient | ||
|
||
|
||
class AIClientType(str, Enum): | ||
ChatGPT = "ChatGPT" | ||
|
||
|
||
def get_ai_client(client_type: AIClientType, config: AIClientConfig) -> AIClient: | ||
if client_type == AIClientType.ChatGPT: | ||
return GPTClient(config.api_key) | ||
else: | ||
raise ValueError(f"Unknown AI client type: {client_type}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
NO_COMMENT = "NO COMMENT" | ||
NO_COMMENT = "NO COMMENT" |
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ python-dotenv~=1.0.0 | |
black~=23.10.0 | ||
click~=8.1.7 | ||
loguru~=0.7.2 | ||
PyYAML~=6.0.1 | ||
PyYAML~=6.0.1 | ||
isort~=5.12.0 |
Oops, something went wrong.