auto_research.search.keywords module

base_prompt_list(research_topic_prompt_string)[source]

Constructs a structured prompt to guide the generation of related keywords for a given research topic.

Parameters:

research_topic_prompt_string (str) – A detailed description of the research topic for which related keywords are needed.

Returns:

A list of strings that form the structured prompt. The prompt instructs the model to
generate a Python list of related keywords, including acronyms, full forms, synonyms, and

similar terminologies, ranked by relevance.

Return type:

list

test_as_list(raw_response)[source]

Validates and extracts a Python list from the raw response generated by the OpenAI model.

Parameters:

raw_response (str) – The raw response string from the OpenAI model.

Returns:

The extracted Python list from the raw response.

Return type:

list

Raises:

AssertionError – If the extracted object is not a list.

suggest_keywords(user_prompt, model, api_key)[source]

Generates a list of related keywords for a given research topic using the OpenAI model.

Parameters:
  • user_prompt (str) – A detailed description of the research topic for which related keywords are needed.

  • model (str) – The name of the OpenAI model to be used for generating the keywords.

  • api_key (str) – The API key for accessing the OpenAI model.

Returns:

A list of related keywords generated by the OpenAI model, ranked by relevance.

Return type:

list