Final Report
Final Report
ai
                                               A
                                         Project Report
    Submitted in the partial fulfillment of the requirements for the award of the degree of
                                   Bachelor of Engineering
                                               in
                           Electronics & Computer Engineering
                                         Submitted by
                                         Purbasha Roy
                                                                                     1|P a g e
                                           Certificate
Certified that project entitled Beans.toi.ai which is being submitted by Purbasha Roy (University
Registration No. 102015150) to the Department of Electronics and Communication
Engineering, TIET, Patiala, Punjab, is a record of project work carried out by her under
guidance and supervision of Mr. Siddharth Jain. The matter presented in this project report does
not incorporate without acknowledgement any material previously published or written by any other
person except where due reference is made in the text.
Purbasha Roy
102015150
                                                                                        2|P a g e
                                       Acknowledgement
  I would like to express my heartfelt gratitude and extend my sincerest appreciation to
  Bennett, Coleman & Co. Ltd. for providing me with the invaluable opportunity to
  participate in the 6- month internship program. This internship has been an enriching and
  transformative experience that has significantly contributed to my personal and professional
  growth.
  First and foremost, I would like to express my gratitude to the entire Bennett, Coleman &
  Co. Ltd. team for their warm welcome and continuous support throughout my internship
  journey. The guidance, mentorship, and encouragement I received from my supervisor and
  colleagues wereinstrumental in shaping my understanding of the industry and enhancing my
  skills.
  I am deeply grateful for the trust and responsibility that Bennett, Coleman & Co. Ltd.
  bestowed upon me during my internship. The hands-on experience and exposure to real-world
  challenges have allowed me to apply the knowledge I gained during my academic studies,
  fostering a deeper understanding of the practical aspects of my field.
  I would like to extend a special appreciation to my supervisor Mr. Siddharth Jain for their
  unwavering support, patience, and willingness to share their expertise. Their guidance not only
  helped me navigate complex tasks but also encouraged me to think critically, problem-solve,
  and develop innovative solutions. Their commitment to my growth and development has been
  truly invaluable.
  I would also like to express my gratitude to my colleagues and teammates for their
  collaboration, camaraderie, and willingness to share their knowledge. The inclusive and
  supportive work environment fostered by the entire team played a significant role in creating a
  positive and conducive learning experience.
  Furthermore, I would like to thank the HR department for their efficient organization of the
  internship program, from the application process to onboarding and ongoing support. Their
  professionalism and dedication ensured a smooth and seamless experience, allowing me to
  fully focus on my learning and contributions.
I would like to extend my heartfelt appreciation to the entire ECED department for their
unwavering support, guidance, and mentorship throughout my internship tenure. I would like to
                                                                                          3|P a g e
extend my heartfelt gratitude to my faculty mentor Mrs. Geetika Dua, Associate Professor for
her continuous support and guidance. The knowledge and skills I have gained during this
period have been instrumental in shaping my professional growth. I would like to acknowledge
the collaborative environment fostered by the entire mechanical team. The open-door policy and
willingness to answer my questions or provide assistance made me feel welcome and supported
throughout my internship.
Last but not the least I would like to thank my family and friends for their continuous support
and help during the entire tenure of my internship and making this experience very fruitful.
                                                                                        4|P a g e
                                           Abstract
This project report documents innovative research and development activities undertaken during
a Bachelor of Engineering internship at Bennett Coleman & Co. Ltd. (BCCL). The work focused
on applying advanced AI and ML technologies to address operational challenges within the
company, leading to several key projects, methodologies, and outcomes.
The first project developed a copyright infringement detection model using Copyscape and
TinEye APIs to scan for duplicated content online, ensuring compliance with intellectual
property laws. This demonstrated AI's role in automating copyright protection.
Another project was an AI-powered research assistant model, integrating Bing and Google
Custom Search APIs to conduct internet searches, compile URLs, and provide summarized
content. This optimized research workflows, enabling quick access to relevant information.
Additionally, an AI-driven data analysis model was created to analyze data from CSV or Excel
files, detect trends, and generate visualizations using OpenAI's GPT-4. This facilitated data
interpretation and decision-making for the editorial team.
The report also covers the development of a multilingual speech-to-text AI model for
transcribing and translating reporter speech into text across multiple languages using OpenAI's
Whisper and GPT-3.5 models. This improved reporting efficiency and transcription accuracy.
Further projects included enhancing live speech-to-text transcription systems and developing an
AI content generation model to assist content creators by producing high-quality content based
on user-provided topics.
                                                                                      5|P a g e
                     List of Figures
Figure 3.3 Code for searching the query using Bing API 30
                                                                       6|P a g e
Figure 5.2         Summary of the uploaded document                   47
Figure 6.1 Transcribed text for the given mp3 file as input 54
                                                                 7|P a g e
                   List of Tables
                                                 8|P a g e
               Acronyms and Abbreviations
                                                                 9|P a g e
                                         Table of Content
                                                                              Page No.
Certificate                                                                     2
Acknowledgement                                                                 3
Abstract                                                                        5
List of figures                                                                 6
List of tables                                                                  8
Acronyms and abbreviations                                                      9
Contents
  Chapter-1 Introduction
       1.1.       About the Company                                            12
       1.2.       About the Department                                         14
       1.3.       List of Projects                                             16
 Chapter-2        Development of a Copyright Infringement Detection Model
     2.1          Objective                                                    19
     2.2          Introduction                                                 19
     2.3          Prior Work                                                   20
     2.4          Methodology                                                  20
     2.5          Results                                                      22
     2.6          Conclusion                                                   24
                                                                            10 | P a g e
    4.6     Conclusion                                                         42
      References                                                               69
      Reflective Dairy                                                         70
                                                                          11 | P a g e
                                     Chapter-1
                                    Introduction
Bennett, Coleman & Co. Ltd. (BCCL), also known as The Times Group, is one of India's
largest and most influential media conglomerates. Established in 1838, BCCL has a rich
history of providing quality news and information to the Indian public. The company owns
and operates a wide array of media outlets, including newspapers, magazines, television
channels, radio stations, and digital platforms.
BCCL's flagship publication, The Times of India, is the world's largest-selling English-
language daily newspaper. It’s dominance in the print media sector is not limited to The
Times of India. The company publishes several other influential newspapers catering to
different demographics and linguistic groups. The Economic Times, for instance, is one of the
most respected business dailies in India, offering in-depth analysis and coverage of financial
markets, industry trends, and economic policies. Maharashtra Times and Navbharat Times
serve the regional and Hindi-speaking audiences, respectively, ensuring that BCCL's reach
extends across diverse linguistic and cultural segments.
Recognizing the growing influence of television, BCCL expanded into the broadcast media
sector with significant success. Times Now, the company's premier English news channel, has
garnered a substantial viewership for its incisive news reporting and analysis. ET Now
focuses on business and economic news, providing viewers with expert insights into the
financial world. Additionally, Zoom, BCCL's entertainment channel, caters to the youth
demographic with a mix of music, Bollywood news, and celebrity gossip.
                                                                                   12 | P a g e
BCCL's foray into radio broadcasting has also been marked by notable achievements. Radio
Mirchi, the company's radio network, operates numerous stations across India. Known for its
catchy tagline "It's Hot!", Radio Mirchi has become a leading name in the FM radio space,
offering a mix of music, talk shows, and entertainment content. The network's popularity is a
testament to BCCL's ability to adapt to changing media consumption habits and deliver
content that resonates with a broad audience.
In the digital age, BCCL has successfully transitioned to online platforms, ensuring its
relevance in a rapidly evolving media landscape. TimesofIndia.com and Indiatimes.com are
among the most visited news websites in India, providing real-time updates, multimedia
content, and interactive features. The company's digital strategy emphasizes innovation and
user engagement, leveraging social media and mobile applications to reach a tech-savvy
audience.
BCCL's slogan, "Let Truth Prevail," encapsulates the company's commitment to journalistic
integrity and ethical reporting. This guiding principle has been the cornerstone of BCCL's
operations, driving its mission to deliver accurate, unbiased, and comprehensive news
coverage. In an era of misinformation and sensationalism, BCCL's adherence to truth and
objectivity sets it apart as a trusted source of information.
Beyond its commercial ventures, BCCL is also actively involved in various social and
community initiatives. The Times Foundation, the company's philanthropic arm, undertakes
numerous projects aimed at education, healthcare, disaster relief, and environmental
conservation. These initiatives reflect BCCL's dedication to contributing positively to society
and making a meaningful impact beyond the realm of media.
The headquarters of Bennett, Coleman & Co. Ltd. in Mumbai serves as the nerve center of its
extensive media operations, driving its mission to deliver quality journalism and content.
Through strategic international offices, digital platforms, content syndication, and global
collaborations, BCCL has successfully extended its reach beyond India, making a significant
impact on the global media industry. The company's commitment to innovation, integrity, and
excellence continues to guide its growth and influence worldwide.
                                                                                     13 | P a g e
1.2.        About the Department
The IT Department at Bennett, Coleman & Co. Ltd. (BCCL), also known as The Times
Group, is a vital component that supports and drives the company's extensive media
operations. This department is responsible for managing the technological infrastructure,
ensuring seamless operations, and implementing innovative solutions to keep BCCL at the
forefront of the media industry.
The IT Department at BCCL is organized into several key divisions, each focusing on
different aspects of technology and information systems:
1. IT Infrastructure Management
Infrastructure Management: This team is responsible for maintaining and managing
BCCL's IT infrastructure, including servers, networks, data centers, and cloud services. They
ensure that all systems are running efficiently and securely, providing a robust backbone for
the company's operations.
Network Administration: Network administrators manage the company's internal and
external networks, ensuring reliable connectivity, managing bandwidth, and securing network
communications.
3. Cybersecurity
Security Operations: The cybersecurity team protects BCCL's digital assets and IT
infrastructure from cyber threats. They implement security measures such as firewalls,
intrusion detection systems, and encryption to safeguard sensitive data.
Incident Response: This team handles security incidents, ensuring quick and effective
responses to mitigate risks. They conduct regular security audits and stay updated with the
latest security trends to prevent breaches.
                                                                                     14 | P a g e
4. Software Development and Maintenance
Application Development: This division develops and maintains software applications used
across the company. This includes content management systems (CMS), and other custom
applications that streamline operations and improve productivity.
Web and Mobile Development: Dedicated teams focus on creating and maintaining BCCL’s
digital properties, such as TimesofIndia.com and mobile apps. They ensure these platforms
are user-friendly, responsive, and equipped with the latest features.
6. Advertising Optimization
Ad Targeting: AI algorithms optimize ad targeting by analyzing user data and behavior,
ensuring that advertisements are relevant and effective. This improves the efficiency of
advertising campaigns and increases revenue.
Performance Analytics: AI tools monitor and analyze the performance of ad campaigns in
real-time, providing actionable insights to advertisers and marketers.
I had the opportunity to work in the AI Research and Development (R&D) Department. I was
involved in exploring emerging AI and machine learning (ML) solutions, where I researched
the latest advancements and trends in AI technology to identify potential applications for the
company. My responsibilities included developing prototypes for various AI-driven projects,
which involved coding, testing algorithms, and ensuring they met the desired objectives.
                                                                                   15 | P a g e
1.3.        List of Projects
During my internship in the AI Research and Development (R&D) Department, I had the
opportunity to work on several innovative projects. These projects aimed to enhance the
company's editorial capabilities, streamline content creation processes, and integrate advanced
AI solutions into BCCL's operations. Here is a detailed list of the key projects I was involved
in:
Project 1
Development of a Copyright Infringement Detection Model
In this project, I worked on developing a model to detect potential copyright infringement in
the content generated by reporters and AI tools. We used APIs from Copyscape to create a
comprehensive search framework that scans the internet and various digital repositories for
duplicated content. The model generated detailed reports indicating the specific URLs, word
counts, and percentages of content overlap, ensuring thorough compliance with intellectual
property laws.
Project 2
Designing an AI-Powered Research Assistant Model
I contributed to creating an AI-powered research assistant that conducts internet searches
based on user queries, compiles relevant URLs, and provides summarized content. We
integrated APIs from Bing and Google Custom Search to ensure comprehensive and accurate
search results. This tool enabled users to quickly access relevant information and synthesized
summaries, streamlining the research process. This project underscored the potential of AI in
optimizing research workflows.
Project 3
Implementation of an AI-Driven Data Analysis Model
I was involved in building an AI model designed to analyze data from CSV or Excel files,
providing summaries, detecting trends, and generating visualizations. We leveraged OpenAI's
GPT-4-0125-preview model later on switched to GPT-4 Omni models for its advanced data
interpretation capabilities. This model allowed us to generate detailed summaries, extract
meta attributes, and respond accurately to user queries. Additionally, we implemented user-
requested and auto-generated graph visualizations to illustrate data trends effectively. This
project aimed to streamline data analysis processes, making it easier for the editorial team to
interpret and utilize large datasets. The AI-driven model proved instrumental in enhancing
data-driven decision-making within the organization.
                                                                                    16 | P a g e
Project 4
Creation of an AI Document Analyzer
My role involved developing an AI tool that could analyze documents, extract relevant text
segments, and provide contextual answers to specific queries. We used the OpenAI GPT-4-
0125-preview model and then, in order to improve response time, we moved to GPT-4 Omni
models. We did this by utilising vector databases for embedding in the Knowledge Retrieval
method. This approach facilitated efficient extraction and evaluation of textual content from
diverse documents. The AI Document Analyzer was particularly useful for handling complex
documents, such as legal briefs and financial reports, offering valuable insights and enhancing
document comprehension capabilities. This tool significantly improved the efficiency and
accuracy of document analysis processes within the company.
Project 5
Design and Development of a Multilingual Speech-to-Text AI Model
I worked on developing a multilingual speech-to-text AI model aimed at transcribing and
translating reporter speech into text across multiple languages with high accuracy. We utilized
OpenAI's Whisper model for speech recognition, which provided robust capabilities in
recognizing various languages. To ensure the transcriptions were clear and readable, we
incorporated GPT-3.5 for rephrasing the text into coherent and meaningful language. This
project significantly improved the efficiency of the reporting process, enabling instant and
accurate textual output. The model supported various file formats, including mp3, mp4, and
wav, ensuring flexibility in usage. Overall, this tool enhanced the accessibility and quality of
transcriptions for diverse audiences.
Project 6
Enhancement of Live Speech-to-Text
The goal of this research was to improve live speech-to-text transcription systems so that
reporting and interviews could be accurately and in real-time transcribed. To increase
transcription accuracy, we used a variety of voice datasets, noise reduction strategies, and
sophisticated language models like Assembly AI and AWS LIVE SPEECH TO TEXT. This
improvement increased the effectiveness of live reporting by guaranteeing that live
transcriptions were instantaneously coherent and publication-ready. The enhanced live
speech-to-text system represented a major breakthrough in the production of real-time reports
and information.
                                                                                     17 | P a g e
Project 7
Development of an AI Content Generation Model
In this project, I developed an AI model to generate content based on user-provided topics.
The model aimed to assist content creators by producing relevant and high-quality content
tailored to specific topics. We ensured the generated content was coherent, informative, and
adhered to the editorial standards of BCCL. Integrating this model into the content
management system streamlined the content creation process, allowing for quicker and more
efficient generation of articles and reports. This tool significantly enhanced the editorial
capabilities of BCCL, demonstrating the practical applications of AI in content creation.
                                                                                  18 | P a g e
                          Chapter-2
       Development of a Copyright Infringement Detection
                            Model
2.1 Objective:
The objective of this project is to develop a robust and efficient model capable of detecting
potential copyright infringement in content generated by reporters and AI tools. By leveraging
APIs from Copyscape, the model aims to create a comprehensive search framework that scans
the internet and various digital repositories for duplicated content. The ultimate goal is to
generate detailed reports that indicate specific URLs, word counts, and percentages of content
overlap, thereby ensuring thorough compliance with intellectual property laws.
2.2 Introduction:
In this project, I focused on developing a model to detect potential copyright infringement in
content generated by reporters and AI tools. With the increasing volume of digital content and
the ease of replication, copyright infringement has become a significant concern. To address
this issue, the project utilized the powerful search capabilities of Copyscape APIs, creating a
comprehensive search framework designed to scan the internet and various digital repositories
for duplicated content. This framework ensures thorough compliance with intellectual
property laws and helps safeguard original content.
The model operates by performing extensive searches across numerous digital platforms to
identify instances of content overlap. Utilizing the advanced algorithms of Copyscape, it can
detect even subtle similarities between pieces of content. Once potential infringements are
identified, the model generates detailed reports that include specific URLs where the
duplicated content was found, word counts, and percentages of content overlap. These reports
are invaluable for understanding the extent of the infringement and taking appropriate actions
to address it.
The Copyscape API, for instance, performs text searches on the internet to find exact matches
and partial matches of content. The integration of these APIs into the model leverages their
extensive databases and sophisticated detection mechanisms, ensuring accurate and reliable
identification of copyright issues.
                                                                                    19 | P a g e
This project aims to provide a reliable tool for organizations and individuals to monitor and
manage the originality of their content. By fostering a culture of respect for intellectual
property, the model not only helps in protecting rights but also promotes ethical content
creation practices. The comprehensive and detailed reports generated by the model assist in
ensuring that all content remains within the legal boundaries of copyright laws, thus
mitigating the risk of legal issues and maintaining the integrity of the content produced.
2. Familiarity with API Integration and Data Parsing: Knowledge of how to make API
   calls, handle responses, and manage authentication was essential. This includes
   understanding HTTP methods, response handling, and error management.Skills in
   parsing XML and JSON responses from the APIs to extract meaningful data for reporting
   were required. Using tools like xml2js in JavaScript to convert API responses into usable
   formats was part of this expertise.
4. Familiarity with Similar Projects or Tools: Reviewing existing tools and methods for
   copyright infringement detection provided insights into best practices and common
   pitfalls. This included studying the methodologies and effectiveness of existing solutions
   to build a more robust and reliable model.
2.4 Methodology:
The methodology for developing the copyright infringement detection model involved several
key steps, utilizing various tools and APIs to create a comprehensive search framework.
By following this methodology, the project creates an efficient and effective model for
detecting potential copyright infringements in text content. The integration of Copyscape API,
combined with robust error handling and comprehensive result processing, ensures that the
                                                                                     20 | P a g e
model provides reliable and detailed reports on potential copyright issues, aiding in
compliance with intellectual property laws.
Below is an outline of the methodology:
2. API Integration:
      Copyscape API: The core functionality involves making API calls to Copyscape.
         A function copyscape_api_call is defined to handle GET and POST requests to
         the Copyscape API, forming the request URL with the necessary parameters and
         managing the response.
      Text Search Endpoint: An endpoint /copyscape/textsearch is set up to handle
         POST requests. This endpoint receives text data, processes it, and makes a call to
         the Copyscape API to search for potential copyright infringements on the internet.
3. Text Processing:
       Input Handling: The text to be checked for copyright infringement is received in
         the body of the POST request. The total number of words in the text is calculated
         to aid in the analysis of the results.
       Encoding and Search Level: The text is encoded in UTF-8, and a parameter full is
         set to control the comprehensiveness of the search (0 for basic, higher values for
         more comprehensive searches).
                                                                                        21 | P a g e
5. Result Processing and Reporting:
       Result Extraction: The results from the API response are extracted and processed.
          Each result includes the URL, title of the matched content, the minimum number
          of words matched, and the percentage of the text that matches.
       JSON Response: The processed results are formatted into a JSON array and sent
          back as the response to the POST request. If no matches are found, a 404 status
          with a "No matches found" message is returned.
6. Error Handling:
       Robust Error Management: The methodology includes robust error handling to
         manage issues such as missing text input, API call failures, and parsing errors.
         These errors are logged, and appropriate HTTP status codes and error messages
         are returned.
7. Server Setup:
       Express Server: The Express server is set up to listen on a specified port, enabling
          the API to handle requests and return responses.
2.5 Results:
                                                                                 22 | P a g e
        Fig 2.2 Results of the Copyscape Internet Search for Potential Content Matches
Fig 2.3 Proof of result - Screenshot of an article from Fortune India discussing Nykaa's
                       business performance during the pandemic.
                                                                                23 | P a g e
2.6 Conclusions:
The results of the copyright infringement detection model were obtained by conducting
extensive tests using various text samples generated by reporters and AI tools. The key
outcomes of these tests are summarized below:
1. Detection Accuracy:
 The model successfully identified instances of content overlap with high accuracy. It was
able to detect both exact matches and partial matches of content across multiple sources on
the internet.
 Detailed reports were generated for each test, highlighting the specific URLs, titles of the
matched content, the minimum number of words matched, and the percentage of text
overlap.
The system handled edge cases effectively, such as extremely short texts or texts with no
significant matches, providing appropriate feedback without causing system crashes or
failures.
                                                                                   24 | P a g e
                              Chapter-3
           Designing an AI-Powered Research Assistant Model
3.1 Objective:
The objective of this project is to design an AI-powered research assistant model that integrates
various APIs, such as the Bing API and Google Custom Search API, to efficiently respond to
user queries by scouring the internet for relevant information. The model aims to provide users
with quick access to pertinent online content by generating outputs that include URLs of
websites containing the desired information, accompanied by succinct summaries extracted from
these sources. This methodology empowers users with a powerful and insightful research tool,
enhancing their ability to access and utilize relevant online content in a summarized and efficient
manner.
3.2 Introduction:
In this project, we developed an AI-powered research assistant model designed to significantly
enhance the efficiency and effectiveness of online research. With the vast amount of information
available on the internet, finding relevant and accurate content can be a time-consuming and
challenging task. Our model addresses this challenge by leveraging advanced APIs, including the
Bing API and Google Custom Search API, to automate and streamline the search process.
The core functionality of the model involves receiving user queries and using these APIs to
perform comprehensive searches across the web. When a user submits a query, the model sends
requests to the Bing and Google Custom Search APIs, which scour the internet for contextually
relevant information. These APIs return search results that include various web pages and
documents related to the query.
To enhance the usability of these search results, the model processes the returned data to
generate outputs that are both informative and concise. Each result includes the URL of the
relevant website and a succinct summary extracted from the content of that page. This summary
provides a quick overview of the information available on the site, allowing users to quickly
assess its relevance without having to visit each page individually.
The integration of these powerful search APIs ensures that the research assistant model performs
thorough and accurate searches, covering a wide range of online sources. This comprehensive
approach increases the likelihood of retrieving the most pertinent information for any given
query.
Moreover, by presenting the search results in a summarized format, the model enhances the user
experience by making the information more accessible and easier to digest. Users can quickly
                                                                                        25 | P a g e
scan through the summaries to find the content that best meets their needs, significantly reducing
the time and effort required for online research.
Overall, this project aims to empower users with a robust tool that facilitates efficient and
insightful research. By automating the search process and providing concise, relevant summaries,
the AI-powered research assistant model helps users access and utilize valuable online content
more effectively, supporting their research activities in a streamlined and user-friendly manner.
Understanding the rate limits imposed by the APIs was important to prevent exceeding the
allowed number of requests, which could lead to blocked access. Strategies like request throttling
or caching were considered for effective rate limit handling. Additionally, reviewing existing
research assistant tools and similar search applications provided insights into best practices and
effective solutions, helping identify features and functionalities to incorporate or improve upon.
3.4 Methodology:
   3.5.1 Methodology for Suggestion.js (Google Custom Search API)
                  Import Required Modules: The axios library is imported for making HTTP
                   requests, and the fs module is used for reading the API key and Search Engine
                   ID from files.
                  Read API Credentials: The Google Custom Search API key and Search
                   Engine ID are read from files using fs.readFileSync.
              A search query is defined, which will be used to search for relevant content on the
               internet. For example, the query could be "5 ways to remain healthy". 
                                                                                       26 | P a g e
   3. Construct API Request:
             Parameters: The query parameters, including the search query, API key, and
              Search Engine ID, are constructed into an object.
             An HTTP GET request is made to the Google Custom Search API using
              axios.get, passing the constructed URL and parameters.
                 The response from the API is processed to extract relevant information. If the
                  response contains items, each item’s title, URL, and snippet are logged to the
                  console.
                 Error Handling: If the API request fails, an error message is logged to the
                  console.
6. Output Results:
             The relevant search results, including titles, URLs, and snippets, are printed to the
              console, providing a summarized view of the content found. 
                 Import Required Modules: The express library is imported for setting up the
                  server, and dotenv is used for managing environment variables.
                 Express Server Configuration: An Express application is created, and JSON
                  parsing middleware is configured.
             The API credentials and custom configuration ID for the Bing API are read from
              environment variables using dotenv. 
             A POST endpoint /search is defined to handle search requests. The search term is
              extracted from the request body or query parameters.
                                                                                        27 | P a g e
   4. Validate Input:
             The search term is validated to ensure it is not empty. If it is missing, a 400 status
              code and error message are returned.
             An HTTP GET request is made to the Bing Custom Search API using fetch,
              passing the constructed URL and headers.
                 The response from the API is parsed as JSON. If the response contains web
                  pages, each web page’s name, URL, and snippet are mapped into an array and
                  returned as the JSON response.
                 Error Handling: If the API request fails or the response is not OK, an error is
                  logged, and a 500 status code with an error message is returned.
8. Start Server:
             The Express server is configured to listen on a specified port, making the search
              functionality available via the defined endpoint.
                                                                                         28 | P a g e
3.5    Results:
Fig 3.2 Result of Google Custom Search – Displaying Title, URL, and Snippet.
                                                                              29 | P a g e
                     Fig 3.3 Code for searching the query using Bing API
3.6 Conclusions:
The implementation of the AI-powered research assistant model using both the Google Custom
Search API (suggestion.js) and the Bing Custom Search API (bingexpress.js) yielded significant
results in terms of accuracy, efficiency, and usability. Below is a summary of the outcomes
observed during the testing phase:
                 The response times for both APIs were satisfactory, ensuring that users
                  received prompt feedback on their queries. The Google Custom Search API
                  and Bing API both returned results quickly, making the research assistant
                  model efficient for real-time use.
                                                                                      30 | P a g e
                  The server setup for the Bing API (bingexpress.js) performed reliably under
                   various load conditions, maintaining consistent response times and handling
                   multiple requests concurrently.
                  The search results were presented in a user-friendly format, with titles, URLs,
                   and snippets clearly displayed. This made it easy for users to assess the
                   relevance of each result without needing to visit each link.
                  The implementation of robust error handling ensured that users received
                   meaningful error messages when issues occurred, such as missing search
                   terms or network errors, enhancing the overall user experience.
                  The integration of the APIs into the respective server setups was seamless,
                   demonstrating the feasibility of using these APIs in a production environment.
                  Both implementations allowed for easy modification of search queries and
                   parameters, providing flexibility in how the search functionality could be used
                   and adapted for different requirements.
Overall, the results from both implementations indicate that the AI-powered research assistant
model is highly effective in retrieving relevant and accurate information from the web. The use
of Google Custom Search API and Bing Custom Search API provided a comprehensive and
efficient solution for user queries, ensuring quick access to pertinent online content. The model's
ability to present summarized information in a user-friendly manner significantly enhances its
usability, making it a valuable tool for research and information retrieval.
                                                                                        31 | P a g e
                        Chapter-4
    Implementation of an AI-Driven Data Analysis Model
4.1 Objective:
The objective of this project is to develop an AI-driven data analysis model that enhances
data interpretation and utilization in Excel files. This model will automatically generate
concise summaries, extract and present meta attributes (such as file size, creation date, and
number of sheets), create visualizations based on user queries, and answer specific questions
related to the document using advanced natural language processing. By integrating these
functionalities, the project aims to streamline data analysis, improve decision-making, and
provide users with clear, data-driven insights.
4.2 Introduction:
In the implementation of the AI-Driven Data Analysis Model, we strategically utilized the
OpenAI Assistant API, specifically selecting the GPT-4-0125-preview model for its
advanced capabilities in data interpretation from CSV and Excel files. This selection enabled
the generation of summaries, extraction of meta attributes, and accurate responses to user
queries. To cater to graph visualization needs, our approach was twofold: enabling user-
requested chart creation and autonomously generating graphs to illustrate observed trends
from the data. Additionally, to refine the outputs for enhanced readability, we employed the
GPT-3.5 model for its rephrasing efficiency, offering a balance between performance and
speed. Among the three assistant APIs available, we chose the "code interpreter" mode for
its adeptness at handling complex data analysis tasks and generating programmatically
accurate results. This choice was instrumental in our ability to provide meaningful data
visualizations and insightful summaries, further enriched by our post-processing rephrasing
with GPT-3.5.
Later on, we switched to the GPT-4 Omni models, which offered enhanced performance and
greater flexibility in handling diverse and complex data analysis tasks. This transition
allowed us to further refine our model's capabilities, ensuring even more accurate, fast, and
accessible insights for our editorial team and end-users. This nuanced application of
OpenAI's technologies demonstrates our innovative approach to leveraging AI for
comprehensive data analysis, ensuring that our users receive the highest quality of insights
and data-driven decision-making support.
                                                                                  32 | P a g e
4.3 Prior Work:
To create the five scripts, several foundational steps and prior work are essential. The first
step involves setting up the development environment. This includes installing Node.js and
npm, which are necessary for running the JavaScript code and managing project
dependencies. Additionally, essential packages such as express for building the server,
multer for handling file uploads, fs for file system operations, dotenv for managing
environment variables, and the OpenAI SDK for interacting with OpenAI's API must be
installed. Proper environment configuration is also crucial, requiring the creation of a .env
file to securely store the OpenAI API key and any other necessary environment variables.
Next, handling file uploads is a critical task. Multer needs to be configured in each script to
manage file uploads efficiently, specifying appropriate destination folders for the uploaded
files. Alongside this, setting up an Express server is essential to handle incoming HTTP
requests. This setup ensures that files can be uploaded, stored temporarily, and then
processed by the AI model.
Integrating the OpenAI API is another significant step. This involves securely managing the
OpenAI API key using environment variables loaded through dotenv. The scripts need to
implement functionality to upload files to OpenAI’s servers for further analysis. This
process ensures that the data is accessible to the AI models for processing and generating
insights.
Configuring the AI models and assistants is a crucial part of the setup. Each script requires
clearly defined instructions tailored to its specific function, whether it be summarizing data,
extracting meta attributes, generating graphs, or answering user queries. The assistants are
created using the OpenAI API, initially with the GPT-4-0125-preview model and later
transitioning to the more advanced GPT-4 Omni models to enhance performance and
flexibility.
Handling threads and messages effectively is vital for user interactions. This involves
creating threads for each user interaction session and defining the initial messages to set the
context for the AI assistant. Proper message handling ensures that user queries are
processed, and appropriate responses are generated using the AI model.
                                                                                     33 | P a g e
4.4 Methodology:
4. Assistant Configuration:
 Define Instructions: Provide clear instructions for the AI assistant. In this case, the
instructions are to analyze the provided CSV file, detailing its structure (rows, columns) and
elucidating any patterns, trends, or insights. The explanation should be clear and structured,
suitable for someone without a data analysis background.
 Assistant Creation: Create an AI assistant using the OpenAI API with the defined
instructions and the specified model (initially GPT-4o).
                                                                                   34 | P a g e
6. Execution and Status Checking:
 Run Execution: Trigger the execution of the assistant's run using the created thread and
assistant ID.
 Status Monitoring: Implement a function to check the status of the run periodically. If the
run is completed, retrieve the messages generated by the assistant.
8. Server Listening:
 Start Server: Configure the Express server to listen on a specified port (e.g., port 3000) to
handle incoming requests.
Fig 4.1 Code Overview of Assisstant creation, instruction prompt and tool selection
                                                                                    35 | P a g e
4.5.2 Methodology to Implement Graphs
 Environment Setup: Install necessary packages including express, multer, fs, dotenv, and
the OpenAI SDK. Create a .env file to securely store the OpenAI API key and load it using
dotenv. 
 Multer Configuration: Set up multer to handle file uploads, specifying the destination
folder for storing uploaded files temporarily. 
 Express Middleware: Configure Express to parse JSON requests and handle file uploads
using multer.
 File Upload to OpenAI: Implement functionality to upload the CSV file to OpenAI's
servers for analysis. This involves reading the file from the temporary storage and using the
OpenAI API to create a file resource.
4. Assistant Configuration:
 Define Instructions: Provide clear instructions for the AI assistant. In this case, the
instructions are to analyze data from the provided CSV file and generate charts that
accurately represent identified trends. The assistant should ensure all axes are clearly labeled
with appropriate units of measurement.
 Assistant Creation: Create an AI assistant using the OpenAI API with the defined
instructions and the specified model (GPT-4o).
 Create Thread: Initiate a new thread for the user interaction session.
                                                                                     36 | P a g e
 User Request Handling: Define the initial user message asking for specific graphs or
visualizations based on the CSV data. Attach the uploaded file to this message and specify
the use of the "code_interpreter" tool. 
 Run Execution: Trigger the execution of the assistant's run using the created thread and
assistant ID.
 Status Monitoring: Implement a function to check the status of the run periodically. If the
run is completed, retrieve the messages and generated images by the assistant.
 Retrieve and Format Results: Once the run is completed, retrieve the messages from the
thread. Extract the content generated by the assistant, including the generated graphs.
 Process Images: Convert the generated images to a format suitable for web display (e.g.,
base64 encoded strings).
 Send Response: Format the extracted content and generated graphs, and send them back
as the response to the user's request.
8. Server Listening:
 Start Server: Configure the Express server to listen on a specified port (e.g., port 4000) to
handle incoming requests.
                                                                                    37 | P a g e
                       Fig 4.2 Handling Graphs and the Explanation
4.5 Results:
                                                                     Selling   Original
Brand      Model       Color          Memory    Storage    Rating     Price     Price
                     Moonlight
OPPO        A53        Black            4 GB     64 GB      4.5      11990      15990
OPPO        A53     Mint Cream          4 GB     64 GB      4.5      11990      15990
                     Moonlight
OPPO        A53        Black            6 GB     128 GB     4.3      13990      17990
OPPO        A53     Mint Cream          6 GB     128 GB     4.3      13990      17990
OPPO        A53    Electric Black       4 GB      64 GB     4.5      11990      15990
OPPO        A53    Electric Black       6 GB     128 GB     4.3      13990      17990
OPPO        A12      Deep Blue          4 GB      64 GB     4.4      10490      11990
OPPO        A12        Black            3 GB      32 GB     4.4       9490      10990
OPPO        A12        Blue             3 GB      32 GB     4.4       9490      10990
OPPO        A12    Flowing Silver       3 GB      32 GB     4.4       9490      10990
                                                 .
                                                 .
                                    3112 more rows in the dataset
                                                                               38 | P a g e
Fig 4.3 Giving the Meta Attributes of the input file
                                                       39 | P a g e
Fig 4.4 Summary of the Input File
                                    40 | P a g e
 Fig 4.5 Graph generated by the model showing the relationship between Price in INR and
                                     Storage Size.
Fig 4.6 Graph created by the model depicting the relationship between Brand and Average
                                        Rating.
                                                                              41 | P a g e
                            Fig 4.7 Response to the user's query
4.6 Conclusion:
1. Efficient File Upload Handling: The server was successfully configured to handle file
   uploads and JSON requests using multer and Express middleware. This ensured that CSV
   files could be uploaded and processed efficiently.
2. Accurate Execution and Status Checking: The assistant's runs were successfully
   triggered, and the status of each run was monitored periodically. This ensured that the
   results were retrieved as soon as the analysis was completed.
3. Clear and Informative Result Processing: The results generated by the AI assistant,
   including detailed graphs and explanations, were retrieved and formatted properly. The
   graphs were accurately labelled with appropriate units of measurement and provided
   clear visual representations of the data trends and insights.
4. User Query Handling: User input queries were handled well, with the AI assistant
   providing accurate and relevant responses. The responses were clear and informative,
   addressing the user’s questions effectively.
5. Perfect Graph Display: The generated graphs were displayed perfectly, providing users
   with visually appealing and accurate representations of their data. The graphs were well-
   labelled, making it easy for users to understand the trends and insights presented.
                                                                                   42 | P a g e
                             Chapter-5
               Creation of an AI Document Analyzer
5.1 Objective:
The objective was to describe the development of an AI-powered document analyzer,
which consists of two sub-models. The first sub-model focuses on summarizing text
documents, providing concise and coherent summaries of large textual data. The second
sub-model is designed to answer user queries related to the content of the provided
documents, facilitating efficient information retrieval and enhancing user interaction with
the document's content. This chapter aims to detail the design, implementation, and
evaluation of these sub-models, highlighting their functionalities, integration, and overall
performance in analyzing and interpreting textual information.
5.2 Introduction:
In the rapidly evolving field of artificial intelligence, the ability to process and understand
large volumes of textual data has become increasingly important. The project described
in this chapter focuses on the creation of an AI-powered document analyzer designed to
enhance the efficiency and accuracy of text analysis. This tool incorporates two key
functionalities: the ability to summarize lengthy text documents and the capability to
answer user queries based on the content of the provided documents. These features aim
to streamline information retrieval and improve user interaction with complex textual
data.
The first sub-model of the AI document analyzer is dedicated to text summarization. This
component is engineered to process extensive text documents, extracting the most critical
information to generate concise and coherent summaries. The summarization capability is
essential for users who need to quickly grasp the main points of lengthy documents
without reading them in their entirety. This functionality leverages advanced natural
language processing (NLP) techniques to ensure that the summaries are both accurate and
meaningful, retaining the essence of the original text while reducing its length.
The second sub-model focuses on answering user queries related to the content of the
documents. This feature allows users to input specific questions and receive detailed,
contextually relevant answers based on the analyzed documents. By integrating
sophisticated NLP algorithms and leveraging a deep understanding of the document's
content, this sub-model enhances the user experience by providing precise and
informative responses. Together, these sub-models form a comprehensive AI document
                                                                                   43 | P a g e
analyzer that significantly improves the efficiency and effectiveness of handling large
textual datasets.
Data collection and preprocessing form another critical step. This involves gathering a
large corpus of text data for training and evaluation, followed by data cleaning to remove
irrelevant information and correct errors. Data annotation is necessary to label data for
tasks such as summarization or question-answering, enabling the training of supervised
models. Creating training and test sets helps in evaluating model performance accurately.
Understanding different summarization techniques is also essential. Extractive
summarization involves identifying and extracting key sentences or phrases, while
abstractive summarization generates new sentences that capture the essence of the
original text, often requiring more advanced models and a deep understanding of
language.
                                                                                44 | P a g e
5.4 Methodology:
1. Environment Setup
The first step involves setting up the development environment. This includes
configuring a server using Express.js to handle HTTP requests and responses. The
environment is further configured with the help of dotenv to manage environment
variables securely. The OpenAI API is integrated into the project to utilize advanced
language models for document processing and analysis.
                                                                                   45 | P a g e
ensures that users receive clear feedback in case of errors and that files are managed
securely.
  Fig 5.1 Code overview of the assistant's instructions and document storage in vector
                                       space.
                                                                                46 | P a g e
5.5 Results:
                                                          47 | P a g e
                    Fig 5.3 Model accurately answered the user query.
5.6 Conclusion:
1. Summarization Accuracy: The summarization model produced concise and accurate
   summaries, effectively capturing essential information from lengthy documents. High
   ROUGE scores confirmed the quality of the summaries.
3. System Performance and Scalability: The system performed reliably under various
   loads, efficiently managing document analysis and user queries, demonstrating robust
   performance and scalability.
                                                                                48 | P a g e
                    Chapter-6
  Design and Development of a Multilingual Speech-to-
                    Text AI Model
6.1    Objective:
The objective of the Design and Development of a Multilingual Speech-to-Text AI Model
project at BCCL is to develop a state-of-the-art system that can accurately and efficiently
convert voice notes (in MP3 format) from reporters into written text across multiple
languages. This project aims to streamline the workflow of reporters by providing a
reliable tool for transcribing spoken content into text, thereby enhancing the speed and
accuracy of news reporting. By supporting a wide range of languages and dialects, the
model ensures that reporters from diverse linguistic backgrounds can utilize this
technology. Key goals include achieving high accuracy in speech recognition for each
supported language, enabling efficient transcription to facilitate timely news
dissemination, and incorporating adaptive learning features to continually improve the
model’s performance.
6.2    Introduction:
In the rapidly evolving landscape of digital journalism, the ability to quickly and
accurately transcribe and translate spoken content into written text is becoming
increasingly vital. The Design and Development of a Multilingual Speech-to-Text AI
Model project at BCCL aims to address this critical need by creating an advanced system
capable of converting voice notes, specifically in MP3 format, from reporters into text
across multiple languages. This project is designed to streamline the workflow of
journalists, enhancing the speed and accuracy of news reporting, and ensuring
accessibility for reporters from diverse linguistic backgrounds.
                                                                                  49 | P a g e
   and promotion of linguistic diversity. The seamless integration of this AI model with
   BCCL’s existing digital infrastructure will provide a user-friendly interface that
   minimizes errors and maximizes productivity, ultimately setting a new standard for
   multilingual news transcription and translation in the industry.
2. Data Collection:
 Gather a diverse dataset of audio recordings in various languages and dialects to train and
test the model.
 Ensure that the dataset includes a variety of accents, speech patterns, and audio qualities
to enhance model robustness.
                                                                                  50 | P a g e
6.4   Methodology:
6.4.1 Methodology for Transcription
 1.   Setup and Initialization:
      OpenAI Initialization:
      - Instantiate the OpenAI client to interact with OpenAI's models for transcription
      and translation.
      Endpoint Definition:
      - Define an Express.js route (/transcribe) to handle POST requests for file
      uploads.
      - Use multer middleware to process single file uploads, storing the file in the
      specified directory.
3. Transcription Process:
      File Processing:
      - Extract the file path from the uploaded file.
      - Use OpenAI's Whisper model to transcribe the audio file by reading the file
      stream (fs.createReadStream(filePath)).
                                                                               51 | P a g e
    4.    Text Correction and Formatting:
          Conversation Setup:
          - Define a conversation for the OpenAI GPT-4 model, including a system prompt
          instructing the model to correct grammar errors, remove offensive language, and
          organize content into clear paragraphs.
          - Pass the transcribed text to the model as the user input.
          GPT-4 Interaction:
          - Create a completion request to the GPT-4 model with the defined conversation,
          specifying parameters like max_tokens, temperature, top_p, frequency_penalty,
          and presence_penalty.
          Text Formatting:
          - Extract the corrected and formatted text from the GPT-4 model's response.
          - Replace newline escape sequences with actual newline characters for
          readability.
5. Response Handling:
          JSON Response:
          - Send the corrected and formatted text back to the client as a JSON response.
6. Server Configuration:
          Port Setup:
          - Define the port on which the Express.js server will run (process.env.PORT ||
          3000).
          Server Initialization:
          - Start the Express.js server and log a message indicating the server is running.
          Importing Modules:
          - Import necessary modules including express, multer, fs, and OpenAI to handle
          server setup, file upload, and interaction with OpenAI's models.
                                                                                   52 | P a g e
          Initializing Express App:
          - Create an instance of the Express application.
          Multer Configuration:
          - Configure multer for file storage, specifying the destination folder (./uploads)
          and the naming convention for uploaded files (appending a timestamp to the
          original file name).
          Setting Up Routes:
          - Define an endpoint (/transcribe) using Express.js to handle POST requests for
          file uploads.
          - Use multer middleware to process single file uploads, storing the file in the
          specified directory.
          Transcription Request:
          - Use OpenAI’s Whisper model to transcribe the audio file by reading the file
          stream (fs.createReadStream(filePath)).
          - Capture the transcription text from the response.
          JSON Response:
          - Send the translated and corrected text back to the client as a JSON response.
                                                                                     53 | P a g e
7. Server Configuration:
         Port Setup:
         - Define the port on which the Express.js server will run (process.env.PORT ||
         3000).
         Server Initialization:
         - Start the Express.js server and log a message indicating the server is running.
6.5 Results:
Fig 6.1 Transcribed text for the given mp3 file as input
                                                                                  54 | P a g e
                              Fig 6.2 Translated and Paraphrased Text
   6.6 Conclusion:
   The Design and Development of a Multilingual Speech-to-Text AI Model project at
   BCCL represents a significant advancement in the field of digital journalism. By creating
   a robust and reliable system capable of accurately converting voice notes into written text
   across multiple languages, the project addresses a critical need for timely and precise
   news reporting. The implementation of state-of-the-art speech recognition technology,
   exemplified by OpenAI's Whisper model, and the utilization of advanced natural
   language processing capabilities through GPT-4, ensure high accuracy and adaptability in
   transcription and translation tasks.
   This project's success is marked by several key achievements:
1. Enhanced Workflow Efficiency: The system streamlines the transcription process for
   reporters, significantly reducing the time and effort required to convert spoken content
   into written text. This efficiency gain directly translates to quicker news dissemination
   and more timely reporting.
2. Broad Language Support: By supporting a wide range of languages and dialects, the
   model
   ensures inclusivity and accessibility for reporters from diverse linguistic backgrounds.
   This capability fosters greater linguistic diversity in news reporting and enables a broader
   audience reach.
                                                                                    55 | P a g e
3. Adaptive Learning: The incorporation of adaptive learning features allows the model to
   continually improve its performance over time. This ensures that the system remains
   reliable and effective, adapting to new speech patterns and languages as they emerge.
4. Preservation and Promotion of Linguistic Diversity: The project not only enhances
   operational efficiency but also contributes to the preservation and promotion of linguistic
   diversity in journalism. By accurately transcribing and translating content across multiple
   languages, the system supports the representation of various linguistic communities in
   news media.
                                                                                   56 | P a g e
                             Chapter-7
                   Enhancement of Live Speech-to-Text
    7.1 Objective:
    To develop and enhance a real-time speech-to-text system that accurately transcribes
    spoken language into written text with high precision and minimal latency. The ultimate
    goal is to support various applications within BCCL, including live broadcasting,
    automated captioning, and assistive technologies for individuals with hearing
    impairments, thereby enhancing accessibility and communication across diverse
    audiences.
    7.2 Introduction:
    The ability to accurately transcribe spoken language into written text in real-time has
    become an essential technology in various fields, from media broadcasting to assistive
    communication tools. As the demand for seamless and accurate live transcription services
    increases, there is a growing need to enhance existing speech-to-text systems to achieve
    higher precision and reliability. The "Enhancement of Live Speech-to-Text" project at
    BCCL focuses on advancing current speech recognition technologies to meet these
    demands.
    This project aims to develop a robust real-time speech-to-text system that leverages the
    latest advancements in machine learning and natural language processing (NLP). By
    integrating cutting-edge algorithms and state-of-the-art speech recognition techniques,
    the project seeks to improve the accuracy, speed, and reliability of live transcriptions. The
    enhanced system will support various applications within BCCL, including live
    broadcasting, automated captioning, and assistive technologies for individuals with
    hearing impairments.
    The project's ultimate goal is to provide a high-quality, accessible solution that enhances
    communication and accessibility across diverse audiences, ensuring that spoken content
    is effectively and accurately transcribed into written text in real-time.
                                                                                     57 | P a g e
   7.4     Methodology:
   Import Libraries:
   The AssemblyAI library is imported to facilitate real-time transcription of audio data.
   The time library is commented out, indicating it might be used for additional features
   like timing or delays, but is not essential for the current implementation.
   Error Handling:
   This function handles errors that may occur during the transcription process, printing
   the error details for debugging purposes.
   Session Closed:
   This function handles the event when a transcription session is closed, indicating the
   end of the session.
   Data Handling:
   This function handles incoming transcript data. It first checks if the transcript
   contains any text. If it is a final transcript, it prints the text with a new line.
3. Transcriber Initialization
   A RealtimeTranscriber instance is created with a specified sample rate and the
   previously defined event handlers. This instance will manage the real-time
   transcription process.
4. Transcriber Connection
   The transcriber connects to the AssemblyAI service, initiating the transcription
   session.
                                                                                   58 | P a g e
5. Microphone Stream Setup
   A MicrophoneStream object is created to capture audio from the microphone at the
   specified sample rate.
                                                                               59 | P a g e
7.6 Results:
   7.7 Conclusion:
   The implementation of real-time transcription using AssemblyAI proved to be efficient
   and effective. The methodology employed facilitated a robust transcription process,
   handling audio data in real-time and managing session events proficiently. The results
   demonstrated high accuracy and performance, making it a reliable solution for real-time
   audio transcription needs. The overall user experience was positive, with minimal issues
   encountered during the testing phase.
                                                                                 60 | P a g e
                        Chapter-8
        Development of an AI Content Generation Model
   8.1 Objective:
   To design, develop, and implement an AI-powered content generation model capable of
   producing high-quality, contextually relevant, and engaging textual content across
   various domains. The model aims to leverage advanced artificial intelligence to
   understand and emulate human language patterns, ensuring coherence, creativity, and
   accuracy in generated content. The ultimate goal is to enhance productivity, support
   creative processes, and meet the diverse content needs of users and organizations.
   8.2 Introduction:
   The rapid advancements in artificial intelligence (AI) and natural language processing
   (NLP) have opened new frontiers in automated content generation. In an era where the
   demand for high-quality, contextually accurate, and engaging content is ever-increasing,
   the development of AI-powered models capable of generating human-like text has
   become a crucial innovation. This project focuses on the development of an AI content
   generation model designed to produce coherent and contextually relevant textual content
   across various domains.
   8.3 Methodology:
1. Setup and Configuration:
          Environment Configuration:
              Import necessary libraries including express for server setup and
                Anthropic for interaction with the AI model.
              Load environment variables using dotenv to manage sensitive data such as
                the API key securely.
                                                                                 61 | P a g e
          API Key Setup:
             Store the API key for Anthropics in environment variables and retrieve it
                using process.env.
2. Server Initialization:
          Express Application Setup:
               Initialize an Express application and set up the server to listen on a
                  specified port (e.g., 3000).
               Use the express.text() middleware to handle incoming text data in POST
                  requests.
4. Endpoint Creation:
         POST Endpoint for Content Generation:
             Define a POST endpoint (/generate) to handle incoming content
               generation requests.
             Extract the prompt from the request body and validate it to ensure it is not
               empty.
          Response Handling:
              Parse the response from the AI model and filter for text content.
              Concatenate the filtered text content into a coherent response.
              Send the generated content back to the client as a plain text response.
6. Error Handling:
         Request Validation:
             Return a 400 Bad Request status if the prompt is missing or invalid.
         Exception Management:
             Catch and log any errors that occur during the content generation process.
                                                                                62 | P a g e
                 Return a 500 Internal Server Error status if an error occurs while
                  processing the request.
7. Server Execution:
          Server Listening:
         Start the Express server and log the URL where the server can be accessed (e.g.,
         http://localhost:3000).
Fig 8.1 Code Overview: Handling Prompt Reception and Transmission to the Model
                                                                                   63 | P a g e
   8.4 Results:
Fig 8.2 User Query and Response Utilizing the Anthropic Model
   8.5 Conclusion:
1. Utilized Anthropics' model claude-3-sonnet-20240229 for content generation.
3. Robust error handling with meaningful error messages and HTTP status codes.
                                                                                 64 | P a g e
                                    Chapter-9
                                   Future Work
2. Scalability Optimization:
- Enhance the scalability of the detection model to handle the high volume of content
produced by BCCL across its various media outlets, ensuring consistent performance and
reliability.
                                                                                65 | P a g e
4. Multi-Language Support
- Expand the model to support multiple languages, catering to Times Group’s diverse
audience. This includes integrating translation APIs and developing language-specific
models.
                                                                              66 | P a g e
summaries and query responses to individual users, making interactions more relevant
and efficient.
5. Collaboration Features
Adding collaboration features that allow multiple users to interact with the same
document simultaneously could enhance team productivity. Features such as shared
annotations, real-time collaboration, and version control would make the AI Document
Analyzer a valuable tool for collaborative document analysis.
                                                                              67 | P a g e
3. Multi-Modal Integration
Exploring the integration of multi-modal inputs, such as combining speech recognition
with image and text analysis, can enhance the overall functionality of the system. This
approach can provide a more comprehensive understanding of the content, enabling
richer and more accurate transcriptions and translations.
                                                                                 68 | P a g e
                                           References
4.   Bing Custom Search API Quickstart Guide: Quickstart: Call your Bing Custom Search
     endpoint using Node.js - Bing Search Services | Microsoft Learn
                                                                                  69 | P a g e
                                   Reflective Dairy
29 January, 2024:
 Introductory meeting with the manager
 Brief introduction to the team
 Discussion about different departments
 Summary of my previous projects
30 January, 2024:
 Provided an overview of the organization's work culture.
 Presented the current products and applications they are developing and gave a brief explanation
of my project.
 Asked me to explore various foundational AI modules.
31 January, 2024:
 Investigated various AI modules, including: AWS Bedrock base models, such as Stability AI,
Claude Model, and Titan Text G1 Express, OpenAI models
 Reviewed the OpenAI documentation.
1 February, 2024:
 Gained knowledge on using the OpenAI API key.
 Understood the various factors influencing the API key and their impact on the model's
performance, including: Temperature, Maximum tokens, Top_p, Number of responses (N),
Frequency penalty, Presence penalty
2 February, 2024:
Investigated various AI image generation models, including: DALL-E, MidJourney, Stability AI,
Imagen, Adobe Firefly
Reviewed the full documentation for each model.
Evaluated the advantages and disadvantages of each model to improve outcomes.
                                                                                      70 | P a g e
5 February, 2024:
Delivered a presentation outlining the advantages and disadvantages of various image generation
models.
Engaged in a discussion about the AI models that are available for text generation and text
summarization.
6 February, 2024:
Received the details or credentials for the API key.
Provided with a full walkthrough of the code for the proof of concept project we are developing.
7 February, 2024:
Tasked with reviewing the text and images generated by AI models for profanity and copyright
issues.
Researched various AI models and websites for profanity checks, including: writuverify.com,
zakkie.com, membrace.ai, Profanity check application
8 February, 2024:
Created a presentation on the various profanity check models I discovered.
The presentation distinguished the models based on:
               - Their accuracy levels
               - The number of parameters they were trained on
               - The number of training epochs
               - The suitability of their APIs for business-related purposes
9 February, 2024:
Assigned to explore the Google Gemini model.
Evaluated AI models including Gemini Ultra, Gemini Pro, GPT-4, GPT-3.5, Claude 2, and
LLaMA-2 on tasks such as math problems, coding challenges, essay-related tasks, and multiple-
choice questions, and assessed their accuracy.
Studied React.
Investigated available models for detecting copyright infringement.
                                                                                      71 | P a g e
12 February, 2024:
Began studying React.
Further researched copyright infringement detection models, including:
               - Pex for video and audio content
               - TinyEye for images
               - CopyScape for text
               - Pixsy for images
Decided to use TinyEye and CopyScape from the researched models.
13 February, 2024:
Investigated how CopyScape operates in Python, including its functions, libraries, and
parameters.
Developed a basic mini chatbot using OpenAI.
14 February, 2024:
Studied Node.js.
Developed the frontend of the project utilizing CSS and JavaScript.
15 February, 2024:
Attempted to implement a profanity check using OpenAI instead of relying on a third-party
application.
Developed code to detect profanity in text.
16 February, 2024:
Held a meeting to review the progress of the work.
Explored available APIs for retrieving the source code of text generated by AI models.
Identified two suitable APIs:
               - Bing Search API
               - Google Custom Search API
                                                                                         72 | P a g e
19 February, 2024:
Created and deployed a Python model to retrieve the source of text content.
Developed a model that provides the title, link, and snippet for the given query.
20 February, 2024:
Recreated the work from the previous day using Node.js.
Started learning Express.js.
21 February, 2024:
Developed copyright infringement detection code utilizing the CopyScape API with both Python
and Node.js.
22 February, 2024:
Employed OpenAI for profanity checking by manually inputting 100 swear words to obtain
results.
Retrieved a tabular dataset from the internet to test with OpenAI and analyze the outcomes.
23 February, 2024:
Created prompts to evaluate the model's use case and identify any existing bugs.
Conducted tests on a 10,000-row dataset using OpenAI, generated results for various potential
queries, and manually compared these results with the dataset.
                                                                                     73 | P a g e
26 February, 2024:
Studied the documentation and researched the implementation of the Bing API.
Conducted extensive testing of the implementation in a controlled testing environment.
Identified and resolved errors through debugging.
27 February, 2024:
Studied the root routes in Express.js.
Gathered a dataset for testing with OpenAI.
28 February, 2024:
Gathered additional datasets related to court cases.
Assessed a court case PDF dataset using OpenAI.
Manually reviewed and analyzed the results and outcomes of the queries.
29 February, 2024:
Examined a dataset of medical papers using OpenAI and assessed the accuracy of the results.
1 March, 2024:
Presented findings on the accuracy and effectiveness of OpenAI in analyzing court cases and
medical report documents.
Investigated available AI tools to enhance the accuracy of the aforementioned analysis.
                                                                                     74 | P a g e
4 March, 2024:
Deployed the project live using Gemini Pro, applying the same foundational concept.
Implemented the solution using Python and Node.js.
5 March, 2024:
Conducted testing with Gemini Pro.
Developed multiple prompts to evaluate its accuracy and delivered a presentation.
Highlighted the incorrect outputs generated by the model and compared its precision with other
models we used.
6 March, 2024:
Studied Express.js.
Tried to use the OpenAI API key to develop a model for analyzing Excel files.
7 March, 2024:
Began studying the OpenAI Assistant API keys, including reviewing its documentation and
functionality.
Developed a minor project utilizing the OpenAI Assistant API.
8 March, 2024:
Attempted to analyze tabular data using the Assistant APIs.
Developed a workflow for the aforementioned model.
                                                                                      75 | P a g e
11 March, 2024:
Assigned to develop a model for analyzing writing patterns and styles from text extracted from
URLs.
Conducted web scraping to obtain paragraph text from URLs.
12 March, 2024:
Developed a model using an OpenAI API key to perform the previously mentioned task.
Encountered multiple errors during the process.
Managed to fix some of the errors.
13 March, 2024:
Fixed all errors from the previous day and attempted to implement the model using the OpenAI
Assistant API key.
The model operated successfully, accomplishing all tasks, and was submitted for review.
14 March, 2024:
Investigated the OpenAI assistant API keys.
Studied function calling, knowledge retrieval, and code interpretation.
15 March, 2024:
Assigned to create a model for analyzing text in PDF or Word documents, summarizing the
model's output and addressing the user's query.
Researched models utilizing knowledge retrieval and vector databases, gaining insights into their
backend operations.
Created a flowchart for navigation.
                                                                                      76 | P a g e
18 March, 2024:
Started developing the PDF document analysis model using the Assistant APIs and the
knowledge retrieval model with the OpenAI API key.
Created a Python model to perform the described operation.
19 March, 2024:
Fixed all compiler and API errors encountered by the model.
Tested the model with over 70 different PDF files.
Measured the model's accuracy.
20 March, 2024:
Showcased the model to my manager, detailing its advantages, disadvantages, and use cases.
Was then asked to convert the model to Node.js code for frontend deployment.
21 March, 2024:
Translated the code to Node.js and confirmed its functionality.
Once the results were satisfactory, the hardcoded file was changed to Express.js and tested using
POSTMAN.
Submitted the code for further testing by senior management to identify and address any bugs.
22 March, 2024:
Tasked with researching and understanding the Anthropic Models, and comparing their accuracy
to other similar models.
Reviewed the documentation and operation of the Anthropic API.
                                                                                      77 | P a g e
26 March, 2024:
Created two text generation models using Anthropic API keys: one for streaming messages and
another for generating simple response messages.
Evaluated the functionality of the existing text generation model against the Anthropic model,
analyzing the content quality and response accuracy in both models.
27 March, 2024:
Corrected the issue where the PDF Analyzer model failed to display results in POSTMAN.
Fixed the API bug.
Tested the fix using over 100 papers and 300 questions to ensure the bug was resolved.
28 March, 2024:
Persisted with testing and successfully resolved the bug.
Submitted the code for further production, preparing to go live on the platform.
29 March, 2024:
Assigned to research various audio-to-text converter models, transcribe the audio files, and
format the text into coherent paragraphs.
Investigated the OpenAI Whisper model, Google Cloud speech-to-text model, and the AWS
model for similar tasks.
Compiled and presented the advantages and disadvantages of each model.
                                                                                      78 | P a g e
1 April, 2024:
Developed a speech-to-text model utilizing AWS Transcribe services.
Fixed the issues related to connecting the model with the microphone.
2 April, 2024:
Created a basic frontend website to utilize the AWS Transcribe functionality.
Connected the frontend interface with the backend model.
3 April, 2024:
Created a model for transcription and translation using the OpenAI Whisper model.
Attempted to develop a live speech-to-text model.
4 April, 2024:
Investigated the Google model and AssemblyAI models for live speech-to-text transcription.
Began developing logic using Python's built-in functions.
5 April, 2024:
Developed a live speech-to-text model using Python's built-in libraries, but it was rejected due to
delayed but accurate results.
Tested the Amazon STT model, which also resulted in lagged outputs.
                                                                                        79 | P a g e
8 April, 2024:
Developed the model using AssemblyAI API keys.
Fixed several microphone-related issues and other bugs.
9 April, 2024:
Began developing a new model to process Excel sheets, providing summaries and responding to
user queries based on the input data.
10 April, 2024:
Began investigating available APIs and models for similar functionalities.
Fixed network latency issues in the PDF analysis model.
11 April, 2024:
Examined the documentation to understand the code interpreter functionality provided by
OpenAI Assistant APIs.
Began coding to implement this functionality.
12 April, 2024:
Started coding to implement the summary functionality for the model.
Fixed new issues that arose in the CopyScape model.
                                                                                    80 | P a g e
15 April, 2024:
Submitted the code to summarize the Excel file.
Began working on extracting meta-attributes.
16 April, 2024:
Removed unnecessary content and tags from the output and paraphrased it for summarization.
Submitted the code for extracting meta-attributes.
17 April, 2024:
Translated the summarization and meta-attributes code into ExpressJS.
Tested the code with over 50 datasets, each containing more than 200,000 rows.
18 April, 2024:
Received approval for the summarization and meta-attributes code.
Connected the approved models to the frontend interface.
19 April, 2024:
Began developing functionality to generate graphs as output.
Investigated methods to create graphs from OpenAI based on Excel sheet data and integrate them
with the frontend.
Explored ways to display the generated graphs in the frontend interface.
                                                                                   81 | P a g e
22 April, 2024:
Began creating prompts to generate accurate graphs.
Reviewed the Assistant API documentation for guidance.
23 April, 2024:
Developed code to generate 3 graphs and output them in PNG format.
24 April, 2024:
Modified the code to improve data visualizations.
Further paraphrased the output from the summarization model for better clarity.
25 April, 2024:
Learned the method to display PNG images in Postman for testing purposes.
Fixed the issue of incorrect image generation.
26 April, 2024:
Developed a code to provide a concise summary of the graph's display, including the underlying
logic, a brief overview of the graph, and the trends identified from the analysis.
                                                                                    82 | P a g e
29 April, 2024:
Eliminated irrelevant content from the text output and organized the content according to the
graph model's sequence.
Created a summary with appropriate line breaks, ensuring no profanity was included.
30 April, 2024:
Began the process of converting graphs from PNG format to Base64 format.
Sought guidance and hints from GitHub, YouTube, and Google.
2 May, 2024:
Created the code to convert the graph into Base64 format.
Fixed all the linking errors in the model.
3 May, 2024:
Verified the code for graph generation and its text output using POSTMAN.
Performed testing on more than 25 documents.
Created two sub-models:
       - A model that randomly selects 2 graphs from the sheet.
       - A model that allows users to query any graph and receive it as output.
                                                                                      83 | P a g e
6 May, 2024:
Completed the second phase of the model, focusing on obtaining graph outputs based on user
queries.
Successfully developed the prompt and submitted the model for evaluation.
7 May, 2024:
Resolved graph-related issues as per my manager's feedback.
Improved the prompt by making it more concise and providing clearer explanations.
8 May, 2024:
Integrated the graph model with the frontend interface.
9 May, 2024:
Began developing the next section of the module to handle user queries about the Excel
document and compute the corresponding output.
Investigated the built-in Python tools available for performing these computations.
10 May, 2024:
Began developing the module utilizing Python's built-in libraries such as NumPy and Pandas.
Reviewed the documentation for the Bing API.
                                                                                       84 | P a g e
13 May, 2024:
Attempting to resolve the issue with Python libraries was unsuccessful, so the Assistant API was
employed to address the problem.
Successfully developed code to handle user queries.
14 May, 2024:
Conducted extensive testing of the model using more than 70 documents and over 210 questions.
15 May, 2024:
Integrated the backend model with the frontend website.
Successfully finished all tasks related to the tabular format data.
16 May, 2024:
Began utilizing the BING API to achieve functionality similar to Google Custom Search, but
with searches restricted to the Times of India website.
Addressed and resolved issues related to API keys and custom configuration ID.
17 May, 2024:
Developed code to utilize the BING API, successfully obtaining output in the form of URLs to
websites along with brief summaries.
Submitted the code for review.
                                                                                     85 | P a g e
20 May, 2024:
Demonstrated the gamma.ai website.
Discussed upgrading from GPT-4 to GPT-4.0 and the necessary modifications to our model to
improve speed.
21 May, 2024:
Converted all PDF analysis models into sub-modules.
Modified the code to accommodate the upgrades for Data Analysis Model.
22 May, 2024:
Enhanced the Document Analyzer with upgrades.
Incorporated web scraping to extract text from any URL.
Implemented NLP techniques to analyze writing patterns of the scraped text.
23 May, 2024:
Utilized the GPT-4o model to analyze writing patterns in conjunction with NLP techniques.
Attempted to embed the analyzed patterns into Google Docs.
24 May, 2024:
Developed a model to scrape text from any URL.
Incorporated translation for text in languages other than English.
Embedded the translated text into Google Docs.
86 | P a g e