-
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.
Merge branch 'stepan-improvements' into main
# Conflicts: # agents/agent.py # agents/chairman.py # agents/idea_refiner.py # agents/sme.py # gpt/gpt_client.py # main.py # utils/print_with_wrap.py
- Loading branch information
Showing
19 changed files
with
240 additions
and
117 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: style | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' # caching pip dependencies | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Analysing the code with pylint | ||
run: | | ||
black --check --diff . | ||
isort --check --diff . |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .default_sme import DEFAULT_SME_DICT | ||
from .strings import NO_COMMENT |
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,42 @@ | ||
DEFAULT_SME_DICT = ( | ||
{ | ||
"name": "CEO", | ||
"expertise": "Corporate Strategy", | ||
"concerns": ["Market Entry", "Competitive Positioning"], | ||
}, | ||
{ | ||
"name": "CFO", | ||
"expertise": "Financial Products", | ||
"concerns": ["Rate Management", "Regulatory Compliance"], | ||
}, | ||
{ | ||
"name": "COO", | ||
"expertise": "Operational Efficiency", | ||
"concerns": ["Scalability", "Cost Optimization"], | ||
}, | ||
{ | ||
"name": "CMO", | ||
"expertise": "Customer Acquisition", | ||
"concerns": ["Target Market", "Onboarding Experience"], | ||
}, | ||
{ | ||
"name": "CTO", | ||
"expertise": "Technical Infrastructure", | ||
"concerns": ["Data Security", "System Integration"], | ||
}, | ||
{ | ||
"name": "CRO", | ||
"expertise": "Risk Management", | ||
"concerns": ["Fraud Detection", "Compliance"], | ||
}, | ||
{ | ||
"name": "CCO", | ||
"expertise": "Customer Experience", | ||
"concerns": ["UX/UI Design", "Customer Support"], | ||
}, | ||
{ | ||
"name": "CPO", | ||
"expertise": "Product Management", | ||
"concerns": ["Feature Rollout", "Customer Feedback"], | ||
}, | ||
) |
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 @@ | ||
NO_COMMENT = "NO COMMENT" |
Empty file.
Oops, something went wrong.