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

New Feature: Language Selection #142

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jlcases
Copy link

@jlcases jlcases commented Aug 20, 2023

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.
image

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.
image

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

Copy link

@ill-yes ill-yes left a 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.

Copy link

@notvicent3 notvicent3 left a 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):

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.

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}.",

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}.")

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):

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

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

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

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Touché.

@assafelovic
Copy link
Owner

Languages are by default when using most LLMs so selecting the lang is redundant.

@saccohuo
Copy link

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?

@assafelovic assafelovic reopened this May 13, 2024
@assafelovic
Copy link
Owner

@saccohuo definitely in demand but very old and many conflicts. Should we open a new PR for this? What ever you decide and happy to help and push this to production! @jlcases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants