marvelai-org / marvel-ai-backend

This is the Marvel Teaching Assistant ai repo.
MIT License
17 stars 85 forks source link

Silicon Sages - AI-Resistant Assignments Expedition #108

Open AaronSosaRamos opened 1 month ago

AaronSosaRamos commented 1 month ago

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

Testing

Each document loader was tested using pytest, with scenarios and edge cases properly managed. image

Results

All document loaders are functioning as expected, yielding optimal results. image

Notes

For Google Docs, Slides, Sheets, and PDF files:

How to Test

  1. Clone the repository to your local environment.

  2. Create and activate a virtual environment.

  3. Run pip install -r requirements.txt to install the required libraries.

  4. 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)
  5. Start the application by running ./local-start.sh.

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

Example:

{
  "user": {
    "id": "string",
    "fullName": "string",
    "email": "string"
  },
  "type": "chat",
  "tool_data": {
    "tool_id": 5,
    "inputs": [
      {
        "name": "ai_resistant_args",
        "value": {
          "topic": "Introduction to Data Science",
          "assignment": "Develop a Neural Network Architecture for emulating Data Science Workflow",
          "grade_level": "college",
          "file_type": "pdf",
          "file_url": "http://ijsmsjournal.org/2021/volume-4%20issue-4/ijsms-v4i4p137.pdf",
          "lang": "en"
        }
      }
    ]
  }
} 

Response interface

Schema:

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