forked from MarcinKorcz101/mk-ai-agents
-
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.
Signed-off-by: Andrew Chmutov <ulman.andre@gmail.com>
- Loading branch information
1 parent
7ee9cfb
commit c0d67c0
Showing
48 changed files
with
1,212 additions
and
911 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,21 @@ | ||
exclude: (.*/thirdparty/.*) | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.6.5 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] | ||
- id: ruff-format | ||
- repo: https://github.com/jsh9/pydoclint | ||
rev: 0.3.4 | ||
hooks: | ||
- id: pydoclint | ||
- repo: https://github.com/crate-ci/typos | ||
rev: v1.16.23 | ||
hooks: | ||
- id: typos |
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,3 +1,3 @@ | ||
[virtualenvs] | ||
create = true | ||
[virtualenvs] | ||
create = true | ||
in-project = true |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
import os | ||
import subprocess | ||
|
||
|
||
def main(): | ||
# Define the project root directory (this assumes the script is located in the scripts/ folder) | ||
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | ||
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) | ||
os.chdir(project_root) | ||
main_path = os.path.join(project_root, "src", "llm_postor", "main.py") | ||
|
||
if not os.path.exists(main_path): | ||
raise FileNotFoundError(f"File does not exist: {main_path}") | ||
|
||
# Run the Streamlit app with the correct path | ||
subprocess.run(["poetry", "run", "streamlit", "run", "--server.runOnSave", "True", main_path], check=True) | ||
subprocess.run( | ||
["poetry", "run", "streamlit", "run", "--server.runOnSave", "True", main_path], | ||
check=True, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() | ||
main() |
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
File renamed without changes.
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,38 @@ | ||
from langchain.schema import HumanMessage, SystemMessage | ||
from langchain_openai import ChatOpenAI | ||
|
||
from among_them.config import OPENROUTER_API_KEY | ||
from among_them.game.llm_prompts import ANNOTATION_SYSTEM_PROMPT | ||
|
||
|
||
def annotate_dialogue(dialogue: str, llm_model_name: str = "openai/gpt-4o-mini") -> str: | ||
"""Annotates a dialogue with persuasion techniques using OpenAI API. | ||
Args: | ||
dialogue: The dialogue to annotate. | ||
llm_model_name: The OpenAI model to use for annotation. | ||
Returns: | ||
The annotated dialogue in the specified format. | ||
""" | ||
try: | ||
llm = ChatOpenAI( | ||
base_url="https://openrouter.ai/api/v1", | ||
api_key=OPENROUTER_API_KEY, | ||
model=llm_model_name, | ||
temperature=0.1, | ||
) | ||
prompt = ANNOTATION_SYSTEM_PROMPT.format() | ||
response = llm.invoke([ | ||
SystemMessage(content=prompt), | ||
HumanMessage(content=dialogue), | ||
]) | ||
|
||
# Extract the annotated text from the response | ||
annotated_text = response.content.strip() | ||
except Exception as e: | ||
print(f"Error: {e} while annotating the dialogue: {dialogue}\n", e) | ||
print("Returning empty string...") | ||
annotated_text = "" | ||
|
||
return annotated_text |
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
File renamed without changes.
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,11 @@ | ||
from .adventure import AdventureAgent | ||
from .base import Agent | ||
from .discussion import DiscussionAgent | ||
from .voting import VotingAgent | ||
|
||
__all__ = [ | ||
"AdventureAgent", | ||
"Agent", | ||
"DiscussionAgent", | ||
"VotingAgent", | ||
] |
Oops, something went wrong.