marvelai-org / marvel-ai-backend

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

Silicon Sages - Connect with Them Expedition #109

Open AaronSosaRamos opened 1 month ago

AaronSosaRamos commented 1 month ago

Silicon Sages - Connect with Them Expedition - PR

Summary

This PR introduces several enhancements and new features to the Connect with Them 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 ConnectWithThemArgs(BaseModel):
    grade_level: str = Field(..., description="The grade level the teacher is instructing.")
    task_description: str = Field(..., description="A brief description of the subject or topic the teacher is instructing.")
    students_description: str = Field(..., description="A description of the students including age group, interests, location, and any relevant cultural or social factors.")
    file_url: str = Field(..., description="URL of any relevant file associated with the teaching material.")
    file_type: str = Field(..., description="The type of the file")
    lang: str = Field(..., description="The language in which the subject is being taught.")

Example:

{
   "user":{
      "id":"string",
      "fullName":"string",
      "email":"string"
   },
   "type":"tool",
   "tool_data":{
      "tool_id":10,
      "inputs":[
         {
            "name":"connect_with_them_args",
            "value":{
               "grade_level":"College",
               "task_description":"Develop a Neural Network Architecture for emulating Data Science Workflow",
               "students_description":"Students aged 19-22, interested in hands-on activities, located in an urban area, with diverse cultural backgrounds.",
               "file_url":"http://ijsmsjournal.org/2021/volume-4%20issue-4/ijsms-v4i4p137.pdf",
               "file_type":"pdf",
               "lang":"en"
            }
         }
      ]
   }
}

Response interface

Schema:

class Recommendation(BaseModel):
    project_overview: str = Field(..., description="A detailed description of the project or activity recommendation.")
    rationale: str = Field(..., description="An explanation of why this recommendation is relevant to the students' interests or background.")
    difficulty_level: str = Field(..., description="The difficulty level of the project (e.g., easy, moderate, challenging).")
    required_tools: List[str] = Field(..., description="A list of tools, software, or resources required to complete the project.")
    estimated_time: str = Field(..., description="The estimated time to complete the project or activity.")

class RecommendationsOutput(BaseModel):
    recommendations: List[Recommendation] = Field(..., description="A list of personalized recommendations based on the input.")