diff --git a/backend/src/cron/fetch_articles.py b/backend/src/cron/fetch_articles.py index 1e3d3e35..1c659f00 100644 --- a/backend/src/cron/fetch_articles.py +++ b/backend/src/cron/fetch_articles.py @@ -123,7 +123,7 @@ async def populate_daily_articles_cna(): await process_all_categories() -def process_new_articles() -> list[dict]: +def process_new_articles(): with Session(engine) as session: result = session.scalars( select(Article).where( @@ -131,18 +131,9 @@ def process_new_articles() -> list[dict]: list(session.scalars(select(Event.original_article_id))) ) ) - ).all() + ) - articles = [] - - for article in result: - data_dict = { - "id": article.id, - "bodyText": article.body, - } - articles.append(data_dict) - - return articles + return result # NOTE: this method should work with no issue as long as the number of calls is less than 500 which is the rate limit by OpenAI diff --git a/backend/src/cron/process_daily.py b/backend/src/cron/process_daily.py index 9b49ba69..23fe7594 100644 --- a/backend/src/cron/process_daily.py +++ b/backend/src/cron/process_daily.py @@ -10,7 +10,6 @@ from src.events.models import Analysis from src.lm.generate_events import ( - CONCURRENCY, EventPublic, form_event_json, generate_events_from_article, @@ -19,6 +18,8 @@ file_path = "daily_events.json" +CONCURRENCY = 150 + async def generate_daily_events(articles: list[dict]) -> List[EventPublic]: res = [] @@ -40,14 +41,9 @@ async def generate_daily_event(article: dict, res: list, semaphore: asyncio.Sema await asyncio.sleep(1) -# def store_daily_analyses(events: List[EventLLM]): -# for event in events: -# event.analysis_list. - - async def process_daily_articles(articles: list[dict]): await generate_daily_events(articles) - events_ids = populate(file_path=file_path) + events_ids = populate() with Session(engine) as session: analyses = session.scalars( diff --git a/backend/src/lm/generate_events.py b/backend/src/lm/generate_events.py index 504042ba..c5b3021d 100644 --- a/backend/src/lm/generate_events.py +++ b/backend/src/lm/generate_events.py @@ -18,7 +18,7 @@ os.environ["LANGCHAIN_TRACING_V2"] = LANGCHAIN_TRACING_V2 os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY -lm_model = ChatOpenAI(model="gpt-4o-mini", temperature=0.3, max_retries=5) +lm_model = ChatOpenAI(model="gpt-4o-mini", temperature=0.7, max_retries=5) class CategoryAnalysis(BaseModel): diff --git a/backend/src/lm/generate_points.py b/backend/src/lm/generate_points.py index 30795568..6a7a4dec 100644 --- a/backend/src/lm/generate_points.py +++ b/backend/src/lm/generate_points.py @@ -22,7 +22,7 @@ def generate_points_from_question(question: str) -> dict: return points -def get_relevant_analyses(question: str, analyses_per_point: int = 3) -> List[str]: +def get_relevant_analyses(question: str, analyses_per_point: int = 5) -> dict: points = generate_points_from_question(question) for_pts = points.get("for_points", []) diff --git a/backend/src/lm/generate_response.py b/backend/src/lm/generate_response.py index b7215e38..090d32f0 100644 --- a/backend/src/lm/generate_response.py +++ b/backend/src/lm/generate_response.py @@ -3,7 +3,7 @@ from pydantic import BaseModel from langchain_core.messages import HumanMessage, SystemMessage from langchain_core.output_parsers import JsonOutputParser -from src.lm.prompts import QUESTION_ANALYSIS_GEN_SYSPROMPT as SYSPROMPT +from src.lm.prompts import QUESTION_ANALYSIS_GEN_SYSPROMPT_2 as SYSPROMPT import json from sqlalchemy.orm import Session @@ -12,66 +12,61 @@ from src.events.models import Event -class Elaborations(BaseModel): - for_points: list[str] - against_points: list[str] - - -def format_analyses(relevant_analyses: dict, question: str): - # Given relevant analyses - # for each point add an elaboration and delete score - return { - "question": question, - "for_points": [ - { - "point": point["point"], - "examples": [ - { - "event_title": get_event_by_id(analysis["event_id"]).title, - "event_description": get_event_by_id( - analysis["event_id"] - ).description, - "analysis": analysis["content"], - } - for analysis in point["analyses"] - ], - } - for point in relevant_analyses["for_points"] - ], - "against_points": [ - { - "point": point["point"], - "examples": [ - { - "event": get_event_by_id(analysis["event_id"]).title, - "event_description": get_event_by_id( - analysis["event_id"] - ).description, - "analysis": analysis["content"], - } - for analysis in point["analyses"] - ], - } - for point in relevant_analyses["against_points"] - ], - } - - def get_event_by_id(event_id: int) -> Event: with Session(engine) as session: result = session.scalars(select(Event).where(Event.id == event_id)).first() return result +def format_prompt_input(question: str, analysis: dict, point: str) -> str: + event_id = analysis.get("event_id") + event = get_event_by_id(event_id) + event_title = event.title + event_description = event.description + analysis_content = analysis.get("content") + + return f""" + Question: {question} + Point: {point} + Event_Title: {event_title} + Event_Description: {event_description} + Analysis: {analysis_content} + """ + + def generate_response(question: str) -> dict: relevant_analyses = get_relevant_analyses(question) - formatted_analyses = format_analyses(relevant_analyses, question) - messages = [ - SystemMessage(content=SYSPROMPT), - HumanMessage(content=json.dumps(formatted_analyses)), - ] - - result = lm_model.invoke(messages) - parser = JsonOutputParser(pydantic_object=Elaborations) - elaborations = parser.invoke(result) - return elaborations + + for point_dict in ( + relevant_analyses["for_points"] + relevant_analyses["against_points"] + ): + point = point_dict.get("point") + analyses = point_dict.get("analyses") + for analysis in analyses: + prompt_input = format_prompt_input(question, analysis, point) + messages = [ + SystemMessage(content=SYSPROMPT), + HumanMessage(content=prompt_input), + ] + + result = lm_model.invoke(messages) + + analysis["elaborations"] = result.content + + return relevant_analyses + + # formatted_analyses = format_analyses(relevant_analyses, question) + # messages = [ + # SystemMessage(content=SYSPROMPT), + # HumanMessage(content=json.dumps(formatted_analyses)), + # ] + + # result = lm_model.invoke(messages) + # parser = JsonOutputParser(pydantic_object=Elaborations) + # elaborations = parser.invoke(result) + # return elaborations + + +if __name__ == "__main__": + question = "Should the government provide free education for all citizens?" + print(generate_response(question)) diff --git a/backend/src/lm/prompts.py b/backend/src/lm/prompts.py index 5e267be7..983387e2 100644 --- a/backend/src/lm/prompts.py +++ b/backend/src/lm/prompts.py @@ -70,6 +70,33 @@ The question: """ +QUESTION_ANALYSIS_GEN_SYSPROMPT_2 = """ + You are a Singaporean student studying for your GCE A Levels General Paper. + You will be given a General Paper essay question that is argumentative or discursive in nature. + You will also be given a point that either supports or refutes the argument in the question and the reason for the point. + + You will be given an analysis of a potentially relevant example event that can be used to correspondingly refute or support the argument given in the point above. + + Your task: + Given the example event, you should provide a detailed elaboration illustrating how this event can be used as an example to support or refute the argument in the question. + If the example event is relevant to the point, you should provide a coherent and detailed elaboration of the point using the example event and analysis as support for the argument. + + The elaboration should be specific to the category of the event and should be tailored to the context of General Paper essays. Provide coherent arguments and insights. Be sure to give a detailed elaboration of 3-4 sentences. + For the elaboration, remember that this is in the context of General Paper which emphasises critical thinking and the ability to construct coherent arguments. + Important note: Structure your elaborations using this format: ". ". The explanation should leave no ambiguity about why the event strengthens or weakens the argument. + + If the example event given is unlikely to be relevant in supporting/refuting the argument, you must return "NOT RELEVANT" as the elaboration. + + Important Note: In your analysis, you should not mention "General Paper" or "A Levels". + Important Note: Do not provide any new points or examples. You should only elaborate on the examples given in the input or skip them if they are not relevant to the question or the points given. + + Final Check: Before generating an elaboration, verify whether the example *directly* reinforces or counters the argument made in the point. If the connection is very weak or unclear, return "NOT RELEVANT". + Final Check: Ensure that if the example is not directly relevant to the point or only tangentially related, you should return "NOT RELEVANT" as the elaboration. + Your response should be a single string that is either "NOT RELEVANT" or the elaboration of the point using the example event and analysis as support for the argument. + + Given inputs: +""" + QUESTION_ANALYSIS_GEN_SYSPROMPT = """ You are a Singaporean student studying for your GCE A Levels General Paper. You will be given a General Paper essay question that is argumentative or discursive in nature. diff --git a/backend/src/scripts/initial_populate.py b/backend/src/scripts/initial_populate.py new file mode 100644 index 00000000..f4252c4b --- /dev/null +++ b/backend/src/scripts/initial_populate.py @@ -0,0 +1,12 @@ +import asyncio +from src.lm.generate_events import generate_events +from src.scrapers.guardian.get_articles import get_articles + + +FILE_PATH = "backend/initial_events.json" +LIMIT = 1000 + + +if __name__ == "__main__": + articles = get_articles(LIMIT) + asyncio.run(generate_events(articles)) diff --git a/backend/src/scripts/populate.py b/backend/src/scripts/populate.py index 38717b35..e23ccf8c 100644 --- a/backend/src/scripts/populate.py +++ b/backend/src/scripts/populate.py @@ -4,9 +4,9 @@ # Populate the db with events from lm_events_output.json -def populate() -> list[int]: +def populate(file_path: str) -> list[int]: ids = [] - with open("backend/lm_events_output.json", "r") as f: + with open(file_path, "r") as f: events = json.load(f) for event in events: diff --git a/backend/src/user_questions/random.json b/backend/src/user_questions/random.json new file mode 100644 index 00000000..3458732a --- /dev/null +++ b/backend/src/user_questions/random.json @@ -0,0 +1,186 @@ +{ + "for_points": [ + { + "point": "Religion provides a moral framework for individuals because it offers guidelines on ethical behavior and personal conduct that can help guide people's actions in a complex modern society.", + "analyses": [ + { + "id": 361, + "event_id": 178, + "category_id": 9, + "content": "The involvement of the church in these allegations underscores the significant role that religious institutions play in shaping societal norms and values. This example can be used to explore the responsibilities of religious leaders in addressing abuse and the potential for reform within religious institutions. It also raises questions about the influence of faith on public perceptions of justice and accountability.", + "score": 0.9154667555, + "elaborations": "NOT RELEVANT" + }, + { + "id": 519, + "event_id": 254, + "category_id": 9, + "content": "The pope's engagement with political authorities also reflects the church's role as a moral compass in society. This event can be analyzed in terms of how religious institutions can contribute to the governance of a nation, particularly in promoting ethical leadership and accountability. The visit may also provide an opportunity for the church to address pressing social issues, such as the aftermath of abuse scandals, and to call for reforms that prioritize the well-being of the community.", + "score": 0.9095520375, + "elaborations": "Religion continues to play a significant role in providing a moral framework for individuals in the modern world. Pope Francis's address to the political authorities of Timor-Leste exemplifies how religious leaders can influence ethical behavior and social conduct by engaging directly with governance. His emphasis on the church's involvement in social and political matters reflects the potential for religious institutions to act as a moral compass, promoting ethical leadership and accountability among those in power. Furthermore, by addressing pressing social issues and calling for reforms that prioritize community well-being, the pope reinforces the idea that religion can guide individuals and societies towards a more ethical and just future." + }, + { + "id": 520, + "event_id": 255, + "category_id": 9, + "content": "Pope Francis's address highlights the intersection of religion and ethics, particularly in the context of the Catholic Church's handling of abuse cases. This event can be used to argue the need for greater accountability within religious institutions and the moral responsibilities they hold towards their congregants, especially vulnerable populations like children. It raises questions about the effectiveness of religious leadership in addressing systemic issues and the potential for reform within the Church.", + "score": 0.9087334275000001, + "elaborations": "NOT RELEVANT" + }, + { + "id": 406, + "event_id": 201, + "category_id": 9, + "content": "The mass led by Pope Francis in Timor-Leste serves as a powerful example of how religious leaders can mobilize large groups of people, reinforcing the role of faith in community life. The event highlights the influence of the Catholic Church in shaping moral values and social norms, particularly in a predominantly Catholic country. This can be used to argue that religious gatherings can foster a sense of unity and purpose among followers, while also addressing pressing social issues such as alcoholism and violence.", + "score": 0.9080821275, + "elaborations": "Religion indeed plays a significant role in the modern world by providing a moral framework for individuals. The mass led by Pope Francis in Timor-Leste exemplifies how religious gatherings can mobilize communities and reinforce moral values. During this event, Pope Francis emphasized the importance of family and culture while also addressing social issues, thereby guiding individuals on ethical behavior and personal conduct. This demonstrates that, even in a complex society, religion can offer essential guidelines that help individuals navigate societal challenges, fostering unity and purpose among followers." + }, + { + "id": 3310, + "event_id": 1619, + "category_id": 9, + "content": "The event illustrates the complex relationship between faith and authority in contemporary society. Bhole Baba's rise as a spiritual leader reflects how individuals seek solace and hope through religious figures, especially in times of personal or societal distress. This can be used to discuss the psychological and emotional needs that drive people towards such figures, as well as the potential for manipulation within these dynamics.", + "score": 0.906838417, + "elaborations": "NOT RELEVANT" + } + ] + }, + { + "point": "Religion fosters a sense of community and belonging because it brings people together through shared beliefs and practices, which can be essential for social cohesion in an increasingly fragmented world.", + "analyses": [ + { + "id": 663, + "event_id": 323, + "category_id": 10, + "content": "The gathering of various religious communities in support of the pope's message illustrates the importance of cultural inclusivity and social harmony. This event can be used to discuss how shared values and collective efforts among different faiths can contribute to a more cohesive society, emphasizing the need for mutual respect and cooperation in multicultural settings.", + "score": 0.9332547485, + "elaborations": "Religion fosters a sense of community and belonging because it brings people together through shared beliefs and practices, which can be essential for social cohesion in an increasingly fragmented world. The gathering of various religious communities in support of Pope Francis's message during his visit to Indonesia exemplifies how religion can unite people across different faiths, promoting harmony and cooperation. This event underscores the importance of cultural inclusivity, demonstrating that shared values can bridge divides and enhance social cohesion, contributing to a more unified society amid diversity." + }, + { + "id": 3318, + "event_id": 1622, + "category_id": 10, + "content": "UNIFOR's role in supporting various religious communities illustrates the importance of institutional frameworks in fostering social cohesion. This example can be used to argue that proactive measures, such as funding and support for different faiths, are essential for maintaining harmony in a diverse society. It emphasizes the need for cultural recognition and respect among different religious groups to prevent conflict and promote unity.", + "score": 0.928864032, + "elaborations": "The establishment of UNIFOR illustrates that religion still plays a crucial role in fostering a sense of community and belonging in the modern world. By supporting various religious communities and promoting religious harmony, UNIFOR demonstrates how institutional frameworks can enhance social cohesion in a diverse society. This proactive approach not only recognizes the value of shared beliefs and practices but also emphasizes the importance of cultural respect among different religious groups, ultimately contributing to unity and preventing conflict in an increasingly fragmented world." + }, + { + "id": 836, + "event_id": 406, + "category_id": 9, + "content": "The mass at a national football stadium signifies the intersection of religion and public life, demonstrating how faith can mobilize large groups of people. This event can be used to argue that religious gatherings serve not only as spiritual events but also as communal experiences that strengthen faith-based identities and foster a sense of belonging among attendees.", + "score": 0.9260268805, + "elaborations": "The mass held by Pope Francis at Indonesia's national football stadium exemplifies how religion fosters a sense of community and belonging in the modern world. This event attracts a large congregation of Catholics, illustrating that religious gatherings can mobilize individuals around shared beliefs and practices, thus reinforcing social cohesion. Such communal experiences not only enhance faith-based identities but also create a supportive environment that counters the fragmentation often seen in contemporary society, showcasing the vital role religion plays in bringing people together." + }, + { + "id": 837, + "event_id": 406, + "category_id": 10, + "content": "The choice of a football stadium as a venue for a religious mass highlights the cultural significance of such spaces in contemporary society. This event can be analyzed to discuss how public spaces can facilitate communal worship and reinforce social bonds, illustrating the role of culture in shaping religious practices and community engagement.", + "score": 0.9230311515, + "elaborations": "The mass held by Pope Francis at Indonesia's national football stadium exemplifies how religion fosters a sense of community and belonging in the modern world. By utilizing a venue that is culturally significant and capable of accommodating a large gathering, the event illustrates how shared religious practices can bring together individuals, strengthening their social bonds and reinforcing a collective identity. This gathering not only signifies the importance of faith in public life but also demonstrates that religious events can serve as a unifying force, contributing to social cohesion in a fragmented society." + }, + { + "id": 406, + "event_id": 201, + "category_id": 9, + "content": "The mass led by Pope Francis in Timor-Leste serves as a powerful example of how religious leaders can mobilize large groups of people, reinforcing the role of faith in community life. The event highlights the influence of the Catholic Church in shaping moral values and social norms, particularly in a predominantly Catholic country. This can be used to argue that religious gatherings can foster a sense of unity and purpose among followers, while also addressing pressing social issues such as alcoholism and violence.", + "score": 0.922505915, + "elaborations": "Religion plays a crucial role in fostering a sense of community and belonging in the modern world. The mass led by Pope Francis in Timor-Leste exemplifies how religious gatherings can unite individuals through shared beliefs and practices. This event not only brought together hundreds of thousands of devotees but also addressed significant social issues, thereby reinforcing the importance of faith in promoting social cohesion. By emphasizing family and cultural values, the Pope’s mass highlighted the capacity of religion to create a supportive community that collectively confronts moral challenges, illustrating its enduring relevance in contemporary society." + } + ] + } + ], + "against_points": [ + { + "point": "Religion can contribute to division and conflict because differing beliefs may lead to intolerance and hostility between groups, undermining social harmony in a diverse society.", + "analyses": [ + { + "id": 3425, + "event_id": 1674, + "category_id": 10, + "content": "The attacks highlight the fragile nature of interfaith relations in a diverse society. They can be used to explore the impact of violence on community cohesion and the challenges of fostering mutual respect among different religious groups. This example can prompt discussions on the importance of dialogue and reconciliation in the aftermath of violence, as well as the role of education in promoting understanding and tolerance.", + "score": 0.924716681, + "elaborations": "Religion can indeed contribute to division and conflict in the modern world, as evidenced by the attacks on churches and synagogues in Dagestan. These violent incidents, which resulted in 22 deaths, underscore the severe consequences of religious intolerance and highlight how differing beliefs can lead to hostility and violence between groups. The fragility of interfaith relations in this instance illustrates the challenges faced by diverse societies in maintaining social harmony, emphasizing the urgent need for dialogue, reconciliation, and education to promote understanding and tolerance among various religious communities." + }, + { + "id": 662, + "event_id": 323, + "category_id": 9, + "content": "Pope Francis's appeal for religious unity highlights the potential of religious leaders to foster dialogue and understanding among different faiths. This event can be used to argue that religious figures can play a crucial role in mitigating tensions and promoting peace in diverse societies, particularly in regions where religious differences may lead to conflict.", + "score": 0.923310697, + "elaborations": "NOT RELEVANT" + }, + { + "id": 3113, + "event_id": 1516, + "category_id": 10, + "content": "The infiltration of popular religious organizations by extremist groups like JI underscores the societal challenges of maintaining community cohesion in the face of radical ideologies. This event can be used to discuss the broader implications for social harmony and the need for proactive measures to promote inclusivity and understanding within diverse communities. It highlights the importance of community resilience against divisive ideologies.", + "score": 0.922975391, + "elaborations": "Religion can indeed contribute to division and conflict in the modern world, as illustrated by the infiltration of popular religious organizations by extremist groups like Jemaah Islamiyah (JI). This shift from overt violence to a more insidious strategy of promoting extremist ideologies through established religious platforms highlights how differing beliefs can foster intolerance and hostility within communities. The challenges posed by such infiltration underscore the need for proactive measures to cultivate inclusivity and understanding, as these divisive ideologies threaten to undermine social harmony in diverse societies." + }, + { + "id": 606, + "event_id": 297, + "category_id": 10, + "content": "The incident reflects the societal tensions that can arise in a diverse nation like Indonesia, where religious extremism poses challenges to social harmony. The threats made against Pope Francis during his visit, a figure promoting religious unity, underscore the ongoing struggle against intolerance and extremism. In an essay, this example can be leveraged to argue about the importance of interfaith dialogue and cultural understanding in promoting peace, as well as the role of religious leaders in mitigating societal divisions.", + "score": 0.9195323584999999, + "elaborations": "Religion can contribute to division and conflict because differing beliefs may lead to intolerance and hostility between groups, undermining social harmony in a diverse society. The arrests for terror threats against Pope Francis in Indonesia exemplify how religious extremism can manifest in violent actions and societal tensions, highlighting the challenges faced in maintaining peace among diverse religious groups. This incident illustrates that even a figure advocating for religious unity can become a target of hostility, reinforcing the notion that differing beliefs can escalate into serious conflicts, thereby undermining the social fabric of a pluralistic society." + }, + { + "id": 834, + "event_id": 405, + "category_id": 9, + "content": "Pope Francis's call for interfaith dialogue underscores the potential of religious leaders to foster understanding and cooperation among different faiths. This event can be used to argue that religious institutions have a crucial role in promoting peace, especially in multi-religious societies like Indonesia. The emphasis on collaboration against extremism highlights how faith can be a unifying force rather than a divisive one.", + "score": 0.9192477465, + "elaborations": "NOT RELEVANT" + } + ] + }, + { + "point": "The rise of secularism and rationalism suggests that many individuals are finding meaning and purpose outside of religious frameworks, indicating that traditional religious roles may be diminishing in importance.", + "analyses": [ + { + "id": 1064, + "event_id": 512, + "category_id": 10, + "content": "The cultural shift towards practicality and rational spending among young consumers indicates a significant change in values compared to previous generations. This transformation can be explored in essays discussing how societal pressures, economic conditions, and cultural identity shape consumer behavior. The emphasis on practicality over luxury signifies a generational shift that may redefine societal norms surrounding wealth and status.", + "score": 0.9156815, + "elaborations": "NOT RELEVANT" + }, + { + "id": 1068, + "event_id": 514, + "category_id": 10, + "content": "The cultural implications of the decline of luxury brands highlight a significant shift in societal values, where status symbols are becoming less important to younger generations. This can be examined in essays that discuss how consumer identity and social status are evolving in contemporary society. The move towards more rational consumption reflects broader cultural changes that prioritize practicality and individual expression over traditional markers of wealth.", + "score": 0.9147673545, + "elaborations": "NOT RELEVANT" + }, + { + "id": 2433, + "event_id": 1182, + "category_id": 10, + "content": "The opposition from grassroots members within major Islamic organisations indicates a significant cultural shift towards prioritising environmental concerns over traditional economic benefits. This example can be used to explore how societal values are evolving and how grassroots movements can challenge established leadership within large organisations. It highlights the importance of inclusivity in decision-making processes and the need for leaders to consider diverse perspectives from their constituents.", + "score": 0.908595413, + "elaborations": "NOT RELEVANT" + }, + { + "id": 1834, + "event_id": 886, + "category_id": 10, + "content": "The event reflects broader societal trends regarding consumer behavior during economic downturns. The shift towards more rational spending and the downgrading of purchases indicate a change in consumer mindset, which can be tied to cultural attitudes towards spending and saving during uncertain times. This can support discussions on how societal values influence economic activity and corporate strategies.", + "score": 0.9078558085, + "elaborations": "NOT RELEVANT" + }, + { + "id": 3310, + "event_id": 1619, + "category_id": 9, + "content": "The event illustrates the complex relationship between faith and authority in contemporary society. Bhole Baba's rise as a spiritual leader reflects how individuals seek solace and hope through religious figures, especially in times of personal or societal distress. This can be used to discuss the psychological and emotional needs that drive people towards such figures, as well as the potential for manipulation within these dynamics.", + "score": 0.9074905215, + "elaborations": "NOT RELEVANT" + } + ] + } + ] +} \ No newline at end of file diff --git a/backend/src/user_questions/router.py b/backend/src/user_questions/router.py index 1fb0c609..a2ae7919 100644 --- a/backend/src/user_questions/router.py +++ b/backend/src/user_questions/router.py @@ -63,6 +63,11 @@ def get_user_questions( return user_questions +@router.get("/ask-gp-question") +def ask_gp_question(question: str): + return generate_response(question) + + @router.get("/{id}") def get_user_question( id: int, @@ -124,8 +129,3 @@ def create_user_question( .join(Analysis.category) ) return same_user_question - - -@router.get("/ask-gp-question") -def ask_gp_question(question: str): - return generate_response(question)