This PR introduces several enhancements and new features to the AI-Resistant Assignments Expedition. The document loaders included in this PR support the following file types:
PDF
CSV
TXT
MD
URL (e.g., Wikipedia or other info sources)
PPTX
DOCX
XLS / XLSX
XML
GOOGLE DOCS
GOOGLE SHEETS
GOOGLE SLIDES
GOOGLE PDF
IMAGES (PNG / JPG / JPEG)
Changes
Reused the document loaders from Epic 7.2 #61.
Reused the utility file allowed_file_extensions.py to manage file types robustly.
Created a new tool.py to integrate the designed workflow for generating AI-resistant assignments.
Created a new core.py to integrate the AI-resistant assignments generator workflow from tool.py appropriately.
Decoupled the input arguments as a best practice to allow for flexible maintainability.
Created new error classes to improve the error mapping process.
Enabled a multimodal approach for generating responses from images, representing an innovative proposal for the project.
Testing
Each document loader was tested using pytest, with scenarios and edge cases properly managed.
Results
All document loaders are functioning as expected, yielding optimal results.
Notes
For Google Docs, Slides, Sheets, and PDF files:
These files need to be shared as public in Google Drive.
Files created in Google Drive need to be downloaded and then uploaded to be detected. This was determined to be the most appropriate approach, as the GoogleDriver loader from LangChain requires OAuth2, which is not suitable for production deployment.
How to Test
Clone the repository to your local environment.
Create and activate a virtual environment.
Run pip install -r requirements.txt to install the required libraries.
Create a .env file with the following fields:
ENV_TYPE (e.g., dev)
GCP_PROJECT_ID (your project ID from Cloud Console)
GOOGLE_API_KEY (your API key from AI Studio)
Start the application by running ./local-start.sh.
Add sample requests and responses for each file type mentioned above (with screenshots), and test them.
Request interface
Schema:
class AIResistantArgs(BaseModel):
topic: str = Field(..., min_length=1, max_length=255, description="Topic or subject related to the content")
assignment: str = Field(..., min_length=1, max_length=255, description="The given assignment")
grade_level: Literal["elementary", "middle", "high", "college", "professional"] = Field(..., description="Educational level to which the content is directed")
file_type: str = Field(..., description="Type of file being handled, according to the defined enumeration")
file_url: str = Field(..., description="URL or path of the file to be processed")
lang: str = Field(..., description="Language in which the file or content is written")
class AIResistanceIdea(BaseModel):
assignment_description: str = Field(..., description="Detailed description of the modified assignment")
explanation: str = Field(..., description="Explanation of how this modification makes the assignment AI-resistant")
class AIResistantOutput(BaseModel):
topic: str = Field(..., description="Topic or subject related to the assignment")
grade_level: str = Field(..., description="Educational level to which the assignment is directed")
ideas: List[AIResistanceIdea] = Field(..., description="List of 3 ideas to make the assignment AI-resistant, including explanation")
Silicon Sages - AI-Resistant Assignments Expedition - PR
Summary
This PR introduces several enhancements and new features to the AI-Resistant Assignments Expedition. The document loaders included in this PR support the following file types:
Changes
allowed_file_extensions.py
to manage file types robustly.tool.py
to integrate the designed workflow for generating AI-resistant assignments.core.py
to integrate the AI-resistant assignments generator workflow fromtool.py
appropriately.Testing
Each document loader was tested using pytest, with scenarios and edge cases properly managed.
Results
All document loaders are functioning as expected, yielding optimal results.
Notes
For Google Docs, Slides, Sheets, and PDF files:
How to Test
Clone the repository to your local environment.
Create and activate a virtual environment.
Run
pip install -r requirements.txt
to install the required libraries.Create a
.env
file with the following fields:ENV_TYPE
(e.g.,dev
)GCP_PROJECT_ID
(your project ID from Cloud Console)GOOGLE_API_KEY
(your API key from AI Studio)Start the application by running
./local-start.sh
.Add sample requests and responses for each file type mentioned above (with screenshots), and test them.
Request interface
Schema:
Example:
Response interface
Schema: