auto_research.survey.core module

class AutoSurvey(api_key, model, paper_path, debug=False, mode='summarize_computer_science', approach='load', storage_path='papers.json')[source]

Bases: object

A class for automating the process of surveying research papers.

This class integrates and streamlines functionalities for analyzing research papers, including text extraction, summarization, algorithm analysis, and explanation.

Parameters:
  • api_key (str) – The API key for GPT model access.

  • model (str) – The GPT model identifier to use.

  • paper_path (str) – Path to the research paper PDF file.

  • debug (bool, optional) – Enable debug mode for detailed logging. Defaults to False.

  • mode (str, optional) – Analysis mode to use. Supports “summarize_computer_science”, “explain_computer_science”, “explain_algorithm”, and “information_retrieval”. Defaults to “summarize_computer_science”.

  • approach (str, optional) – Approach to use for extraction. Supports “load” and “new_trial”. Defaults to “load”.

  • storage_path (str, optional) – Path to the storage file for saving extracted information. Defaults to “papers.json”.

OpenAI_instance

Instance of GPT handler for text processing.

Type:

OpenAI_interface

paper_path

Path to the research paper being analyzed.

Type:

str

paper_name

Name of the research paper file.

Type:

str

paper_instance

Instance of Paper class for PDF processing.

Type:

Paper

prompt_instance

Instance for generating prompts.

Type:

SurveyPrompt

mode

Current analysis mode.

Type:

str

approach

Current extraction approach.

Type:

str

output

Storage for analysis results.

Type:

Optional[str]

ending_pages

Content of the paper’s final pages.

Type:

Optional[str]

storage_instance

Instance for storing and retrieving extracted information.

Type:

Storage

cost_accumulation

Accumulated cost of API usage.

Type:

float

Example

>>> survey = AutoSurvey(
...     api_key="your-api-key", model="gpt-4", paper_path="path/to/paper.pdf"
... )
>>> survey.run()
__init__(api_key, model, paper_path, debug=False, mode='summarize_computer_science', approach='load', storage_path='papers.json')[source]
Parameters:
Return type:

None

run(target_information=None, tests=None)[source]

Execute the paper analysis based on the selected mode.

Parameters:
  • target_information (Optional[str]) – Specific information to retrieve when mode is

  • "information_retrieval".

  • tests (Callable | None)

Return type:

None

tests (Optional[Callable]): A callable function for testing the response sequence.

Example

>>> survey = AutoSurvey(api_key, model, paper_path)
>>> survey.run()
send_inquiry(tests=None)[source]

Send an inquiry to the GPT model.

Parameters:

tests (Optional[Callable]) – A callable function for testing the response sequence.

Returns:

The response from the GPT model.

Return type:

str

information_retrieval(target_information, tests=None)[source]

Retrieve specific information from the paper.

Parameters:
  • target_information (str) – The specific information to retrieve.

  • tests (Optional[Callable]) – A callable function for testing the response sequence.

Return type:

None

extract_algorithm()[source]

Extract algorithm descriptions from the paper.

Example

>>> survey = AutoSurvey(api_key, model, paper_path)
>>> survey.extract_algorithm()
Return type:

None

explain_algorithm()[source]

Generate explanations for extracted algorithms.

Example

>>> survey = AutoSurvey(api_key, model, paper_path)
>>> survey.explain_algorithm()
Return type:

None

review()[source]

Review the paper content (placeholder for future implementation).

Return type:

None

extraction_key_information()[source]

Extract key information from the paper, including abstract, introduction, discussion, and conclusion.

Return type:

None

extraction()[source]

Extract main sections from the paper.

This method coordinates the extraction of abstract, introduction, discussion, and conclusion sections.

Example

>>> survey = AutoSurvey(api_key, model, paper_path)
>>> survey.extraction()
Return type:

None

extract_abstract()[source]

Extract the abstract section from the paper.

Example

>>> survey = AutoSurvey(api_key, model, paper_path)
>>> survey.extract_abstract()
Return type:

None

extract_introduction()[source]

Extract the introduction section from the paper.

Example

>>> survey = AutoSurvey(api_key, model, paper_path)
>>> survey.extract_introduction()
Return type:

None

extract_discussion()[source]

Extract the discussion section from the paper.

Example

>>> survey = AutoSurvey(api_key, model, paper_path)
>>> survey.extract_discussion()
Return type:

None

extract_conclusion()[source]

Extract the conclusion section from the paper.

Example

>>> survey = AutoSurvey(api_key, model, paper_path)
>>> survey.extract_conclusion()
Return type:

None

summarize_computer_science()[source]

Generate a summary of computer science papers.

Example

>>> survey = AutoSurvey(api_key, model, paper_path)
>>> survey.summarize_computer_science()
Return type:

None

explain_computer_science()[source]

Generate explanations for computer science papers.

This method allows the user to input questions about the paper, then sends the paper content and the question to the LLM for an answer. The process loops until the user cancels it.

Example

>>> survey = AutoSurvey(api_key, model, paper_path)
>>> survey.explain_computer_science()
Return type:

None

findings()[source]

Extract key findings from the paper (placeholder for future implementation).

Return type:

None