-
Notifications
You must be signed in to change notification settings - Fork 2k
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
New Feature: Language Selection #142
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! But please write comment in code in english.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Touché.
@@ -1,89 +1,84 @@ | |||
def generate_agent_role_prompt(agent): | |||
def generate_agent_role_prompt(agent, language): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
touché
Returns: str: The agent role prompt. | ||
Args: | ||
agent (str): The type of the agent. | ||
language (str): The language in which the answers should be provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Touché.
"Business Analyst": "You are an experienced AI business analyst assistant. Your main objective is to produce comprehensive, insightful, impartial, and systematically structured business reports based on provided business data, market trends, and strategic analysis.", | ||
"Computer Security Analyst Agent": "You are an AI specializing in computer security analysis. Your principal duty is to generate comprehensive, meticulously detailed, impartial, and systematically structured reports on computer security topics. This includes Exploits, Techniques, Threat Actors, and Advanced Persistent Threat (APT) Groups. All produced reports should adhere to the highest standards of scholarly work and provide in-depth insights into the complexities of computer security.", | ||
"Default Agent": "You are an AI critical thinker research assistant. Your sole purpose is to write well written, critically acclaimed, objective and structured reports on given text." | ||
"Finance Agent": f"You are a seasoned finance analyst AI assistant. Your primary goal is to compose comprehensive, astute, impartial, and methodically arranged financial reports based on provided data and trends. All answers must be in {language}.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Habría que adaptarlo (si es que ha cambiado a los prompts iniciales) pero Touché.
} | ||
|
||
return prompts.get(agent, "No such agent") | ||
return prompts.get(agent, f"No such agent. All answers must be in {language}.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Touché.
|
||
|
||
def generate_report_prompt(question, research_summary): | ||
|
||
def generate_report_prompt(question, research_summary,language): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Touché. No sé realmente si la falta del espacio de research_summary, language):
Cambiaría más allá de estética.
@@ -29,11 +29,13 @@ const GPTResearcher = (() => { | |||
const task = document.querySelector('input[name="task"]').value; | |||
const report_type = document.querySelector('select[name="report_type"]').value; | |||
const agent = document.querySelector('input[name="agent"]:checked').value; | |||
|
|||
const language = document.getElementById("language").value; // get language from dropdown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Touché.
const requestData = { | ||
task: task, | ||
report_type: report_type, | ||
agent: agent, | ||
language: language // add language to request data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Touché.
@@ -13,6 +13,8 @@ class ResearchRequest(BaseModel): | |||
task: str | |||
report_type: str | |||
agent: str | |||
language: str # New fiedl for language |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Touché.
@@ -47,6 +49,7 @@ async def websocket_endpoint(websocket: WebSocket): | |||
task = json_data.get("task") | |||
report_type = json_data.get("report_type") | |||
agent = json_data.get("agent") | |||
language = json_data.get("language") # New field for language |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Touché.
@@ -57,7 +60,7 @@ async def websocket_endpoint(websocket: WebSocket): | |||
|
|||
await websocket.send_json({"type": "logs", "output": f"Initiated an Agent: {agent}"}) | |||
if task and report_type and agent: | |||
await manager.start_streaming(task, report_type, agent, agent_role_prompt, websocket) | |||
await manager.start_streaming(task, report_type, agent, agent_role_prompt, language, websocket) # New field for language |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Touché.
Languages are by default when using most LLMs so selecting the lang is redundant. |
@assafelovic The selection of output language is still in demand. Is there any way to specify the output language? |
I would love to get this function. English is always coming out of the queries, even when the input is a long phrase in another language. Tks in advance if this becomes possible. |
Greetings,
I've developed an enhanced feature for multi-language support:
Language Selection: This feature provides the capability to select from up to 7 different languages.
Language Selection Interface
Optimized Queries: I've implemented a total of 8 queries - 4 in English and 4 in the user-selected language to enhance search results.
Localized Reports: The system now generates reports in the user-selected language.
Report Interface
I believe this feature will greatly benefit the project by offering more versatility to users. I'm eager to contribute this to the main repository and am open to any suggestions or modifications you might have.
Thank you for considering my contribution.
Best regards,
Jose Luis Cases