varund2003 commited on
Commit
d8fd28f
·
0 Parent(s):

Initial project commit

Browse files
Files changed (35) hide show
  1. .env +3 -0
  2. Dockerfile +25 -0
  3. app.py +202 -0
  4. client_secret_522138295664-m3olkqmmocd1h1iqdh5rlgqhl9p6t5mo.apps.googleusercontent.com.json +1 -0
  5. config/checklist.txt +41 -0
  6. config/config.json +12 -0
  7. credentials.json +13 -0
  8. mentor_materials/Agent SDK_V1_24-04-25.txt +53 -0
  9. mentor_materials/Agent_SDK_+_Google_SDK.txt +214 -0
  10. qc_bot.log +238 -0
  11. reports/report_Overview and Key Components of Agent SDK.txt +53 -0
  12. reports/report_Use case of Agent SDK.txt +51 -0
  13. reports/report_Working of Agent SDK.txt +39 -0
  14. requirements.txt +11 -0
  15. src/__init__.py +0 -0
  16. src/__pycache__/__init__.cpython-312.pyc +0 -0
  17. src/__pycache__/main_flow.cpython-312.pyc +0 -0
  18. src/main_flow.py +195 -0
  19. src/preprocessing/__pycache__/download_manager.cpython-312.pyc +0 -0
  20. src/preprocessing/__pycache__/file_processor.cpython-312.pyc +0 -0
  21. src/preprocessing/__pycache__/gdrive_manager.cpython-312.pyc +0 -0
  22. src/preprocessing/__pycache__/transcript_generator.cpython-312.pyc +0 -0
  23. src/preprocessing/__pycache__/video_processor.cpython-312.pyc +0 -0
  24. src/preprocessing/download_manager.py +42 -0
  25. src/preprocessing/file_processor.py +52 -0
  26. src/preprocessing/gdrive_manager.py +93 -0
  27. src/preprocessing/transcript_generator.py +87 -0
  28. src/preprocessing/video_processor.py +51 -0
  29. src/report_generation/__pycache__/openai_client.cpython-312.pyc +0 -0
  30. src/report_generation/__pycache__/report_generator.cpython-312.pyc +0 -0
  31. src/report_generation/openai_client.py +25 -0
  32. src/report_generation/report_generator.py +120 -0
  33. transcripts/Overview and Key Components of Agent SDK.txt +6 -0
  34. transcripts/Use case of Agent SDK.txt +16 -0
  35. transcripts/Working of Agent SDK.txt +3 -0
.env ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ AZURE_SPEECH_KEY=FTm8MJblCZB02npRwB8dR8no2qSBNc8waZymfSxhI9NRQNpTfzBZJQQJ99BCACYeBjFXJ3w3AAAAACOGjJxh
2
+ AZURE_SPEECH_REGION=eastus
3
+ AZURE_OPENAI_KEY=6LKxP1xM2wbfXSOEsnmiTBW63yMGO1W08KFBhuuNd2KQGZSic5DlJQQJ99BCACHYHv6XJ3w3AAAAACOGrHz4
Dockerfile ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies
6
+ RUN apt-get update && \
7
+ apt-get install -y ffmpeg && \
8
+ rm -rf /var/lib/apt/lists/*
9
+
10
+ # Copy application files
11
+ COPY . .
12
+
13
+ # Install Python dependencies
14
+ RUN pip install --no-cache-dir -r requirements.txt
15
+
16
+ # Set environment variables
17
+ ENV AZURE_SPEECH_KEY=$AZURE_SPEECH_KEY
18
+ ENV AZURE_SPEECH_REGION=$AZURE_SPEECH_REGION
19
+ ENV AZURE_OPENAI_KEY=$AZURE_OPENAI_KEY
20
+
21
+ # Expose port
22
+ EXPOSE 8501
23
+
24
+ # Run the application
25
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
app.py ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ import streamlit as st
3
+ import os
4
+ import asyncio
5
+ import logging
6
+ import time
7
+ from src.preprocessing.gdrive_manager import GoogleDriveManager
8
+ from src.main_flow import MainFlow
9
+ from dotenv import load_dotenv
10
+
11
+ # Configure logging
12
+ logging.basicConfig(
13
+ level=logging.INFO,
14
+ format="%(asctime)s %(levelname)s %(name)s: %(message)s",
15
+ handlers=[
16
+ logging.FileHandler("qc_bot.log", mode='a', encoding='utf-8'),
17
+ logging.StreamHandler()
18
+ ]
19
+ )
20
+ logger = logging.getLogger(__name__)
21
+
22
+ # Load environment variables
23
+ load_dotenv()
24
+
25
+ # Initialize MainFlow
26
+ main_flow = MainFlow("config/config.json")
27
+
28
+ # Streamlit UI
29
+ st.set_page_config(
30
+ page_title="QC Report Generator",
31
+ page_icon="📊",
32
+ layout="wide"
33
+ )
34
+
35
+ # Custom CSS
36
+ st.markdown("""
37
+ <style>
38
+ .stButton>button {
39
+ background-color: #4CAF50;
40
+ color: white;
41
+ font-weight: bold;
42
+ padding: 10px 24px;
43
+ border-radius: 5px;
44
+ }
45
+ .report-box {
46
+ border: 1px solid #e0e0e0;
47
+ border-radius: 10px;
48
+ padding: 20px;
49
+ margin: 10px 0;
50
+ background-color: #f9f9f9;
51
+ }
52
+ .success-banner {
53
+ background-color: #d4edda;
54
+ color: #155724;
55
+ padding: 15px;
56
+ border-radius: 5px;
57
+ margin: 20px 0;
58
+ text-align: center;
59
+ }
60
+ .warning-banner {
61
+ background-color: #fff3cd;
62
+ color: #856404;
63
+ padding: 15px;
64
+ border-radius: 5px;
65
+ margin: 20px 0;
66
+ }
67
+ </style>
68
+ """, unsafe_allow_html=True)
69
+
70
+ # Initialize session state
71
+ if 'processing' not in st.session_state:
72
+ st.session_state.processing = False
73
+ if 'reports_generated' not in st.session_state:
74
+ st.session_state.reports_generated = False
75
+ if 'video_type' not in st.session_state:
76
+ st.session_state.video_type = "conceptual"
77
+
78
+ # App header
79
+ st.title("📊 QC Report Generator")
80
+ st.subheader("Automated Quality Control for Training Videos")
81
+
82
+ # Configuration Section
83
+ with st.expander("⚙️ Configuration", expanded=True):
84
+ st.session_state.video_type = st.radio(
85
+ "Select Video Type:",
86
+ ["conceptual", "hands-on", "both"],
87
+ format_func=lambda x: {
88
+ "conceptual": "Conceptual Explanation",
89
+ "hands-on": "Hands-on Demonstration",
90
+ "both": "Both"
91
+ }[x]
92
+ )
93
+
94
+ drive_url = st.text_input(
95
+ "Google Drive Videos Folder URL:",
96
+ placeholder="https://drive.google.com/drive/folders/1KSdVSVs_yN6FHvzH0i0CW2wNI0tCPhGt",
97
+ help="URL of the folder containing videos"
98
+ )
99
+
100
+ mentor_files = {}
101
+ if st.session_state.video_type in ["conceptual", "both"]:
102
+ mentor_files["slides"] = st.file_uploader(
103
+ "Upload Presentation (PPTX):",
104
+ type=["pptx", "ppt"]
105
+ )
106
+
107
+ if st.session_state.video_type in ["hands-on", "both"]:
108
+ mentor_files["notebook"] = st.file_uploader(
109
+ "Upload Notebook (IPYNB):",
110
+ type=["ipynb"]
111
+ )
112
+
113
+ if st.button("Generate Reports", disabled=st.session_state.processing):
114
+ if not drive_url:
115
+ st.error("Please enter a Google Drive URL")
116
+ else:
117
+ st.session_state.processing = True
118
+ st.session_state.reports_generated = False
119
+
120
+ # Processing
121
+ if st.session_state.processing:
122
+ status_area = st.empty()
123
+ progress_bar = st.progress(0)
124
+
125
+ # Processing steps
126
+ steps = [
127
+ "Downloading videos from Google Drive",
128
+ "Processing mentor materials",
129
+ "Generating transcripts",
130
+ "Creating quality reports"
131
+ ]
132
+
133
+ for i, step in enumerate(steps):
134
+ progress = int((i + 1) * 25)
135
+ status_area.info(f"⏳ **Step {i+1}/4**: {step}")
136
+ progress_bar.progress(progress)
137
+ try:
138
+ if i == 0:
139
+ # Process mentor materials FIRST
140
+ main_flow.process_mentor_materials(mentor_files)
141
+ elif i == 1:
142
+ # Download and process videos
143
+ asyncio.run(main_flow.process_drive_url(drive_url))
144
+ elif i == 2:
145
+ # Transcripts generated automatically
146
+ pass
147
+ elif i == 3:
148
+ # Generate reports
149
+ main_flow.generate_quality_reports()
150
+ except Exception as e:
151
+ status_area.error(f"❌ Error in step {i+1}: {str(e)}")
152
+ st.session_state.processing = False
153
+ st.stop()
154
+ time.sleep(1) # Simulate processing time
155
+
156
+ status_area.success("✅ Processing completed!")
157
+ st.session_state.processing = False
158
+ st.session_state.reports_generated = True
159
+ st.balloons()
160
+
161
+ # Sync reports from Google Drive
162
+ def sync_reports_from_drive(main_flow):
163
+ gdrive = GoogleDriveManager()
164
+ report_drive_files = gdrive.list_txt_files(main_flow.drive_folders["REPORTS"])
165
+ for file in report_drive_files:
166
+ local_path = os.path.join(main_flow.paths["REPORTS"], file["name"])
167
+ if not os.path.exists(local_path):
168
+ gdrive.download_file(file["id"], local_path)
169
+
170
+ # Display Reports
171
+ if st.session_state.reports_generated:
172
+ # Sync reports before displaying
173
+ sync_reports_from_drive(main_flow)
174
+
175
+ st.divider()
176
+ st.subheader("📋 Generated Reports")
177
+
178
+ reports_dir = main_flow.paths["REPORTS"]
179
+ report_files = [f for f in os.listdir(reports_dir) if f.endswith(".txt")]
180
+
181
+ if report_files:
182
+ for report_file in report_files:
183
+ with st.expander(f"📝 {report_file.replace('report_', '').replace('.txt', '')}"):
184
+ try:
185
+ with open(os.path.join(reports_dir, report_file), "r", encoding="utf-8") as f:
186
+ report_content = f.read()
187
+
188
+ # Display report with formatting
189
+ st.markdown(report_content)
190
+
191
+ # Download button
192
+ st.download_button(
193
+ label=f"Download {report_file}",
194
+ data=report_content,
195
+ file_name=report_file,
196
+ mime="text/plain",
197
+ key=f"dl_{report_file}"
198
+ )
199
+ except Exception as e:
200
+ st.error(f"Error reading report: {str(e)}")
201
+ else:
202
+ st.info("No reports found. Please generate reports first.")
client_secret_522138295664-m3olkqmmocd1h1iqdh5rlgqhl9p6t5mo.apps.googleusercontent.com.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"web":{"client_id":"522138295664-m3olkqmmocd1h1iqdh5rlgqhl9p6t5mo.apps.googleusercontent.com","project_id":"neon-net-462111-k2","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"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"}}
config/checklist.txt ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AO Checklist
2
+ -------------
3
+
4
+ 1. Content Accuracy & Coverage:
5
+ a. Topic and Subtopic Coverage: Confirm that all planned topics and subtopics are mentioned and explained.
6
+ b. Logical and Sequential Explanation: Ensure concepts are introduced in a structured, progressive order.
7
+ c. Factual Accuracy: Verify all statements are technically correct without conceptual inaccuracies.
8
+ d. Use of Examples and Analogies: Check for relevant examples/analogies for complex concepts.
9
+
10
+ 2. Code Walkthrough & Demonstration (if applicable):
11
+ a. Clear Execution of Code Demos: Code demonstrations should be clearly explained through narration.
12
+ b. Complete Explanation of Code Components: Variables, functions, and logic blocks should be described.
13
+ c. Mention of Libraries/Tools: All libraries/frameworks used should be explicitly named and explained.
14
+ d. Output Validation: Expected code outputs should be described and discussed.
15
+ e. Demonstration Pacing: Hands-on activities should be taught at a followable pace.
16
+
17
+ 3. Speech Clarity & Language Quality:
18
+ a. Clear and Understandable Speech: Speech should be coherent and paced appropriately.
19
+ b. Minimized Use of Filler Words: Avoid frequent fillers like "umm", "uh", "hmm", "ah".
20
+ c. Pronunciation of Technical Terms: Technical terms should be pronounced clearly.
21
+ d. Professional Language: Language must be formal, academic, and respectful.
22
+ e. No Inappropriate/Biased Statements: Avoid insensitive or biased language.
23
+
24
+ 4. Alignment with Visual Content:
25
+ a. Narration Matches Slide Order: Spoken content should follow the slide sequence.
26
+
27
+ 5. Student Engagement Prompts:
28
+ a. Calls to Action or Pause for Reflection: Prompt learners to try things themselves.
29
+ b. Questions to Learners: Include rhetorical questions to engage learners.
30
+ c. Invites Feedback or Queries: Encourage questions through comments/forums.
31
+
32
+ 6. Session Structure & Flow:
33
+ a. Proper Opening/Greeting: Start with clear introduction setting context.
34
+ b. Clear Transitions Between Sections: Use verbal cues for topic shifts.
35
+
36
+ 7. Tone, Motivation & Inclusivity:
37
+ a. Encouraging and Positive Tone: Use motivational language.
38
+ b. Inclusive Language: Gender-neutral and inclusive of all backgrounds.
39
+
40
+ 8. Time Management Indicators:
41
+ a. Adherence to Time Markers: Actual pacing should match mentioned time estimates.
config/config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "PATHS": {
3
+ "VIDEOS": "videos",
4
+ "AUDIOS": "audios",
5
+ "TRANSCRIPTS": "transcripts",
6
+ "REPORTS": "reports",
7
+ "MENTOR_MATERIALS": "mentor_materials"
8
+ },
9
+ "AZURE_OPENAI_ENDPOINT": "https://tst123451307193883.openai.azure.com/",
10
+ "AZURE_OPENAI_APIVERSION": "2025-01-01-preview",
11
+ "CHATGPT_MODEL": "gpt-4o-mini"
12
+ }
credentials.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "type": "service_account",
3
+ "project_id": "neon-net-462111-k2",
4
+ "private_key_id": "cc77a1185d7e0467ebe7072a971932f286f2f0be",
5
+ "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC0rgQBpIK2+SSG\njAXPJJZHfPuPVBTcLxnh6atAo0dUmNPCYEvUkUlSZi/HhZm0Bomn7ALi9+pC04bV\nU5ha1vCqlM73QDFSnPXTuL4kB1IG656VVv+DEFT+nqMwUxnTH8a742TrTB5i+YhO\n49GtQpGljgS0fRl8kYUClEZygbq5PiYScI2fM8aZCMYtqx+9qlrY5KXGHKz2sH1S\nFUoStHIxkI2UHPmG+j6z8y+8lQbZrrmE5QBrfuksFd/O3rI9qX0al7qQOv+UDFRM\ncFZKoG3kGyCVV1ZqCLiK5N8E3I3l41GaozEUZd1fBxyujaD/Q00a/91EdbaRXbO3\nEX6bWjoDAgMBAAECggEACew0oOwQy01LfQgoZlCzRog0Pvh2XNFJZQEyooFVFyEX\nIBzhwHIDynHj1du3rg3EQzCdYZGnKYLGBbLQy/+NIBEkFkTncIrZa7mnPgGyg40u\ntgAdI2y8l9WZtYga0JMO+wQ2AQyHiEmXLtEo+fbzjYzX8IGeULUKAcynqDCi7JSU\nv1scypeODrm5wO2+KwEZ4s0Wby1mXDgYcbG3Gnq3FVv8p/VEBhs/R9wBC9iJdICm\nKyHW36iSfanKJtCKV2IBjOKkqz2YcCtnpaD/07Zo4zy1tBZMicUeAod4J/yAMiOZ\nAtFHVc223JzsZupkpnwtdVCpdpTB4vw81LBF5olEIQKBgQDgcNZz6IL2ABtzGE+b\ncOQ6WQBBFY9yOO4CQ+RBG5HNQ8/HYk1Uvg0OP/KrbqDfEv8rC4EyxWZmoX7ibpMY\nmgAA4MBpLDalXB8K8PV5lzh4uye6YV9kyKgkg979vnxs9Q5cX1oa+7qG1hx8zbZu\nzsL8FqaS/6vTYGrixdqI3phklQKBgQDOFessthjXbx6uVdzcgEPQ5rq13oo31oIF\nXpxLaZsM8H5XLwAC40RSFq1u3QFgt69PRapyNx7Jc88qK+zVcsJI7DawKyAHh19j\nHfr1LLtVJkbOj4XeZIurGQMvcH4o49Dr5g4KROvCmJRnRdAOrWXrDpxoMiM/GwEN\n/RXi/NSmNwKBgHeejB2wkYPtILQiA+OzsmAKqWEGzbIx92BLsO6mc/nzp1z73n1I\n4YpzuLF3v9PEuyzE7/IQVXhjoE2sY0ecZF4Ta1likClnxL+/FwXb++QU06K5XO9J\nJpx3kDSq/oPPw/ylcU+qVIqiuQInXZEHL9LNe7AjBgAdhjog+00xXgVVAoGBAJIL\nEGTYCtSox3pOGL0eHHDvAYOe2B5n4i5B9MqwZROPXkkUYpKpUaJGtdMpxS8wHIk1\n2mskSqoCat380NIWiD47Pyoq9YDAW0WXWl/iukLGZEk/hmOqpxuyFwLIWm9JuqVh\nm7OFUfnOPOTOoXm1QdOIwChK15WB4oZyQs9f0qaTAoGAPKQrkVItvZA/7GLo4uPx\ngICeL+/D8n/BslfF9/XR4++0TKDv1uZM004SCMpUoIoklhxmVxi+aQeA/0VbDID5\nMjQst7QYQ4eaa7znvG3XFN9i96iU2sKAIb4ufITyC3XTxE5sH8b3w03uEhgil/GV\n4GZP+m8IcqsEr5koc/Jdq9k=\n-----END PRIVATE KEY-----\n",
6
+ "client_email": "recording-qc-bot@neon-net-462111-k2.iam.gserviceaccount.com",
7
+ "client_id": "103182639505940473738",
8
+ "auth_uri": "https://accounts.google.com/o/oauth2/auth",
9
+ "token_uri": "https://oauth2.googleapis.com/token",
10
+ "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
11
+ "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/recording-qc-bot%40neon-net-462111-k2.iam.gserviceaccount.com",
12
+ "universe_domain": "googleapis.com"
13
+ }
mentor_materials/Agent SDK_V1_24-04-25.txt ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Slide 1 ===
2
+ Agent SDK
3
+
4
+ === Slide 2 ===
5
+ Agenda
6
+ In this session, we'll discuss: Introduction to Agent SDK Key Components of Agent SDK Working of Agent SDK Use Cases of Agent SDK Benefits and Challenges of Agent SDK
7
+
8
+ === Slide 3 ===
9
+ Introduction to Agent SDK
10
+
11
+ === Slide 4 ===
12
+ Introduction to Agent SDK
13
+ Toolkit for building autonomous AI agents Provides resources, tools, and libraries Helps create flexible and reusable AI systems Enables integration of goals, tools, and memory in agents
14
+ What is Agent SDK?
15
+
16
+ === Slide 5 ===
17
+ Key Components of Agent SDK
18
+
19
+ === Slide 6 ===
20
+ Key Components of Agent SDK
21
+ Goals
22
+ Tools
23
+ Memory
24
+ Reasoning Loops
25
+
26
+ === Slide 7 ===
27
+ Working of Agent SDK
28
+
29
+ === Slide 8 ===
30
+ Working of Agent SDK
31
+ Prompt
32
+ Tool
33
+ Action
34
+ Result
35
+
36
+ === Slide 9 ===
37
+ Use Cases of Agent SDK
38
+
39
+ === Slide 10 ===
40
+ Benefits and Challenges of Agent SDK
41
+
42
+ === Slide 11 ===
43
+ Benefits of using Agent SDK
44
+
45
+ === Slide 12 ===
46
+ Challenges in using Agent SDK
47
+
48
+ === Slide 13 ===
49
+ Summary
50
+ Let's quickly recap: Agent SDK is a framework that helps create autonomous agents capable of performing tasks and interacting with external services. Key components include goals (objectives), memory (stores data), tools (external resources), and a reasoning loop (logic to decide actions). It allows agents to store information, interact with tools, and make decisions to achieve their goals autonomously. Agent SDK provides autonomy, modularity, and flexibility in task automation. Challenges include complex integration and debugging. Additionally, managing external resources can be difficult.
51
+
52
+ === Slide 14 ===
53
+ Thank You
mentor_materials/Agent_SDK_+_Google_SDK.txt ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## MARKDOWN CELL ##
2
+ Problem Statement:
3
+
4
+ Building an AI Agent Using Google SDK to Automate Real-Time Web Search Tasks
5
+
6
+ Objective:
7
+
8
+ Develop a simple autonomous AI Agent that takes a user-defined goal, performs real-time web searches using the Google Custom Search API (Google SDK), and presents relevant results to the user. The agent should also retain memory of past goals and results for reference.
9
+ ----
10
+ ## MARKDOWN CELL ##
11
+ Key Features:
12
+ * Accept a user-defined goal (search query).
13
+ * Use Google Custom Search API to fetch top search results.
14
+ * Display the top 3 results including title, URL, and snippet.
15
+ * Store the goal and results in memory for future use.
16
+ * Provide an option to refine the goal manually or conclude the session.
17
+ ----
18
+ ## MARKDOWN CELL ##
19
+ Expected Outcome:
20
+ * A functional, interactive AI Agent that demonstrates
21
+
22
+ Goal → Tool → Action → Result
23
+
24
+ * Real-time search result delivery based on user inputs.
25
+
26
+ * A memory system that logs all goals and search outcomes during the session.
27
+ ----
28
+ ## CODE CELL ##
29
+ # === Install the required package ===
30
+ !pip install google-api-python-client
31
+
32
+ # === Import necessary modules ===
33
+ from googleapiclient.discovery import build
34
+
35
+ # === API Configuration ===
36
+
37
+ # === Memory to store past goals and results ===
38
+ memory = []
39
+
40
+ # === Define the tool function using Google SDK ===
41
+ def google_search(query):
42
+ print(f"\n[Tool] Searching Google for: '{query}'")
43
+ service = build("customsearch", "v1", developerKey=API_KEY)
44
+ res = service.cse().list(q=query, cx=SEARCH_ENGINE_ID).execute()
45
+ return res['items']
46
+
47
+ # === Define the AI Agent's Reasoning Loop ===
48
+ def agent_reasoning_loop(goal):
49
+ print(f"\n[Agent] Received Goal: '{goal}'")
50
+
51
+ # Use Google Search Tool
52
+ results = google_search(goal)
53
+
54
+ # Display Top 3 Results
55
+ print(f"\n[Agent] Top 3 Results for '{goal}':\n")
56
+ for idx, item in enumerate(results[:3]):
57
+ print(f"Result {idx+1}:")
58
+ print("Title:", item['title'])
59
+ print("URL:", item['link'])
60
+ print("Snippet:", item['snippet'])
61
+ print("-" * 50)
62
+
63
+ # Store in Memory
64
+ memory.append({'goal': goal, 'results': results[:3]})
65
+ print(f"\n[Memory] Stored Goal & Results. Total stored goals: {len(memory)}")
66
+
67
+ # === Real-Time Interaction ===
68
+ print("Welcome to AI Agent + Google SDK!")
69
+
70
+ # Take user input for search goal
71
+ user_goal = input("Enter your search goal (e.g., 'top AI research labs in 2025'): ")
72
+
73
+ # Run the reasoning loop with the user's goal
74
+ agent_reasoning_loop(user_goal)
75
+
76
+ # === Show all memory at the end ===
77
+ print("\n=== Final Memory Log ===")
78
+ for m in memory:
79
+ print(f"\nGoal: {m['goal']}")
80
+ for r in m['results']:
81
+ print(f" - {r['title']} ({r['link']})")
82
+ ----
83
+ ## MARKDOWN CELL ##
84
+ Constraints:
85
+ * The agent operates only with manual refinement (no AI-generated refinements).
86
+ * Search is limited to what the Google Custom Search API can return within quota limits.
87
+ ----
88
+ ## MARKDOWN CELL ##
89
+ Enhancements:
90
+ * Let GPT also summarize the search results.
91
+
92
+ * Automatically generate next questions based on the results.
93
+
94
+ * Add multi-turn conversations where GPT acts as a guide.
95
+ ----
96
+ ## MARKDOWN CELL ##
97
+ Old Constraint:
98
+
99
+ * Manual refinement needed after each search.
100
+
101
+ Now:
102
+ * GPT automatically refines queries based on the original goal.
103
+
104
+ The agent becomes self-sufficient:
105
+
106
+ * It thinks (refines),
107
+
108
+ * Acts (searches),
109
+
110
+ * Learns (stores memory).
111
+ ----
112
+ ## MARKDOWN CELL ##
113
+ Flow of Execution:
114
+ * Agent receives goal → e.g., "top AI research labs in 2025".
115
+
116
+ * Searches Google using that goal.
117
+
118
+ * Refines goal using GPT → e.g., "leading artificial intelligence research institutes worldwide 2025".
119
+
120
+ * Searches Google again using GPT-refined goal.
121
+
122
+ * Stores both goals and results in memory.
123
+ ----
124
+ ## CODE CELL ##
125
+ # === Imports ===
126
+ import openai
127
+ from googleapiclient.discovery import build
128
+
129
+ # === API Keys ===
130
+ API_KEY = 'AIzaSyDZGmR6WcCU61cxpwSq70-jnJcOeh9PHHI' # <-- Replace with your API Key
131
+ SEARCH_ENGINE_ID = 'd16ee106ddcee4931' # <-- Replace with your Search Engine ID
132
+ openai.api_key = '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' # <-- Replace this
133
+
134
+ # === Memory Store ===
135
+ memory = []
136
+
137
+ # === Tool 1: Google Search ===
138
+ def google_search(query):
139
+ print(f"\n[Tool] Searching Google for: '{query}'")
140
+ service = build("customsearch", "v1", developerKey=API_KEY)
141
+ res = service.cse().list(q=query, cx=SEARCH_ENGINE_ID).execute()
142
+ return res['items']
143
+
144
+ # === Tool 2: OpenAI GPT for Refinement (Updated Syntax) ===
145
+ def refine_query_with_gpt(original_query):
146
+ print(f"\n[GPT] Refining query for: '{original_query}'")
147
+ prompt = f"Suggest a more detailed and specific version of this search query: '{original_query}'"
148
+
149
+ response = openai.chat.completions.create(
150
+ model="gpt-3.5-turbo", # or "gpt-4"
151
+ messages=[{"role": "user", "content": prompt}],
152
+ temperature=0.7,
153
+ max_tokens=50
154
+ )
155
+
156
+ refined_query = response.choices[0].message.content.strip()
157
+ print(f"[GPT] Refined Query: '{refined_query}'")
158
+ return refined_query
159
+
160
+ # === AI Agent's Reasoning Loop ===
161
+ def agent_reasoning_loop(goal):
162
+ print(f"\n[Agent] Received Goal: '{goal}'")
163
+
164
+ # First search with original goal
165
+ results_original = google_search(goal)
166
+
167
+ # Display Top 3 Results (Original)
168
+ print(f"\n[Agent] Top 3 Results for Original Goal '{goal}':\n")
169
+ for idx, item in enumerate(results_original[:3]):
170
+ print(f"Result {idx+1}:")
171
+ print("Title:", item['title'])
172
+ print("URL:", item['link'])
173
+ print("Snippet:", item['snippet'])
174
+ print("-" * 50)
175
+
176
+ # Refine goal using GPT
177
+ refined_goal = refine_query_with_gpt(goal)
178
+ results_refined = google_search(refined_goal)
179
+
180
+ # Display Top 3 Results (Refined)
181
+ print(f"\n[Agent] Top 3 Results for Refined Goal '{refined_goal}':\n")
182
+ for idx, item in enumerate(results_refined[:3]):
183
+ print(f"Result {idx+1}:")
184
+ print("Title:", item['title'])
185
+ print("URL:", item['link'])
186
+ print("Snippet:", item['snippet'])
187
+ print("-" * 50)
188
+
189
+ # Store both in memory
190
+ memory.append({
191
+ 'original_goal': goal,
192
+ 'refined_goal': refined_goal,
193
+ 'results_original': results_original[:3],
194
+ 'results_refined': results_refined[:3]
195
+ })
196
+ print(f"\n[Memory] Stored Original & Refined Goals. Total stored: {len(memory)}")
197
+
198
+ # === Run Agent with User Input ===
199
+ print("Welcome to AI Agent with OpenAI GPT + Google SDK!")
200
+
201
+ # Get the user goal via input
202
+ user_goal = input("Enter your search goal (e.g., 'latest AI trends 2025'): ")
203
+
204
+ # Run the reasoning loop with the user's goal
205
+ agent_reasoning_loop(user_goal)
206
+
207
+ # === Show Memory Log ===
208
+ print("\n=== Final Memory Log ===")
209
+ for m in memory:
210
+ print(f"\nOriginal Goal: {m['original_goal']}")
211
+ print(f"Refined Goal: {m['refined_goal']}")
212
+ for r in m['results_refined']:
213
+ print(f" - {r['title']} ({r['link']})")
214
+ ----
qc_bot.log ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2025-06-08 17:26:41,288 INFO src.main_flow: Initializing MainFlow with config: config/config.json
2
+ 2025-06-08 17:26:41,290 INFO src.main_flow: Initializing MainFlow with config: config/config.json
3
+ 2025-06-08 17:26:44,499 INFO src.main_flow: Initializing MainFlow with config: config/config.json
4
+ 2025-06-08 17:27:04,776 INFO src.main_flow: Initializing MainFlow with config: config/config.json
5
+ 2025-06-08 17:27:15,608 INFO src.main_flow: Initializing MainFlow with config: config/config.json
6
+ 2025-06-08 17:27:20,379 INFO src.main_flow: Initializing MainFlow with config: config/config.json
7
+ 2025-06-08 17:27:22,838 INFO src.main_flow: Initializing MainFlow with config: config/config.json
8
+ 2025-06-08 17:27:22,860 INFO src.main_flow: Processing Google Drive folder: https://drive.google.com/drive/folders/1angHYyiE_sPTKpRsrHyPAJkYF7b78iPf?usp=sharing
9
+ 2025-06-08 17:27:23,105 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
10
+ 2025-06-08 17:27:24,017 INFO src.preprocessing.gdrive_manager: Downloading file 1lmf1nOopxUxdJUWKd6Xq-OTAQdrWorIR to videos\Use case of Agent SDK.mp4
11
+ 2025-06-08 17:27:30,436 INFO src.preprocessing.gdrive_manager: Download 13%
12
+ 2025-06-08 17:27:36,502 INFO src.preprocessing.gdrive_manager: Download 27%
13
+ 2025-06-08 17:27:42,513 INFO src.preprocessing.gdrive_manager: Download 41%
14
+ 2025-06-08 17:27:48,578 INFO src.preprocessing.gdrive_manager: Download 54%
15
+ 2025-06-08 17:27:54,620 INFO src.preprocessing.gdrive_manager: Download 68%
16
+ 2025-06-08 17:28:00,367 INFO src.preprocessing.gdrive_manager: Download 82%
17
+ 2025-06-08 17:28:06,293 INFO src.preprocessing.gdrive_manager: Download 96%
18
+ 2025-06-08 17:28:09,762 INFO src.preprocessing.gdrive_manager: Download 100%
19
+ 2025-06-08 17:28:09,762 INFO src.preprocessing.gdrive_manager: Download complete: videos\Use case of Agent SDK.mp4
20
+ 2025-06-08 17:28:09,764 INFO src.preprocessing.download_manager: Downloaded: Use case of Agent SDK.mp4
21
+ 2025-06-08 17:28:09,764 INFO src.main_flow: Processing video: Use case of Agent SDK.mp4
22
+ 2025-06-08 17:28:13,704 INFO src.main_flow: Converted video to audio: audios\Use case of Agent SDK.wav
23
+ 2025-06-08 17:28:18,268 INFO src.preprocessing.gdrive_manager: Uploaded audios\Use case of Agent SDK.wav to Drive folder 1bLbSXaO3AS-EuBg_o7sGc8AonkHt7SdG
24
+ 2025-06-08 17:28:18,830 WARNING googleapiclient.http: Encountered 403 Forbidden with reason "insufficientFilePermissions"
25
+ 2025-06-08 17:28:18,831 ERROR src.preprocessing.gdrive_manager: An error occurred: <HttpError 403 when requesting https://www.googleapis.com/drive/v3/files/1lmf1nOopxUxdJUWKd6Xq-OTAQdrWorIR? returned "The user does not have sufficient permissions for this file.". Details: "[{'message': 'The user does not have sufficient permissions for this file.', 'domain': 'global', 'reason': 'insufficientFilePermissions'}]">
26
+ 2025-06-08 17:37:02,253 INFO src.main_flow: Initializing MainFlow with config: config/config.json
27
+ 2025-06-08 17:37:15,378 INFO src.main_flow: Initializing MainFlow with config: config/config.json
28
+ 2025-06-08 17:37:16,444 INFO src.main_flow: Initializing MainFlow with config: config/config.json
29
+ 2025-06-08 17:37:20,983 INFO src.main_flow: Initializing MainFlow with config: config/config.json
30
+ 2025-06-08 17:37:24,543 INFO src.main_flow: Initializing MainFlow with config: config/config.json
31
+ 2025-06-08 17:37:25,943 INFO src.main_flow: Initializing MainFlow with config: config/config.json
32
+ 2025-06-08 17:37:25,970 INFO src.main_flow: Processing Google Drive folder: https://drive.google.com/drive/folders/1angHYyiE_sPTKpRsrHyPAJkYF7b78iPf
33
+ 2025-06-08 17:37:26,192 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
34
+ 2025-06-08 17:37:27,055 INFO src.preprocessing.gdrive_manager: Downloading file 1lmf1nOopxUxdJUWKd6Xq-OTAQdrWorIR to videos\Use case of Agent SDK.mp4
35
+ 2025-06-08 17:37:34,060 INFO src.preprocessing.gdrive_manager: Download 13%
36
+ 2025-06-08 17:37:41,520 INFO src.preprocessing.gdrive_manager: Download 27%
37
+ 2025-06-08 17:37:48,595 INFO src.preprocessing.gdrive_manager: Download 41%
38
+ 2025-06-08 17:37:54,638 INFO src.preprocessing.gdrive_manager: Download 54%
39
+ 2025-06-08 17:38:29,171 INFO src.main_flow: Initializing MainFlow with config: config/config.json
40
+ 2025-06-08 17:38:50,946 INFO src.main_flow: Initializing MainFlow with config: config/config.json
41
+ 2025-06-08 17:38:54,122 INFO src.main_flow: Initializing MainFlow with config: config/config.json
42
+ 2025-06-08 17:38:58,463 INFO src.main_flow: Initializing MainFlow with config: config/config.json
43
+ 2025-06-08 17:39:04,578 INFO src.main_flow: Initializing MainFlow with config: config/config.json
44
+ 2025-06-08 17:39:06,168 INFO src.main_flow: Initializing MainFlow with config: config/config.json
45
+ 2025-06-08 17:39:06,193 INFO src.main_flow: Processing Google Drive folder: https://drive.google.com/drive/folders/1angHYyiE_sPTKpRsrHyPAJkYF7b78iPf?usp=sharing
46
+ 2025-06-08 17:39:06,425 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
47
+ 2025-06-08 17:39:07,316 INFO src.preprocessing.gdrive_manager: Downloading file 1lmf1nOopxUxdJUWKd6Xq-OTAQdrWorIR to videos\Use case of Agent SDK.mp4
48
+ 2025-06-08 17:39:13,427 INFO src.preprocessing.gdrive_manager: Download 13%
49
+ 2025-06-08 17:39:19,466 INFO src.preprocessing.gdrive_manager: Download 27%
50
+ 2025-06-08 17:39:25,895 INFO src.preprocessing.gdrive_manager: Download 41%
51
+ 2025-06-08 17:39:31,921 INFO src.preprocessing.gdrive_manager: Download 54%
52
+ 2025-06-08 17:39:37,980 INFO src.preprocessing.gdrive_manager: Download 68%
53
+ 2025-06-08 17:39:43,722 INFO src.preprocessing.gdrive_manager: Download 82%
54
+ 2025-06-08 17:39:49,857 INFO src.preprocessing.gdrive_manager: Download 96%
55
+ 2025-06-08 17:39:53,573 INFO src.preprocessing.gdrive_manager: Download 100%
56
+ 2025-06-08 17:39:53,574 INFO src.preprocessing.gdrive_manager: Download complete: videos\Use case of Agent SDK.mp4
57
+ 2025-06-08 17:39:53,575 INFO src.preprocessing.download_manager: Downloaded: Use case of Agent SDK.mp4
58
+ 2025-06-08 17:39:53,576 INFO src.main_flow: Processing video: Use case of Agent SDK.mp4
59
+ 2025-06-08 17:39:57,339 INFO src.main_flow: Converted video to audio: audios\Use case of Agent SDK.wav
60
+ 2025-06-08 17:40:05,307 INFO src.preprocessing.gdrive_manager: Uploaded audios\Use case of Agent SDK.wav to Drive folder 1bLbSXaO3AS-EuBg_o7sGc8AonkHt7SdG
61
+ 2025-06-08 17:40:05,813 WARNING googleapiclient.http: Encountered 403 Forbidden with reason "insufficientFilePermissions"
62
+ 2025-06-08 17:40:05,814 ERROR src.preprocessing.gdrive_manager: An error occurred: <HttpError 403 when requesting https://www.googleapis.com/drive/v3/files/1lmf1nOopxUxdJUWKd6Xq-OTAQdrWorIR? returned "The user does not have sufficient permissions for this file.". Details: "[{'message': 'The user does not have sufficient permissions for this file.', 'domain': 'global', 'reason': 'insufficientFilePermissions'}]">
63
+ 2025-06-08 17:49:38,100 INFO src.preprocessing.transcript_generator: Transcript saved to transcripts\Use case of Agent SDK.txt
64
+ 2025-06-08 17:49:38,109 INFO src.main_flow: Generated transcript: transcripts\Use case of Agent SDK.txt
65
+ 2025-06-08 17:49:40,243 INFO src.preprocessing.gdrive_manager: Uploaded transcripts\Use case of Agent SDK.txt to Drive folder 1TbqLgYXOguxYivMiy17s1UVqUKxpGtt3
66
+ 2025-06-08 17:49:41,240 INFO src.preprocessing.gdrive_manager: Deleted file 1OVvobHvzntShRprzt0L6OdW5eRFn2-xb from Drive
67
+ 2025-06-08 17:49:41,662 INFO src.preprocessing.gdrive_manager: Downloading file 1lmf1nOopxUxdJUWKd6Xq-OTAQdrWorIR to videos\Use case of Agent SDK.mp4
68
+ 2025-06-08 17:49:47,940 INFO src.preprocessing.gdrive_manager: Download 13%
69
+ 2025-06-08 17:49:53,844 INFO src.preprocessing.gdrive_manager: Download 27%
70
+ 2025-06-08 17:50:01,022 INFO src.preprocessing.gdrive_manager: Download 41%
71
+ 2025-06-08 17:50:07,310 INFO src.preprocessing.gdrive_manager: Download 54%
72
+ 2025-06-08 17:50:13,325 INFO src.preprocessing.gdrive_manager: Download 68%
73
+ 2025-06-08 17:50:19,681 INFO src.preprocessing.gdrive_manager: Download 82%
74
+ 2025-06-08 17:50:25,851 INFO src.preprocessing.gdrive_manager: Download 96%
75
+ 2025-06-08 17:50:29,724 INFO src.preprocessing.gdrive_manager: Download 100%
76
+ 2025-06-08 17:50:29,727 INFO src.preprocessing.gdrive_manager: Download complete: videos\Use case of Agent SDK.mp4
77
+ 2025-06-08 17:50:29,730 INFO src.preprocessing.download_manager: Downloaded: Use case of Agent SDK.mp4
78
+ 2025-06-08 17:50:29,731 INFO src.main_flow: Processing video: Use case of Agent SDK.mp4
79
+ 2025-06-08 17:50:35,469 INFO src.main_flow: Converted video to audio: audios\Use case of Agent SDK.wav
80
+ 2025-06-08 17:50:44,607 INFO src.preprocessing.gdrive_manager: Uploaded audios\Use case of Agent SDK.wav to Drive folder 1bLbSXaO3AS-EuBg_o7sGc8AonkHt7SdG
81
+ 2025-06-08 17:50:45,158 WARNING googleapiclient.http: Encountered 403 Forbidden with reason "insufficientFilePermissions"
82
+ 2025-06-08 17:50:45,159 ERROR src.preprocessing.gdrive_manager: An error occurred: <HttpError 403 when requesting https://www.googleapis.com/drive/v3/files/1lmf1nOopxUxdJUWKd6Xq-OTAQdrWorIR? returned "The user does not have sufficient permissions for this file.". Details: "[{'message': 'The user does not have sufficient permissions for this file.', 'domain': 'global', 'reason': 'insufficientFilePermissions'}]">
83
+ 2025-06-08 18:00:17,517 INFO src.preprocessing.transcript_generator: Transcript saved to transcripts\Use case of Agent SDK.txt
84
+ 2025-06-08 18:00:17,522 INFO src.main_flow: Generated transcript: transcripts\Use case of Agent SDK.txt
85
+ 2025-06-08 18:00:19,461 INFO src.preprocessing.gdrive_manager: Uploaded transcripts\Use case of Agent SDK.txt to Drive folder 1TbqLgYXOguxYivMiy17s1UVqUKxpGtt3
86
+ 2025-06-08 18:00:20,515 INFO src.preprocessing.gdrive_manager: Deleted file 1WIvxSHPx95N2bx4XFF4FIPtUnQhofasU from Drive
87
+ 2025-06-08 18:00:20,942 INFO src.preprocessing.gdrive_manager: Downloading file 1lmf1nOopxUxdJUWKd6Xq-OTAQdrWorIR to videos\Use case of Agent SDK.mp4
88
+ 2025-06-08 18:00:28,170 INFO src.preprocessing.gdrive_manager: Download 13%
89
+ 2025-06-08 18:00:35,470 INFO src.preprocessing.gdrive_manager: Download 27%
90
+ 2025-06-08 18:00:42,724 INFO src.preprocessing.gdrive_manager: Download 41%
91
+ 2025-06-08 18:00:49,442 INFO src.preprocessing.gdrive_manager: Download 54%
92
+ 2025-06-08 18:00:55,637 INFO src.preprocessing.gdrive_manager: Download 68%
93
+ 2025-06-08 18:01:02,125 INFO src.preprocessing.gdrive_manager: Download 82%
94
+ 2025-06-08 18:01:08,557 INFO src.preprocessing.gdrive_manager: Download 96%
95
+ 2025-06-08 18:01:12,266 INFO src.preprocessing.gdrive_manager: Download 100%
96
+ 2025-06-08 18:01:12,267 INFO src.preprocessing.gdrive_manager: Download complete: videos\Use case of Agent SDK.mp4
97
+ 2025-06-08 18:01:12,268 INFO src.preprocessing.download_manager: Downloaded: Use case of Agent SDK.mp4
98
+ 2025-06-08 18:01:12,269 INFO src.main_flow: Processing video: Use case of Agent SDK.mp4
99
+ 2025-06-08 18:01:16,407 INFO src.main_flow: Converted video to audio: audios\Use case of Agent SDK.wav
100
+ 2025-06-08 18:01:21,032 INFO src.preprocessing.gdrive_manager: Uploaded audios\Use case of Agent SDK.wav to Drive folder 1bLbSXaO3AS-EuBg_o7sGc8AonkHt7SdG
101
+ 2025-06-08 18:01:21,557 WARNING googleapiclient.http: Encountered 403 Forbidden with reason "insufficientFilePermissions"
102
+ 2025-06-08 18:01:21,558 ERROR src.preprocessing.gdrive_manager: An error occurred: <HttpError 403 when requesting https://www.googleapis.com/drive/v3/files/1lmf1nOopxUxdJUWKd6Xq-OTAQdrWorIR? returned "The user does not have sufficient permissions for this file.". Details: "[{'message': 'The user does not have sufficient permissions for this file.', 'domain': 'global', 'reason': 'insufficientFilePermissions'}]">
103
+ 2025-06-08 18:08:21,623 INFO src.main_flow: Initializing MainFlow with config: config/config.json
104
+ 2025-06-08 18:08:22,230 INFO src.main_flow: Initializing MainFlow with config: config/config.json
105
+ 2025-06-08 18:08:26,332 INFO src.main_flow: Initializing MainFlow with config: config/config.json
106
+ 2025-06-08 18:09:27,158 INFO src.main_flow: Initializing MainFlow with config: config/config.json
107
+ 2025-06-08 18:09:30,596 INFO src.main_flow: Initializing MainFlow with config: config/config.json
108
+ 2025-06-08 18:09:36,990 INFO src.main_flow: Initializing MainFlow with config: config/config.json
109
+ 2025-06-08 18:09:39,314 INFO src.main_flow: Initializing MainFlow with config: config/config.json
110
+ 2025-06-08 18:09:39,341 INFO src.main_flow: Processing Google Drive folder: https://drive.google.com/drive/folders/1angHYyiE_sPTKpRsrHyPAJkYF7b78iPf?usp=sharing
111
+ 2025-06-08 18:09:39,564 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
112
+ 2025-06-08 18:09:40,779 INFO src.preprocessing.gdrive_manager: Downloading file 1lmf1nOopxUxdJUWKd6Xq-OTAQdrWorIR to videos\Use case of Agent SDK.mp4
113
+ 2025-06-08 18:09:48,341 INFO src.preprocessing.gdrive_manager: Download 13%
114
+ 2025-06-08 18:09:54,815 INFO src.preprocessing.gdrive_manager: Download 27%
115
+ 2025-06-08 18:10:01,854 INFO src.preprocessing.gdrive_manager: Download 41%
116
+ 2025-06-08 18:10:08,034 INFO src.preprocessing.gdrive_manager: Download 54%
117
+ 2025-06-08 18:10:14,353 INFO src.preprocessing.gdrive_manager: Download 68%
118
+ 2025-06-08 18:10:20,880 INFO src.preprocessing.gdrive_manager: Download 82%
119
+ 2025-06-08 18:10:26,969 INFO src.preprocessing.gdrive_manager: Download 96%
120
+ 2025-06-08 18:10:30,770 INFO src.preprocessing.gdrive_manager: Download 100%
121
+ 2025-06-08 18:10:30,771 INFO src.preprocessing.gdrive_manager: Download complete: videos\Use case of Agent SDK.mp4
122
+ 2025-06-08 18:10:30,772 INFO src.main_flow: Downloaded: Use case of Agent SDK.mp4
123
+ 2025-06-08 18:10:34,935 INFO src.main_flow: Converted video to audio: audios\Use case of Agent SDK.wav
124
+ 2025-06-08 18:10:39,644 INFO src.preprocessing.gdrive_manager: Uploaded audios\Use case of Agent SDK.wav to Drive folder 1bLbSXaO3AS-EuBg_o7sGc8AonkHt7SdG
125
+ 2025-06-08 18:10:40,151 WARNING googleapiclient.http: Encountered 403 Forbidden with reason "insufficientFilePermissions"
126
+ 2025-06-08 18:10:40,151 ERROR src.preprocessing.gdrive_manager: An error occurred: <HttpError 403 when requesting https://www.googleapis.com/drive/v3/files/1lmf1nOopxUxdJUWKd6Xq-OTAQdrWorIR? returned "The user does not have sufficient permissions for this file.". Details: "[{'message': 'The user does not have sufficient permissions for this file.', 'domain': 'global', 'reason': 'insufficientFilePermissions'}]">
127
+ 2025-06-08 18:20:12,037 INFO src.preprocessing.transcript_generator: Transcript saved to transcripts\Use case of Agent SDK.txt
128
+ 2025-06-08 18:20:12,262 INFO src.main_flow: Generated transcript: transcripts\Use case of Agent SDK.txt
129
+ 2025-06-08 18:20:14,382 INFO src.preprocessing.gdrive_manager: Uploaded transcripts\Use case of Agent SDK.txt to Drive folder 1TbqLgYXOguxYivMiy17s1UVqUKxpGtt3
130
+ 2025-06-08 18:20:15,400 INFO src.preprocessing.gdrive_manager: Deleted file 1BMBHClP2MjbnQg-3jI0DldLo66plM5eU from Drive
131
+ 2025-06-08 18:20:15,409 INFO src.preprocessing.gdrive_manager: Downloading file 1cxXlHB38p3oBm1cEr4LWqyzMDQqRj3VJ to videos\Working of Agent SDK.mp4
132
+ 2025-06-08 18:20:22,045 INFO src.preprocessing.gdrive_manager: Download 100%
133
+ 2025-06-08 18:20:22,046 INFO src.preprocessing.gdrive_manager: Download complete: videos\Working of Agent SDK.mp4
134
+ 2025-06-08 18:20:22,047 INFO src.main_flow: Downloaded: Working of Agent SDK.mp4
135
+ 2025-06-08 18:20:22,624 INFO src.main_flow: Converted video to audio: audios\Working of Agent SDK.wav
136
+ 2025-06-08 18:20:25,332 INFO src.preprocessing.gdrive_manager: Uploaded audios\Working of Agent SDK.wav to Drive folder 1bLbSXaO3AS-EuBg_o7sGc8AonkHt7SdG
137
+ 2025-06-08 18:20:25,863 WARNING googleapiclient.http: Encountered 403 Forbidden with reason "insufficientFilePermissions"
138
+ 2025-06-08 18:20:25,865 ERROR src.preprocessing.gdrive_manager: An error occurred: <HttpError 403 when requesting https://www.googleapis.com/drive/v3/files/1cxXlHB38p3oBm1cEr4LWqyzMDQqRj3VJ? returned "The user does not have sufficient permissions for this file.". Details: "[{'message': 'The user does not have sufficient permissions for this file.', 'domain': 'global', 'reason': 'insufficientFilePermissions'}]">
139
+ 2025-06-08 18:20:57,038 INFO src.preprocessing.transcript_generator: Transcript saved to transcripts\Working of Agent SDK.txt
140
+ 2025-06-08 18:20:57,433 INFO src.main_flow: Generated transcript: transcripts\Working of Agent SDK.txt
141
+ 2025-06-08 18:20:59,342 INFO src.preprocessing.gdrive_manager: Uploaded transcripts\Working of Agent SDK.txt to Drive folder 1TbqLgYXOguxYivMiy17s1UVqUKxpGtt3
142
+ 2025-06-08 18:21:00,515 INFO src.preprocessing.gdrive_manager: Deleted file 1h87GpnkRFs8flu5PVticplmIFa2IXsTH from Drive
143
+ 2025-06-08 18:21:00,517 INFO src.preprocessing.gdrive_manager: Downloading file 1LeCsQBqZLrGFTOLzNCOV57RDO5nZWqfS to videos\Overview and Key Components of Agent SDK.mp4
144
+ 2025-06-08 18:21:10,786 INFO src.preprocessing.gdrive_manager: Download 77%
145
+ 2025-06-08 18:21:14,307 INFO src.preprocessing.gdrive_manager: Download 100%
146
+ 2025-06-08 18:21:14,307 INFO src.preprocessing.gdrive_manager: Download complete: videos\Overview and Key Components of Agent SDK.mp4
147
+ 2025-06-08 18:21:14,308 INFO src.main_flow: Downloaded: Overview and Key Components of Agent SDK.mp4
148
+ 2025-06-08 18:21:15,609 INFO src.main_flow: Converted video to audio: audios\Overview and Key Components of Agent SDK.wav
149
+ 2025-06-08 18:21:18,413 INFO src.preprocessing.gdrive_manager: Uploaded audios\Overview and Key Components of Agent SDK.wav to Drive folder 1bLbSXaO3AS-EuBg_o7sGc8AonkHt7SdG
150
+ 2025-06-08 18:21:18,942 WARNING googleapiclient.http: Encountered 403 Forbidden with reason "insufficientFilePermissions"
151
+ 2025-06-08 18:21:18,943 ERROR src.preprocessing.gdrive_manager: An error occurred: <HttpError 403 when requesting https://www.googleapis.com/drive/v3/files/1LeCsQBqZLrGFTOLzNCOV57RDO5nZWqfS? returned "The user does not have sufficient permissions for this file.". Details: "[{'message': 'The user does not have sufficient permissions for this file.', 'domain': 'global', 'reason': 'insufficientFilePermissions'}]">
152
+ 2025-06-08 18:23:10,783 INFO src.preprocessing.transcript_generator: Transcript saved to transcripts\Overview and Key Components of Agent SDK.txt
153
+ 2025-06-08 18:23:10,804 INFO src.main_flow: Generated transcript: transcripts\Overview and Key Components of Agent SDK.txt
154
+ 2025-06-08 18:23:13,212 INFO src.preprocessing.gdrive_manager: Uploaded transcripts\Overview and Key Components of Agent SDK.txt to Drive folder 1TbqLgYXOguxYivMiy17s1UVqUKxpGtt3
155
+ 2025-06-08 18:23:14,602 INFO src.preprocessing.gdrive_manager: Deleted file 1SZZWmURjm3CCmUp4UKLsh_7KIdN8CYSS from Drive
156
+ 2025-06-08 18:23:15,609 INFO src.main_flow: Processing mentor materials...
157
+ 2025-06-08 18:23:15,678 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
158
+ 2025-06-08 18:23:19,895 INFO src.preprocessing.gdrive_manager: Uploaded mentor_materials\Agent SDK_V1_24-04-25.txt to Drive folder 1OVhmzLD5NHmrHknSSWwAYC_NVlD39-sh
159
+ 2025-06-08 18:23:19,982 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
160
+ 2025-06-08 18:23:22,500 INFO src.preprocessing.gdrive_manager: Uploaded mentor_materials\Agent_SDK_+_Google_SDK.txt to Drive folder 1OVhmzLD5NHmrHknSSWwAYC_NVlD39-sh
161
+ 2025-06-08 18:23:24,506 INFO src.main_flow: Generating quality reports...
162
+ 2025-06-08 18:23:24,532 INFO src.report_generation.report_generator: Generating report for: Overview and Key Components of Agent SDK
163
+ 2025-06-08 18:23:29,489 INFO httpx: HTTP Request: POST https://tst123451307193883.openai.azure.com//openai/deployments/gpt-4o-mini/chat/completions?api-version=2025-01-01-preview "HTTP/1.1 200 OK"
164
+ 2025-06-08 18:23:29,496 INFO src.report_generation.report_generator: Report saved to reports\report_Overview and Key Components of Agent SDK.txt
165
+ 2025-06-08 18:23:31,497 INFO src.report_generation.report_generator: Generating report for: Use case of Agent SDK
166
+ 2025-06-08 18:23:36,063 INFO httpx: HTTP Request: POST https://tst123451307193883.openai.azure.com//openai/deployments/gpt-4o-mini/chat/completions?api-version=2025-01-01-preview "HTTP/1.1 200 OK"
167
+ 2025-06-08 18:23:36,066 INFO src.report_generation.report_generator: Report saved to reports\report_Use case of Agent SDK.txt
168
+ 2025-06-08 18:23:38,070 INFO src.report_generation.report_generator: Generating report for: Working of Agent SDK
169
+ 2025-06-08 18:23:44,521 INFO httpx: HTTP Request: POST https://tst123451307193883.openai.azure.com//openai/deployments/gpt-4o-mini/chat/completions?api-version=2025-01-01-preview "HTTP/1.1 200 OK"
170
+ 2025-06-08 18:23:44,526 INFO src.report_generation.report_generator: Report saved to reports\report_Working of Agent SDK.txt
171
+ 2025-06-08 18:23:46,633 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
172
+ 2025-06-08 18:23:49,116 INFO src.preprocessing.gdrive_manager: Uploaded reports\report_Overview and Key Components of Agent SDK.txt to Drive folder 1JgwDdQVc1YsyKNhag5l1PdD607vMjy1H
173
+ 2025-06-08 18:23:50,927 INFO src.preprocessing.gdrive_manager: Uploaded reports\report_Use case of Agent SDK.txt to Drive folder 1JgwDdQVc1YsyKNhag5l1PdD607vMjy1H
174
+ 2025-06-08 18:23:53,100 INFO src.preprocessing.gdrive_manager: Uploaded reports\report_Working of Agent SDK.txt to Drive folder 1JgwDdQVc1YsyKNhag5l1PdD607vMjy1H
175
+ 2025-06-08 18:50:48,799 INFO src.main_flow: Initializing MainFlow with config: config/config.json
176
+ 2025-06-08 18:50:48,799 INFO src.main_flow: Initializing MainFlow with config: config/config.json
177
+ 2025-06-08 18:50:52,608 INFO src.main_flow: Initializing MainFlow with config: config/config.json
178
+ 2025-06-08 18:50:57,758 INFO src.main_flow: Initializing MainFlow with config: config/config.json
179
+ 2025-06-08 18:51:00,362 INFO src.main_flow: Initializing MainFlow with config: config/config.json
180
+ 2025-06-08 18:51:04,124 INFO src.main_flow: Initializing MainFlow with config: config/config.json
181
+ 2025-06-08 18:51:05,284 INFO src.main_flow: Initializing MainFlow with config: config/config.json
182
+ 2025-06-08 18:51:05,302 INFO src.main_flow: Processing mentor materials...
183
+ 2025-06-08 18:51:05,577 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
184
+ 2025-06-08 18:51:08,061 INFO src.preprocessing.gdrive_manager: Uploaded mentor_materials\Agent SDK_V1_24-04-25.txt to Drive folder 1OVhmzLD5NHmrHknSSWwAYC_NVlD39-sh
185
+ 2025-06-08 18:51:08,374 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
186
+ 2025-06-08 18:51:10,776 INFO src.preprocessing.gdrive_manager: Uploaded mentor_materials\Agent_SDK_+_Google_SDK.txt to Drive folder 1OVhmzLD5NHmrHknSSWwAYC_NVlD39-sh
187
+ 2025-06-08 18:51:11,792 INFO src.main_flow: Processing Google Drive folder: https://drive.google.com/drive/folders/1angHYyiE_sPTKpRsrHyPAJkYF7b78iPf?usp=sharing
188
+ 2025-06-08 18:51:12,074 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
189
+ 2025-06-08 18:51:13,344 INFO src.main_flow: Transcript for Use case of Agent SDK already exists in Drive. Skipping video.
190
+ 2025-06-08 18:51:13,345 INFO src.main_flow: Transcript for Working of Agent SDK already exists in Drive. Skipping video.
191
+ 2025-06-08 18:51:13,346 INFO src.main_flow: Transcript for Overview and Key Components of Agent SDK already exists in Drive. Skipping video.
192
+ 2025-06-08 18:51:15,413 INFO src.main_flow: Generating quality reports...
193
+ 2025-06-08 18:51:15,480 INFO src.report_generation.report_generator: Generating report for: Overview and Key Components of Agent SDK
194
+ 2025-06-08 18:51:20,062 INFO httpx: HTTP Request: POST https://tst123451307193883.openai.azure.com//openai/deployments/gpt-4o-mini/chat/completions?api-version=2025-01-01-preview "HTTP/1.1 200 OK"
195
+ 2025-06-08 18:51:20,069 INFO src.report_generation.report_generator: Report saved to reports\report_Overview and Key Components of Agent SDK.txt
196
+ 2025-06-08 18:51:22,075 INFO src.report_generation.report_generator: Generating report for: Use case of Agent SDK
197
+ 2025-06-08 18:51:26,277 INFO httpx: HTTP Request: POST https://tst123451307193883.openai.azure.com//openai/deployments/gpt-4o-mini/chat/completions?api-version=2025-01-01-preview "HTTP/1.1 200 OK"
198
+ 2025-06-08 18:51:26,281 INFO src.report_generation.report_generator: Report saved to reports\report_Use case of Agent SDK.txt
199
+ 2025-06-08 18:51:28,284 INFO src.report_generation.report_generator: Generating report for: Working of Agent SDK
200
+ 2025-06-08 18:51:33,604 INFO httpx: HTTP Request: POST https://tst123451307193883.openai.azure.com//openai/deployments/gpt-4o-mini/chat/completions?api-version=2025-01-01-preview "HTTP/1.1 200 OK"
201
+ 2025-06-08 18:51:33,607 INFO src.report_generation.report_generator: Report saved to reports\report_Working of Agent SDK.txt
202
+ 2025-06-08 18:51:35,670 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
203
+ 2025-06-08 18:51:37,987 INFO src.preprocessing.gdrive_manager: Uploaded reports\report_Overview and Key Components of Agent SDK.txt to Drive folder 1JgwDdQVc1YsyKNhag5l1PdD607vMjy1H
204
+ 2025-06-08 18:51:40,428 INFO src.preprocessing.gdrive_manager: Uploaded reports\report_Use case of Agent SDK.txt to Drive folder 1JgwDdQVc1YsyKNhag5l1PdD607vMjy1H
205
+ 2025-06-08 18:51:42,394 INFO src.preprocessing.gdrive_manager: Uploaded reports\report_Working of Agent SDK.txt to Drive folder 1JgwDdQVc1YsyKNhag5l1PdD607vMjy1H
206
+ 2025-06-08 18:53:06,984 INFO src.main_flow: Initializing MainFlow with config: config/config.json
207
+ 2025-06-08 18:53:06,985 INFO src.main_flow: Initializing MainFlow with config: config/config.json
208
+ 2025-06-08 18:53:06,984 INFO src.main_flow: Initializing MainFlow with config: config/config.json
209
+ 2025-06-08 18:53:09,515 INFO src.main_flow: Initializing MainFlow with config: config/config.json
210
+ 2025-06-08 18:53:13,865 INFO src.main_flow: Initializing MainFlow with config: config/config.json
211
+ 2025-06-08 18:53:16,430 INFO src.main_flow: Initializing MainFlow with config: config/config.json
212
+ 2025-06-08 18:53:20,224 INFO src.main_flow: Initializing MainFlow with config: config/config.json
213
+ 2025-06-08 18:53:21,497 INFO src.main_flow: Initializing MainFlow with config: config/config.json
214
+ 2025-06-08 18:53:21,581 INFO src.main_flow: Processing mentor materials...
215
+ 2025-06-08 18:53:22,202 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
216
+ 2025-06-08 18:53:24,622 INFO src.preprocessing.gdrive_manager: Uploaded mentor_materials\Agent SDK_V1_24-04-25.txt to Drive folder 1OVhmzLD5NHmrHknSSWwAYC_NVlD39-sh
217
+ 2025-06-08 18:53:25,001 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
218
+ 2025-06-08 18:53:27,236 INFO src.preprocessing.gdrive_manager: Uploaded mentor_materials\Agent_SDK_+_Google_SDK.txt to Drive folder 1OVhmzLD5NHmrHknSSWwAYC_NVlD39-sh
219
+ 2025-06-08 18:53:28,270 INFO src.main_flow: Processing Google Drive folder: https://drive.google.com/drive/folders/1angHYyiE_sPTKpRsrHyPAJkYF7b78iPf?usp=sharing
220
+ 2025-06-08 18:53:28,378 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
221
+ 2025-06-08 18:53:29,666 INFO src.main_flow: Transcript for Use case of Agent SDK already exists in Drive. Skipping video.
222
+ 2025-06-08 18:53:29,668 INFO src.main_flow: Transcript for Working of Agent SDK already exists in Drive. Skipping video.
223
+ 2025-06-08 18:53:29,668 INFO src.main_flow: Transcript for Overview and Key Components of Agent SDK already exists in Drive. Skipping video.
224
+ 2025-06-08 18:53:31,675 INFO src.main_flow: Generating quality reports...
225
+ 2025-06-08 18:53:31,709 INFO src.report_generation.report_generator: Generating report for: Overview and Key Components of Agent SDK
226
+ 2025-06-08 18:53:37,017 INFO httpx: HTTP Request: POST https://tst123451307193883.openai.azure.com//openai/deployments/gpt-4o-mini/chat/completions?api-version=2025-01-01-preview "HTTP/1.1 200 OK"
227
+ 2025-06-08 18:53:37,022 INFO src.report_generation.report_generator: Report saved to reports\report_Overview and Key Components of Agent SDK.txt
228
+ 2025-06-08 18:53:39,025 INFO src.report_generation.report_generator: Generating report for: Use case of Agent SDK
229
+ 2025-06-08 18:53:42,574 INFO httpx: HTTP Request: POST https://tst123451307193883.openai.azure.com//openai/deployments/gpt-4o-mini/chat/completions?api-version=2025-01-01-preview "HTTP/1.1 200 OK"
230
+ 2025-06-08 18:53:42,576 INFO src.report_generation.report_generator: Report saved to reports\report_Use case of Agent SDK.txt
231
+ 2025-06-08 18:53:44,580 INFO src.report_generation.report_generator: Generating report for: Working of Agent SDK
232
+ 2025-06-08 18:53:49,005 INFO httpx: HTTP Request: POST https://tst123451307193883.openai.azure.com//openai/deployments/gpt-4o-mini/chat/completions?api-version=2025-01-01-preview "HTTP/1.1 200 OK"
233
+ 2025-06-08 18:53:49,008 INFO src.report_generation.report_generator: Report saved to reports\report_Working of Agent SDK.txt
234
+ 2025-06-08 18:53:51,061 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
235
+ 2025-06-08 18:53:53,301 INFO src.preprocessing.gdrive_manager: Uploaded reports\report_Overview and Key Components of Agent SDK.txt to Drive folder 1JgwDdQVc1YsyKNhag5l1PdD607vMjy1H
236
+ 2025-06-08 18:53:55,368 INFO src.preprocessing.gdrive_manager: Uploaded reports\report_Use case of Agent SDK.txt to Drive folder 1JgwDdQVc1YsyKNhag5l1PdD607vMjy1H
237
+ 2025-06-08 18:53:57,568 INFO src.preprocessing.gdrive_manager: Uploaded reports\report_Working of Agent SDK.txt to Drive folder 1JgwDdQVc1YsyKNhag5l1PdD607vMjy1H
238
+ 2025-06-08 18:53:58,629 INFO googleapiclient.discovery_cache: file_cache is only supported with oauth2client<4.0.0
reports/report_Overview and Key Components of Agent SDK.txt ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1a: [✅] The transcript covers the topic of the agent SDK and its key components, including goals, tools, memory, and the reasoning loop.
2
+
3
+ 1b: [✅] Concepts are introduced in a structured manner, starting from the introduction of the agent SDK to its components and examples.
4
+
5
+ 1c: [✅] All statements appear to be technically correct and relevant to the topic discussed.
6
+
7
+ 1d: [✅] Relevant examples are provided, such as the interaction between the user and the AI agent regarding AI trends.
8
+
9
+ 2a: [N/A] There are no code demonstrations in the transcript.
10
+
11
+ 2b: [N/A] There are no code components to explain in the transcript.
12
+
13
+ 2c: [N/A] No libraries or tools are explicitly mentioned in a coding context.
14
+
15
+ 2d: [N/A] There are no code outputs to validate in the transcript.
16
+
17
+ 2e: [N/A] There are no hands-on activities mentioned.
18
+
19
+ 3a: [✅] The speech is coherent and the pacing is appropriate for understanding.
20
+
21
+ 3b: [✅] There are minimal filler words present in the transcript.
22
+
23
+ 3c: [✅] Technical terms are pronounced clearly in the context of the transcript.
24
+
25
+ 3d: [✅] The language used is formal and academic.
26
+
27
+ 3e: [✅] There are no inappropriate or biased statements present.
28
+
29
+ 4a: [✅] The spoken content follows the logical order of the topics discussed.
30
+
31
+ 5a: [❌] There are no explicit calls to action or prompts for reflection included in the transcript.
32
+
33
+ 5b: [❌] The transcript does not include rhetorical questions to engage learners.
34
+
35
+ 5c: [❌] There is no encouragement for feedback or queries from learners.
36
+
37
+ 6a: [✅] The introduction sets the context clearly for the discussion on agent SDK.
38
+
39
+ 6b: [✅] Transitions between sections are clear and logical.
40
+
41
+ 7a: [✅] The tone is encouraging and positive throughout the transcript.
42
+
43
+ 7b: [✅] The language used is inclusive and gender-neutral.
44
+
45
+ 8a: [✅] The pacing of the discussion appears to match the time markers provided.
46
+
47
+ What Went Wrong:
48
+ - Lack of engagement prompts for learners.
49
+ - No rhetorical questions or invitations for feedback.
50
+
51
+ How to Improve:
52
+ - Include calls to action or prompts for learners to reflect on the content.
53
+ - Add rhetorical questions to engage the audience and encourage interaction.
reports/report_Use case of Agent SDK.txt ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1a: [✅] The transcript covers the main topic of building an AI agent using Google SDK and Agent SDK, including subtopics such as API key generation and memory storage.
2
+
3
+ 1b: [✅] Concepts are introduced in a logical order, starting from the problem statement to the coding process and enhancements.
4
+
5
+ 1c: [✅] All statements appear to be technically correct, with no evident conceptual inaccuracies.
6
+
7
+ 1d: [✅] Relevant examples are provided, such as the specific search query used to demonstrate the AI agent's functionality.
8
+
9
+ 2a: [✅] Code demonstrations are explained clearly, detailing the steps taken in the coding process.
10
+
11
+ 2b: [✅] The explanation of code components, such as API keys and search engine IDs, is thorough.
12
+
13
+ 2c: [✅] All libraries and tools used, such as Google API Python client and OpenAI API, are explicitly named and explained.
14
+
15
+ 2d: [✅] Expected outputs are described, including the results returned by the AI agent.
16
+
17
+ 2e: [✅] The pacing of the hands-on activities is appropriate for learners to follow along.
18
+
19
+ 3a: [✅] The speech is coherent and paced well, making it easy to understand.
20
+
21
+ 3b: [✅] There is minimal use of filler words throughout the transcript.
22
+
23
+ 3c: [✅] Technical terms are pronounced clearly, aiding comprehension.
24
+
25
+ 3d: [✅] The language used is formal and respectful, suitable for an academic setting.
26
+
27
+ 3e: [✅] There are no inappropriate or biased statements present.
28
+
29
+ 4a: [✅] The spoken content follows the logical sequence of the topics discussed.
30
+
31
+ 5a: [✅] There are prompts for learners to try things themselves, such as downloading the code.
32
+
33
+ 5b: [✅] Rhetorical questions are included to engage learners, enhancing interactivity.
34
+
35
+ 5c: [✅] The speaker encourages feedback and questions, promoting learner engagement.
36
+
37
+ 6a: [✅] The session begins with a clear introduction that sets the context for the topic.
38
+
39
+ 6b: [✅] Clear transitions between sections are indicated, helping maintain flow.
40
+
41
+ 7a: [✅] The tone is encouraging and positive, motivating learners throughout the session.
42
+
43
+ 7b: [✅] The language is inclusive and gender-neutral, accommodating diverse backgrounds.
44
+
45
+ 8a: [✅] The pacing of the session aligns with the time markers mentioned.
46
+
47
+ What Went Wrong:
48
+ - None identified.
49
+
50
+ How to Improve:
51
+ - None identified.
reports/report_Working of Agent SDK.txt ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1a: [✅] The topic of how the agent SDK works is mentioned and explained, focusing on its functionality and process.
2
+ 1b: [✅] The explanation follows a logical order, starting from setting a goal to the output display.
3
+ 1c: [✅] All statements regarding the agent SDK's operation are technically correct.
4
+ 1d: [✅] An example of adding two numbers in Python is provided, which helps clarify the concept.
5
+
6
+ 2a: [❌] There is no code demonstration provided in the transcript.
7
+ 2b: [N/A] Not applicable as there is no code walkthrough.
8
+ 2c: [N/A] Not applicable as there is no code demonstration.
9
+ 2d: [N/A] Not applicable as there is no code demonstration.
10
+ 2e: [N/A] Not applicable as there is no code demonstration.
11
+
12
+ 3a: [✅] The speech is coherent and understandable.
13
+ 3b: [✅] There are minimal filler words present.
14
+ 3c: [✅] Technical terms are pronounced clearly.
15
+ 3d: [✅] The language used is formal and respectful.
16
+ 3e: [✅] There are no inappropriate or biased statements.
17
+
18
+ 4a: [✅] The spoken content aligns with the logical flow of the topic discussed.
19
+
20
+ 5a: [❌] There are no prompts for learner engagement or calls to action.
21
+ 5b: [❌] No rhetorical questions are included to engage learners.
22
+ 5c: [❌] There is no invitation for feedback or queries from learners.
23
+
24
+ 6a: [✅] The introduction sets the context for the discussion about the agent SDK.
25
+ 6b: [✅] Transitions between concepts are clear and logical.
26
+
27
+ 7a: [✅] The tone is encouraging and positive throughout the explanation.
28
+ 7b: [✅] The language used is inclusive and gender-neutral.
29
+
30
+ 8a: [✅] The pacing of the discussion appears to match the time markers provided.
31
+ 8b: [N/A] Not applicable as there are no specific time management indicators mentioned.
32
+
33
+ What Went Wrong:
34
+ - Lack of code demonstration and explanation of code components.
35
+ - No engagement prompts or questions to involve learners.
36
+
37
+ How to Improve:
38
+ - Include a code demonstration with clear explanations of components and expected outputs.
39
+ - Add engagement prompts, such as questions or calls to action, to encourage learner interaction.
requirements.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ streamlit
2
+ python-dotenv
3
+ azure-cognitiveservices-speech
4
+ openai
5
+ nbformat
6
+ python-pptx
7
+ ffmpeg-python
8
+ google-auth
9
+ google-api-python-client
10
+ google-auth-httplib2
11
+ google-auth-oauthlib
src/__init__.py ADDED
File without changes
src/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (139 Bytes). View file
 
src/__pycache__/main_flow.cpython-312.pyc ADDED
Binary file (11.8 kB). View file
 
src/main_flow.py ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # src/main_flow.py
2
+ from src.preprocessing.gdrive_manager import GoogleDriveManager
3
+ from src.preprocessing.download_manager import GoogleDriveDownloader
4
+ from src.preprocessing.video_processor import VideoProcessor
5
+ from src.preprocessing.transcript_generator import TranscriptGenerator
6
+ from src.preprocessing.file_processor import FileProcessor
7
+ from src.report_generation.openai_client import OpenAIClient
8
+ from src.report_generation.report_generator import ReportGenerator
9
+ import json
10
+ import os
11
+ import glob
12
+ import asyncio
13
+ import logging
14
+ import tempfile
15
+ import shutil
16
+ import googleapiclient.errors
17
+
18
+ logger = logging.getLogger(__name__)
19
+
20
+ class MainFlow:
21
+ def __init__(self, config_path: str):
22
+ logger.info("Initializing MainFlow with config: %s", config_path)
23
+ with open(config_path) as f:
24
+ self.config = json.load(f)
25
+ self.paths = self.config["PATHS"]
26
+ self.drive_folders = {
27
+ "VIDEOS": "1angHYyiE_sPTKpRsrHyPAJkYF7b78iPf",
28
+ "AUDIOS": "1bLbSXaO3AS-EuBg_o7sGc8AonkHt7SdG",
29
+ "TRANSCRIPTS": "1TbqLgYXOguxYivMiy17s1UVqUKxpGtt3",
30
+ "REPORTS": "1JgwDdQVc1YsyKNhag5l1PdD607vMjy1H",
31
+ "MENTOR_MATERIALS": "1OVhmzLD5NHmrHknSSWwAYC_NVlD39-sh"
32
+ }
33
+ self._create_directories()
34
+
35
+ def _create_directories(self):
36
+ for path in self.paths.values():
37
+ os.makedirs(path, exist_ok=True)
38
+
39
+ async def process_drive_url(self, folder_url: str):
40
+ logger.info("Processing Google Drive folder: %s", folder_url)
41
+ VideoProcessor.clean_directory(self.paths["VIDEOS"])
42
+ VideoProcessor.clean_directory(self.paths["AUDIOS"])
43
+ download_manager = GoogleDriveDownloader(self.paths["VIDEOS"], self.drive_folders)
44
+ gdrive = download_manager.gdrive
45
+
46
+ # Get all video files in Drive
47
+ video_files = download_manager.list_all_videos(folder_url)
48
+ if not video_files:
49
+ logger.warning("No videos to process in folder: %s", folder_url)
50
+ return
51
+
52
+ # Get all transcript files in Drive Transcripts folder
53
+ transcript_drive_files = gdrive.list_txt_files(self.drive_folders["TRANSCRIPTS"])
54
+ transcript_names = {os.path.splitext(f['name'])[0] for f in transcript_drive_files}
55
+
56
+ for video in video_files:
57
+ base_name = os.path.splitext(video['name'])[0]
58
+ if base_name in transcript_names:
59
+ logger.info(f"Transcript for {base_name} already exists in Drive. Skipping video.")
60
+ continue
61
+
62
+ # Download and process this video
63
+ local_video_path = os.path.join(self.paths["VIDEOS"], video['name'])
64
+ gdrive.download_file(video['id'], local_video_path)
65
+ logger.info(f"Downloaded: {video['name']}")
66
+ video_id = video['id']
67
+ video_name = video['name']
68
+ video_path = local_video_path
69
+ audio_path = os.path.join(self.paths["AUDIOS"], f"{base_name}.wav")
70
+ transcript_path = os.path.join(self.paths["TRANSCRIPTS"], f"{base_name}.txt")
71
+
72
+ video_processor = VideoProcessor()
73
+ transcript_generator = TranscriptGenerator(
74
+ os.getenv("AZURE_SPEECH_KEY"),
75
+ os.getenv("AZURE_SPEECH_REGION")
76
+ )
77
+
78
+ try:
79
+ # Convert video to audio
80
+ if video_processor.convert_mp4_to_wav(video_path, audio_path):
81
+ logger.info("Converted video to audio: %s", audio_path)
82
+ # Upload audio to Drive
83
+ download_manager.upload_to_drive(audio_path, "AUDIOS", "audio/wav")
84
+ # Delete video from Drive and local
85
+ try:
86
+ download_manager.delete_drive_file(video_id)
87
+ except googleapiclient.errors.HttpError as e:
88
+ if e.resp.status == 403:
89
+ logger.warning(f"Skipping delete for {video_name} due to insufficient permissions.")
90
+ else:
91
+ logger.error(f"Error deleting video from Drive: {e}")
92
+ try:
93
+ os.remove(video_path)
94
+ except Exception as e:
95
+ logger.warning(f"Could not delete local video file: {e}")
96
+
97
+ # Generate transcript
98
+ if transcript_generator.transcribe_audio(audio_path, transcript_path):
99
+ logger.info(f"Generated transcript: {transcript_path}")
100
+ # Upload transcript to Drive
101
+ download_manager.upload_to_drive(transcript_path, "TRANSCRIPTS", "text/plain")
102
+ # Delete audio from Drive and local
103
+ audio_drive_id = gdrive.find_file_by_name(self.drive_folders["AUDIOS"], f"{base_name}.wav")
104
+ if audio_drive_id:
105
+ try:
106
+ download_manager.delete_drive_file(audio_drive_id)
107
+ except googleapiclient.errors.HttpError as e:
108
+ if e.resp.status == 403:
109
+ logger.warning(f"Skipping delete for audio {base_name}.wav due to insufficient permissions.")
110
+ else:
111
+ logger.error(f"Error deleting audio from Drive: {e}")
112
+ try:
113
+ os.remove(audio_path)
114
+ except Exception as e:
115
+ logger.warning(f"Could not delete local audio file: {e}")
116
+ else:
117
+ logger.error(f"Failed to generate transcript for {video_name}")
118
+ else:
119
+ logger.error(f"Failed to convert video: {video_name}")
120
+ except googleapiclient.errors.HttpError as e:
121
+ if e.resp.status == 403:
122
+ logger.warning(f"Skipping file {video_name} due to insufficient permissions.")
123
+ else:
124
+ logger.error(f"Google API error: {e}")
125
+ except Exception as e:
126
+ logger.error(f"Unexpected error processing {video_name}: {e}")
127
+
128
+ def process_mentor_materials(self, files: dict):
129
+ """Process mentor materials (PPTX/IPYNB)"""
130
+ logger.info("Processing mentor materials...")
131
+ processed_files = []
132
+
133
+ # Clean directory first
134
+ VideoProcessor.clean_directory(self.paths["MENTOR_MATERIALS"])
135
+
136
+ for file_type, file_data in files.items():
137
+ if not file_data:
138
+ continue
139
+
140
+ # Save uploaded file
141
+ file_path = os.path.join(self.paths["MENTOR_MATERIALS"], file_data.name)
142
+ with open(file_path, "wb") as f:
143
+ f.write(file_data.getbuffer())
144
+
145
+ # Process based on file type
146
+ base_name = os.path.splitext(file_data.name)[0]
147
+ output_path = os.path.join(self.paths["MENTOR_MATERIALS"], f"{base_name}.txt")
148
+
149
+ if file_type == "slides" and file_path.lower().endswith(('.pptx', '.ppt')):
150
+ content = FileProcessor.process_slide_file(file_path)
151
+ elif file_type == "notebook" and file_path.lower().endswith('.ipynb'):
152
+ content = FileProcessor.process_notebook_file(file_path)
153
+ else:
154
+ logger.error(f"Unsupported file type: {file_data.name}")
155
+ continue
156
+
157
+ # Save processed content
158
+ with open(output_path, 'w', encoding='utf-8') as f:
159
+ f.write(content)
160
+
161
+ # Remove original file
162
+ os.remove(file_path)
163
+
164
+ # Upload to Drive
165
+ gdrive = GoogleDriveManager()
166
+ gdrive.upload_file(output_path, self.drive_folders["MENTOR_MATERIALS"], "application/octet-stream")
167
+
168
+ processed_files.append(output_path)
169
+
170
+ return processed_files
171
+
172
+ def generate_quality_reports(self):
173
+ """Generate quality reports"""
174
+ logger.info("Generating quality reports...")
175
+ # Load checklist
176
+ with open("config/checklist.txt", "r") as f:
177
+ checklist = f.read()
178
+
179
+ # Initialize OpenAI client
180
+ openai_client = OpenAIClient("config/config.json")
181
+ client = openai_client.get_client()
182
+ deployment = openai_client.get_deployment()
183
+
184
+ report_generator = ReportGenerator(client, deployment, checklist)
185
+ report_generator.generate_reports(
186
+ self.paths["TRANSCRIPTS"],
187
+ self.paths["MENTOR_MATERIALS"],
188
+ self.paths["REPORTS"]
189
+ )
190
+ # Upload reports to Drive
191
+ gdrive = GoogleDriveManager()
192
+ for report_file in os.listdir(self.paths["REPORTS"]):
193
+ if report_file.endswith(".txt"):
194
+ local_path = os.path.join(self.paths["REPORTS"], report_file)
195
+ gdrive.upload_file(local_path, self.drive_folders["REPORTS"], "text/plain")
src/preprocessing/__pycache__/download_manager.cpython-312.pyc ADDED
Binary file (2.85 kB). View file
 
src/preprocessing/__pycache__/file_processor.cpython-312.pyc ADDED
Binary file (3.51 kB). View file
 
src/preprocessing/__pycache__/gdrive_manager.cpython-312.pyc ADDED
Binary file (5.91 kB). View file
 
src/preprocessing/__pycache__/transcript_generator.cpython-312.pyc ADDED
Binary file (4.69 kB). View file
 
src/preprocessing/__pycache__/video_processor.cpython-312.pyc ADDED
Binary file (2.46 kB). View file
 
src/preprocessing/download_manager.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # src/preprocessing/download_manager.py
2
+ import os
3
+ import logging
4
+ from .gdrive_manager import GoogleDriveManager
5
+
6
+ logger = logging.getLogger(__name__)
7
+
8
+ class GoogleDriveDownloader:
9
+ def __init__(self, download_path: str, drive_folders: dict):
10
+ self.download_path = download_path
11
+ os.makedirs(download_path, exist_ok=True)
12
+ self.gdrive = GoogleDriveManager()
13
+ self.drive_folders = drive_folders # Dict with keys: VIDEOS, AUDIOS, TRANSCRIPTS, REPORTS, MENTOR_MATERIALS
14
+
15
+ def process_one_video(self, videos_folder_url: str):
16
+ videos_folder_id = self.gdrive.get_folder_id(videos_folder_url)
17
+ video_files = self.gdrive.list_files(videos_folder_id, 'video/mp4')
18
+ if not video_files:
19
+ logger.info("No videos found in Drive folder.")
20
+ return None
21
+
22
+ # Process only the first video
23
+ video = video_files[0]
24
+ local_video_path = os.path.join(self.download_path, video['name'])
25
+ self.gdrive.download_file(video['id'], local_video_path)
26
+ logger.info(f"Downloaded: {video['name']}")
27
+ return {
28
+ 'id': video['id'],
29
+ 'name': video['name'],
30
+ 'path': local_video_path
31
+ }
32
+
33
+ def delete_drive_file(self, file_id):
34
+ self.gdrive.delete_file(file_id)
35
+
36
+ def upload_to_drive(self, local_path, folder_key, mime_type):
37
+ folder_id = self.drive_folders[folder_key]
38
+ return self.gdrive.upload_file(local_path, folder_id, mime_type)
39
+
40
+ def list_all_videos(self, videos_folder_url: str):
41
+ videos_folder_id = self.gdrive.get_folder_id(videos_folder_url)
42
+ return self.gdrive.list_files(videos_folder_id, 'video/mp4')
src/preprocessing/file_processor.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # src/preprocessing/file_processor.py
2
+ from pptx import Presentation
3
+ import nbformat
4
+ import re
5
+ import os
6
+ import logging
7
+
8
+ logger = logging.getLogger(__name__)
9
+
10
+ class FileProcessor:
11
+ @staticmethod
12
+ def process_slide_file(file_path: str) -> str:
13
+ try:
14
+ prs = Presentation(file_path)
15
+ content = []
16
+ for i, slide in enumerate(prs.slides):
17
+ content.append(f"=== Slide {i+1} ===")
18
+ for shape in slide.shapes:
19
+ if hasattr(shape, "text") and shape.text.strip():
20
+ cleaned_text = re.sub(r'\s+', ' ', shape.text.strip())
21
+ content.append(cleaned_text)
22
+ content.append("")
23
+ return "\n".join(content)
24
+ except Exception as e:
25
+ logger.error(f"Error processing presentation: {str(e)}")
26
+ return ""
27
+
28
+ @staticmethod
29
+ def process_notebook_file(file_path: str) -> str:
30
+ try:
31
+ with open(file_path, 'r', encoding='utf-8') as f:
32
+ nb = nbformat.read(f, as_version=4)
33
+
34
+ content = []
35
+ for cell in nb.cells:
36
+ if cell.cell_type == 'code':
37
+ content.append("## CODE CELL ##")
38
+ content.append(cell.source.strip())
39
+ content.append("----")
40
+ elif cell.cell_type == 'markdown':
41
+ content.append("## MARKDOWN CELL ##")
42
+ cleaned_text = cell.source.strip()
43
+ cleaned_text = re.sub(r'#+\s*', '', cleaned_text)
44
+ cleaned_text = re.sub(r'\*{1,2}(.*?)\*{1,2}', r'\1', cleaned_text)
45
+ cleaned_text = re.sub(r'\[(.*?)\]\(.*?\)', r'\1', cleaned_text)
46
+ content.append(cleaned_text)
47
+ content.append("----")
48
+
49
+ return "\n".join(content)
50
+ except Exception as e:
51
+ logger.error(f"Error processing notebook: {str(e)}")
52
+ return ""
src/preprocessing/gdrive_manager.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # src/gdrive_manager.py
2
+ import os
3
+ import io
4
+ import logging
5
+ from googleapiclient.discovery import build
6
+ from googleapiclient.http import MediaIoBaseDownload, MediaFileUpload
7
+ from googleapiclient.errors import HttpError
8
+ from google.oauth2 import service_account
9
+
10
+ logger = logging.getLogger(__name__)
11
+
12
+ class GoogleDriveManager:
13
+ SCOPES = ['https://www.googleapis.com/auth/drive']
14
+
15
+ def __init__(self, credentials_file='credentials.json'):
16
+ creds = service_account.Credentials.from_service_account_file(
17
+ credentials_file, scopes=self.SCOPES
18
+ )
19
+ self.service = build('drive', 'v3', credentials=creds)
20
+
21
+ def get_folder_id(self, url):
22
+ """Extract folder ID from Google Drive URL"""
23
+ if 'folders/' in url:
24
+ return url.split('folders/')[-1].split('?')[0]
25
+ elif 'id=' in url:
26
+ return url.split('id=')[-1].split('&')[0]
27
+ return url
28
+
29
+ def list_files(self, folder_id, file_type='video/mp4'):
30
+ """List files in a Google Drive folder"""
31
+ query = f"'{folder_id}' in parents and mimeType='{file_type}' and trashed=false"
32
+ results = self.service.files().list(
33
+ q=query,
34
+ fields="files(id, name, mimeType)"
35
+ ).execute()
36
+ return results.get('files', [])
37
+
38
+ def download_file(self, file_id, destination):
39
+ """Download a file from Google Drive"""
40
+ logger.info("Downloading file %s to %s", file_id, destination)
41
+ request = self.service.files().get_media(fileId=file_id)
42
+ fh = io.FileIO(destination, 'wb')
43
+ downloader = MediaIoBaseDownload(fh, request)
44
+ done = False
45
+ while not done:
46
+ status, done = downloader.next_chunk()
47
+ logger.info(f"Download {int(status.progress() * 100)}%")
48
+ logger.info("Download complete: %s", destination)
49
+ return destination
50
+
51
+ def upload_file(self, local_path, drive_folder_id, mime_type):
52
+ """Upload a file to Google Drive"""
53
+ file_metadata = {
54
+ 'name': os.path.basename(local_path),
55
+ 'parents': [drive_folder_id]
56
+ }
57
+ media = MediaFileUpload(local_path, mimetype=mime_type)
58
+ file = self.service.files().create(
59
+ body=file_metadata,
60
+ media_body=media,
61
+ fields='id'
62
+ ).execute()
63
+ logger.info(f"Uploaded {local_path} to Drive folder {drive_folder_id}")
64
+ return file.get('id')
65
+
66
+ def delete_file(self, file_id):
67
+ """Delete a file from Google Drive"""
68
+ try:
69
+ self.service.files().delete(fileId=file_id).execute()
70
+ logger.info(f"Deleted file {file_id} from Drive")
71
+ return True
72
+ except HttpError as error:
73
+ logger.error(f"An error occurred: {error}")
74
+ return False
75
+
76
+ def find_file_by_name(self, folder_id, filename):
77
+ """Find a file by name in a folder"""
78
+ query = f"'{folder_id}' in parents and name='{filename}' and trashed=false"
79
+ results = self.service.files().list(
80
+ q=query,
81
+ fields="files(id)"
82
+ ).execute()
83
+ files = results.get('files', [])
84
+ return files[0]['id'] if files else None
85
+
86
+ def list_txt_files(self, folder_id):
87
+ """List all .txt files in a Google Drive folder"""
88
+ query = f"'{folder_id}' in parents and mimeType='text/plain' and trashed=false"
89
+ results = self.service.files().list(
90
+ q=query,
91
+ fields="files(id, name)"
92
+ ).execute()
93
+ return results.get('files', [])
src/preprocessing/transcript_generator.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # src/preprocessing/transcript_generator.py
2
+ import azure.cognitiveservices.speech as speechsdk
3
+ import json
4
+ import re
5
+ import time
6
+ import logging
7
+
8
+ logger = logging.getLogger(__name__)
9
+
10
+ class TranscriptGenerator:
11
+ def __init__(self, speech_key: str, speech_region: str):
12
+ self.speech_config = speechsdk.SpeechConfig(
13
+ subscription=speech_key,
14
+ region=speech_region
15
+ )
16
+ self.speech_config.request_word_level_timestamps = True
17
+ self.speech_config.output_format = speechsdk.OutputFormat.Detailed
18
+
19
+ def transcribe_audio(self, audio_file_path: str, output_text_file: str):
20
+ audio_config = speechsdk.audio.AudioConfig(filename=audio_file_path)
21
+ speech_recognizer = speechsdk.SpeechRecognizer(
22
+ speech_config=self.speech_config,
23
+ audio_config=audio_config
24
+ )
25
+
26
+ all_results = []
27
+ done = False
28
+
29
+ def handle_final_result(evt):
30
+ if evt.result.reason == speechsdk.ResultReason.RecognizedSpeech:
31
+ result_json = json.loads(evt.result.json)
32
+ if 'NBest' in result_json and result_json['NBest']:
33
+ words = result_json['NBest'][0].get('Words', [])
34
+ all_results.extend(words)
35
+
36
+ def stop_cb(evt):
37
+ nonlocal done
38
+ done = True
39
+
40
+ speech_recognizer.recognized.connect(handle_final_result)
41
+ speech_recognizer.session_stopped.connect(stop_cb)
42
+ speech_recognizer.canceled.connect(stop_cb)
43
+
44
+ speech_recognizer.start_continuous_recognition()
45
+ start_time = time.time()
46
+ while not done and time.time() - start_time < 1800: # 30 min timeout
47
+ time.sleep(0.5)
48
+ speech_recognizer.stop_continuous_recognition()
49
+
50
+ # Process and save results
51
+ with open(output_text_file, "w", encoding="utf-8") as f:
52
+ f.write("start_time\tend_time\tspeaker\ttranscript\n")
53
+ current_sentence = []
54
+ current_start = None
55
+ current_end = None
56
+
57
+ for word in all_results:
58
+ word_start = word['Offset'] / 10000000
59
+ word_end = word_start + (word['Duration'] / 10000000)
60
+ word_text = word['Word']
61
+
62
+ if not current_sentence:
63
+ current_start = word_start
64
+ current_end = word_end
65
+ current_sentence.append(word_text)
66
+ continue
67
+
68
+ # Sentence boundary detection
69
+ time_gap = word_start - current_end
70
+ is_punctuation = re.match(r'^[.!?]+$', word_text)
71
+
72
+ if time_gap > 1.5 or is_punctuation:
73
+ sentence_text = " ".join(current_sentence)
74
+ f.write(f"{current_start:.2f}\t{current_end:.2f}\tSPEAKER\t{sentence_text}\n")
75
+ current_sentence = [word_text]
76
+ current_start = word_start
77
+ current_end = word_end
78
+ else:
79
+ current_sentence.append(word_text)
80
+ current_end = word_end
81
+
82
+ if current_sentence:
83
+ sentence_text = " ".join(current_sentence)
84
+ f.write(f"{current_start:.2f}\t{current_end:.2f}\tSPEAKER\t{sentence_text}\n")
85
+
86
+ logger.info(f"Transcript saved to {output_text_file}")
87
+ return len(all_results) > 0
src/preprocessing/video_processor.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # src/preprocessing/video_processor.py
2
+ import os
3
+ import subprocess
4
+ import logging
5
+
6
+ logger = logging.getLogger(__name__)
7
+
8
+ class VideoProcessor:
9
+ @staticmethod
10
+ def clean_directory(directory: str):
11
+ for filename in os.listdir(directory):
12
+ file_path = os.path.join(directory, filename)
13
+ try:
14
+ if os.path.isfile(file_path):
15
+ os.unlink(file_path)
16
+ except Exception as e:
17
+ logger.error(f"Error deleting {file_path}: {e}")
18
+
19
+ @staticmethod
20
+ def convert_mp4_to_wav(mp4_file_path: str, wav_file_path: str) -> bool:
21
+ try:
22
+ if not os.path.exists(mp4_file_path):
23
+ logger.error(f"Video file does not exist: {mp4_file_path}")
24
+ return False
25
+
26
+ command = [
27
+ "ffmpeg",
28
+ "-i", mp4_file_path,
29
+ "-vn",
30
+ "-acodec", "pcm_s16le",
31
+ "-ar", "16000",
32
+ "-ac", "1",
33
+ "-y",
34
+ wav_file_path
35
+ ]
36
+
37
+ result = subprocess.run(
38
+ command,
39
+ stdout=subprocess.PIPE,
40
+ stderr=subprocess.PIPE,
41
+ text=True
42
+ )
43
+
44
+ if result.returncode != 0:
45
+ logger.error(f"FFmpeg error: {result.stderr}")
46
+ return False
47
+
48
+ return True
49
+ except Exception as e:
50
+ logger.error(f"Conversion error: {str(e)}")
51
+ return False
src/report_generation/__pycache__/openai_client.cpython-312.pyc ADDED
Binary file (1.56 kB). View file
 
src/report_generation/__pycache__/report_generator.cpython-312.pyc ADDED
Binary file (5.44 kB). View file
 
src/report_generation/openai_client.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # src/report_generation/openai_client.py
2
+ from openai import AzureOpenAI
3
+ import json
4
+ import os
5
+ import logging
6
+
7
+ logger = logging.getLogger(__name__)
8
+
9
+ class OpenAIClient:
10
+ def __init__(self, config_path: str):
11
+ with open(config_path) as f:
12
+ config = json.load(f)
13
+
14
+ self.client = AzureOpenAI(
15
+ azure_endpoint=config["AZURE_OPENAI_ENDPOINT"],
16
+ api_key=os.getenv("AZURE_OPENAI_KEY"),
17
+ api_version=config["AZURE_OPENAI_APIVERSION"]
18
+ )
19
+ self.deployment_name = config["CHATGPT_MODEL"]
20
+
21
+ def get_client(self) -> AzureOpenAI:
22
+ return self.client
23
+
24
+ def get_deployment(self) -> str:
25
+ return self.deployment_name
src/report_generation/report_generator.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # src/report_generation/report_generator.py
2
+ import os
3
+ import glob
4
+ import time
5
+ import logging
6
+ from typing import Dict
7
+
8
+ logger = logging.getLogger(__name__)
9
+
10
+ class ReportGenerator:
11
+ def __init__(self, openai_client, deployment_name: str, checklist: str):
12
+ self.client = openai_client
13
+ self.deployment_name = deployment_name
14
+ self.checklist = checklist
15
+
16
+ def quality_check(self, transcript_content: str, material_type: str, material_content: str = None) -> str:
17
+ material_context = ""
18
+ if material_content:
19
+ if material_type == "slides":
20
+ material_context = f"\n### SLIDE CONTENT ###\n{material_content}"
21
+ elif material_type == "notebook":
22
+ material_context = f"\n### NOTEBOOK CONTENT ###\n{material_content}"
23
+
24
+ user_input = f"""
25
+ ### VIDEO TRANSCRIPT ###
26
+ {transcript_content}
27
+ {material_context}
28
+
29
+ ### TASK ###
30
+ Review using this checklist:
31
+ {self.checklist}
32
+
33
+ ### INSTRUCTIONS ###
34
+ 1. For EACH checklist item:
35
+ - Respond using format: [✅/❌/N/A] [Brief explanation]
36
+ 2. After checklist, provide:
37
+ - "What Went Wrong:" (bullet points)
38
+ - "How to Improve:" (bullet points)
39
+ 3. Use ONLY this format:
40
+
41
+ ### RESPONSE FORMAT ###
42
+ 1a: [✅/❌/N/A] [Explanation]
43
+ ...
44
+ 8b: [✅/❌/N/A] [Explanation]
45
+
46
+ What Went Wrong:
47
+ - [Issue 1]
48
+ - [Issue 2]
49
+
50
+ How to Improve:
51
+ - [Recommendation 1]
52
+ - [Recommendation 2]
53
+ """
54
+
55
+ try:
56
+ response = self.client.chat.completions.create(
57
+ model=self.deployment_name,
58
+ messages=[
59
+ {"role": "system", "content": "You are an analytical quality assurance assistant."},
60
+ {"role": "user", "content": user_input}
61
+ ],
62
+ temperature=0.2,
63
+ max_tokens=4096,
64
+ top_p=0.95
65
+ )
66
+ return response.choices[0].message.content.strip()
67
+ except Exception as e:
68
+ logger.error(f"Azure OpenAI error: {str(e)}")
69
+ return f"Error in quality check: {str(e)}"
70
+
71
+ def generate_reports(self, transcript_path: str, mentor_materials_path: str, reports_dir: str):
72
+ # Create reports directory if not exists
73
+ os.makedirs(reports_dir, exist_ok=True)
74
+
75
+ # Get all transcript files
76
+ video_transcripts = []
77
+ for file_path in glob.glob(os.path.join(transcript_path, "*.txt")):
78
+ with open(file_path, 'r', encoding='utf-8') as f:
79
+ video_transcripts.append({
80
+ "path": file_path,
81
+ "content": f.read(),
82
+ "base_name": os.path.splitext(os.path.basename(file_path))[0]
83
+ })
84
+
85
+ if not video_transcripts:
86
+ logger.error("No video transcripts found!")
87
+ return
88
+
89
+ # Get mentor materials
90
+ mentor_contents: Dict[str, str] = {}
91
+ for file_path in glob.glob(os.path.join(mentor_materials_path, "*.txt")):
92
+ base_name = os.path.splitext(os.path.basename(file_path))[0]
93
+ with open(file_path, 'r', encoding='utf-8') as f:
94
+ mentor_contents[base_name] = f.read()
95
+
96
+ # Generate reports
97
+ for video in video_transcripts:
98
+ base_name = video["base_name"]
99
+ logger.info(f"Generating report for: {base_name}")
100
+
101
+ material_content = mentor_contents.get(base_name, "")
102
+ material_type = ""
103
+
104
+ if "slide" in base_name.lower():
105
+ material_type = "slides"
106
+ elif "notebook" in base_name.lower():
107
+ material_type = "notebook"
108
+
109
+ report = self.quality_check(
110
+ video["content"],
111
+ material_type,
112
+ material_content
113
+ )
114
+
115
+ report_file = os.path.join(reports_dir, f"report_{base_name}.txt")
116
+ with open(report_file, 'w', encoding='utf-8') as f:
117
+ f.write(report)
118
+
119
+ logger.info(f"Report saved to {report_file}")
120
+ time.sleep(2) # Avoid rate limiting
transcripts/Overview and Key Components of Agent SDK.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ start_time end_time speaker transcript
2
+ 5.53 7.41 SPEAKER introduction to agent SDK
3
+ 9.23 15.39 SPEAKER what is agent SDK actually it is a software development kit
4
+ 16.95 51.71 SPEAKER toolkit for building autonomous AI agents automatic workable AI agents can be generated with the help of agent SDK which will always provide a platform a resource and tools and libraries in order to develop these AI agents then it will also help to create a flexible and reusable AI systems later it will enable the integration of certain goals tools and memory in agents
5
+ 53.48 125.15 SPEAKER so agent SDK plays a very important role in order to build an AI agent so this is a brief intro about agent SDK let's understand the key components of agent SDK what are the key components do we have first goal meaning a human is giving prompt to the AI system that is the goal for the AI system the requirement received from the user end terms to be the goal for the agent then tools what are the tools it will involve in order to create a specified result a relevant result tools lays an important role than memory after finding the results where it will store obviously in the memory so memory is also a key component of agent SDK then reasoning loop the chat that happens between the agent and the human or the user
6
+ 126.98 228.99 SPEAKER this is reasoning loop first i will ask agent or AI system hi how are you i will get a response i'm good how can i help you from the agent right so this conversation will go on please list top AI trends for twenty twenty five is the goal for example what are the tools the web search it will make the integrated apis into that AI system plays a role of tool memory first it will store it will search it will store five to six courses or trends with respect to the artificial intelligence it will list back end it will be stored in the memory then after storing what happens it will list the AI trends of twenty twenty five in the output screen once this is listed the user will try to change or tweak their particular prompt how they will change maybe this time data science oriented trends they're asking for a second goal now and sometimes they might also ask out of six trends which you have listed which is the best so again it will go to a thinking mode this reasoning will go on loop until unless the user exits from the AI system this is just a common example which i tried to give you in order to relate the key components of agent SDK
transcripts/Use case of Agent SDK.txt ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ start_time end_time speaker transcript
2
+ 5.21 75.91 SPEAKER now it's time to explore problem statement where it involves agent SDK and google SDK both of the use cases combined together in one program addressing one problem statement let's hop on to google collab and understand how the problem statement is listed and what is our solution how do we resolve the same let's quickly hop on to google platform here we are on the google collab platform addressing our problem statement which involves google SDK indeed agent SDK as well so what do we do here we are trying to build AI agent using google SDK to automate real time web search tasks what's happening here what's our objective we have to develop a simple autonomous AI agent that takes a user defined goal it performs a real time web search using google custom search API
3
+ 77.59 150.19 SPEAKER that is google SDK and presents relevant results to the user the agent should also retain memory of the past goals and result for reference so this is the objective and the problem statement basically we are trying to build an AI agent which will have a custom web search task on real time what are the key features of this it will accept the user defined goal that is a search query that's the prompt it will use google custom search API to fetch top search results that is the tool display the top three results including title URL and a snippet this is the result it will store the goal and results in the memory for future use also it will provide an option to refine the goal manually or conclude the session basically this is addressing in a manual perspective but serving the purpose of problem statement so these are the key features will be learning
4
+ 151.96 226.03 SPEAKER when we learn about this particular code then what is the expected outcome of this as i told you we have a goal we have a tool that is google custom search API action is nothing but searching for those particular top three results of the goal whatever it has been set and then displaying those three urls with title and snippet is the result then the real time search result deliver based on user inputs that's the expected outcome then a memory system that logs all goals and search outcomes during this session so this is the overall goal expected outcome and problem statement the features and objectives hope we are clear and set now let's understand the coding my codes are generally very self explanatory so it's easy to understand indeed i'll also be explaining how does these things work here
5
+ 227.75 259.12 SPEAKER first what do we do we install the required package what is the package that is google API python client we are using pip install and we are trying to install the required package then we have to import certain modules so we have to import from google API client we import which is called build that's the module we are trying to build the AI agent right
6
+ 261.12 278.40 SPEAKER now in order to interact we should know two important things one API key you have to replace with your own API key when you are working this is my API key which has been set search engine ID
7
+ 280.59 314.32 SPEAKER that is google search engine ID you can replace that with your own so that's why i have mentioned in the comment replace these two keys accordingly OK then we are sorted with API configuration now the question is where do i find the API key and where do i find the search engine ID i'll quickly give you a walk through where you can find and how you can generate then we will proceed with the further code
8
+ 316.74 518.87 SPEAKER let's understand how do we generate API key overall i'm just giving a gist of how do we do this first we have to go to google cloud there we have to select credentials once we select credentials you have an option to create credentials what kind of credential you can create let's see click on that you have different kinds of credentials available the first thing is API key click on the API key it will start creating your key ensure your particular API key is copied as and when it is created you can just copy this and paste it in a secure place right so once it's created you can close this if you want to see the API key you can click on show key it will show you that particular API key i'll close this if you want to edit something you can edit the API key here let's see what are the things we have here restrictions i've got no restrictions if you want certain websites to be restricted or certain i addresses restricted you can select them don't restrict key i have just put this across so it's by default i have not done anything it's just i've generated the API key and if you want to change the name you can change it here as well and save for now i'm not changing anything i'm just keeping as it is so you can copy that particular key go back and paste it here that is the API key now we have one more thing that is called search engine so what is the search engine ID where do we get this we will have a look at that as well you have to go to programmable search engine on google chrome you will get a screen like this there is no search engines created here first time we are creating so we'll click on create your first search engine once you do this you can give a name for your search engine what are the different sites you want to list you can list individual pages as well you can also list the parts of a site as well so what i'm doing i'm keeping it universal i'm keeping it WWW dot google dot com so the complete google search engine is customized so now we will enable image search and save search both so do not forget to click on add here once you do this see you have your particular URL listed here the website generally so i'm not a robot i'll just click this and you press on create once you do that you can see a preview here it's in the format of script right HTML script so you go to customize once you go to customize you will get a search engine ID copy this if you want URL you have an URL as well which is also ending with the same search engine ID you can see both are same now
9
+ 520.51 539.59 SPEAKER O what are the different search features enabled as by default it was image search save search if you want to search the entire web you can toggle this as well if you want to see any advanced all features of settings you can see here
10
+ 541.32 772.23 SPEAKER so query enhancement if you want to add keywords specifically you can add it so you have all these features available if you want to restrict certain pages you can restrict basically you can enable a custom google search engine that is what i meant to say so i think you're clear with how do you get your search engine ID so i'm just going back again just showing you this it is available in the code format as well if you want to describe you can give a description too you have to just copy the search engine ID get back to your code and replace in the relevant place here right this is about the API configuration which you have to set hope we are clear with this step now let's proceed with the next steps memory to store past goals and results whatever you search with the help of your custom google SDK it has to be stored right for that you have to create a open space the memory space after assigning a memory space next we have to define the tool function using google SDK why do we do this we have to ensure the google search is happening for the query which has been given it has to search with the help of what with the help of two things one the API key which is integrated and the search engine ID that search engine is not a normal open public search engine it is a custom google search engine which we have created and added that i'd into our code hope we are clear until here next we have to define the AI agents reasoning loop what is this reasoning loop it involves received goal the prompt which is received from the user then we will use google search tool which is created then we will display top three results it will have the result title URL and the snippet if any then we will store that in the memory with the help of memory append function we are trying to append the goal and the results so how many goals and results are stored that has been totaled total stored goals the numbers as been mentioned here next we are done with our goal tool and memory let's see what we can do next real time interaction i am just trying to give the real time feel of interaction with the SDK first it will state a welcome statement it will be printed then it will ask to enter your search goal what is your search goal for example top AI research labs in twenty twenty five i will be typing the same then we will run when you run what will happen it will go to the reasoning loop which we have created here right after it enters the reasoning loop it will finish all the assigned functions once it completes the execution of the functions in the reasoning loop it will show all the memory at the end so again you will have a for loop for that and we will try to list everything out so this is about the code of generating a custom search engine with the help of google SDK so the agent has been built let's run
11
+ 776.53 785.57 SPEAKER the output is this way let us try to take all the apis the google authentications everything
12
+ 787.42 798.94 SPEAKER it is asking enter your search goal after welcoming us to AI agent plus google SDK so i am typing the same top AI
13
+ 801.69 810.91 SPEAKER research labs in twenty twenty five OK i'm clicking on enter once i do that
14
+ 813.06 869.11 SPEAKER agent has received the goal that is top AI research labs in twenty twenty five the tool is searching in google for the same then the AI has got top three results what are these results as i mentioned it is having title URL and a snippet so here is the title result number one result number two and result number three so memory is stored goal and results total stored goals is one because i have given one single query right one single prompt so this is how it will list in the final memory log so this is how this particular code works when you integrate and try to understand how does an agent SDK key components and google SDK works
15
+ 871.24 1125.11 SPEAKER now there is one small constraint if you have observed or not i'm not sure but i'll try to explain what are the constraints do we have in this code first the agent operates only with the manual refinement no AI generated refinements available that's the fault that's the disadvantage search is limited to what google 's custom search API can return and it is having the quota limits it is restricted what do you do now you have a enhancement solution what all you can do let GPT also summarize the search results you can enhance this drawbacks by integrating open AI API key into the same code how do you do this how realistic it will be let's understand more about this we have old constraint that is the manual refinement issue now you can automatically add the GPT the agent becomes self sufficient it will think refine act that is search learn that is stores in the memory then what is the flow of execution for this first agent receives the goal simple it will search in google using the goal this is what we were doing it now additional step is refining goal using GPT so when you have given top AI research labs in twenty twenty five it will try to refine with the help of GPT leading artificial intelligence research institutes of worldwide twenty twenty five so this is a refinement that has been given to the goal which is already provided by the user it will search in the google again using GPT refined goal and it will store both the goals and results both of it will be stored accordingly we are not changing the execution flow we are just adding the GPT version in middle that's it that's the only enhancement we are doing in order to keep it in realistic manner the same code you have imports you have API keys you have memory store tool number one tool number two tool number one is google search tool number two here this is the addition open AI GPT for refinement this is the tool number two we have we have a function called refine query with GPT for that we have integrated few of the elements so we have kept the temperature max tokens is fifty so all these restrictions is also been put up and refined query also it will generate and give then the AI agent reasoning loop will start like before right it will again display the top three results then refine goal using GPT then display again the refine results so first it will display as it is the original then it will go towards the refined goal then it will create the result which is having the refined result so both of it will be stored in the memory so this is how this particular code will work with the enhancement of open AI API key now you have to see one important thing with API key and search engine ID we also have open AI API key integrated so when you do this you have to go to open AI platform again it is only towards the paid version of chatgpt or open AI so you can just go to open AI platform generate the API key there and paste it right here so this is how the code will look like you will get this particular code in your course just download try to replace all the API keys and run this particular code we have seen the use cases where we have integrated
16
+ 1126.71 1160.83 SPEAKER agent SDK and google SDK i mean agent SDKS key components the way it works it has been shown with the help of google SDK also there is a one small assignment you can just download this particular code try to execute the integration of open AI you can add the API key and try to run and check for the difference how realistic query looks like
transcripts/Working of Agent SDK.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ start_time end_time speaker transcript
2
+ 5.11 27.55 SPEAKER next how does this agent SDK work that's more important to know first as i mentioned setting up a goal that is prompting once the agent receives the prompt it will decide what's the tool in need for example if i say please provide
3
+ 29.24 65.67 SPEAKER a simple program in order to add two numbers in python programming language so tool will be a python program right so next action it will try to write the code on behalf and it will try to display on the output screen which terms to be the result as simple as that it's not having much complicated elements involved we will prompt it will decide the tool the action will taken and the result will be displayed this is a simple working of agent SDK