├── restartRuntime.png ├── SoMoE-BEatChatGPT.jpg ├── README.md ├── Article-edited.txt ├── Article-original.txt ├── What is Entrepreneurship 5 Factors Affecting Ent.txt └── Persistent_RISE_FreeAI_Agents.ipynb /restartRuntime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabiomatricardi/How-I-Built-a-Chatbot-that-Crushed-ChatGPT/HEAD/restartRuntime.png -------------------------------------------------------------------------------- /SoMoE-BEatChatGPT.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabiomatricardi/How-I-Built-a-Chatbot-that-Crushed-ChatGPT/HEAD/SoMoE-BEatChatGPT.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # How I Built a Chatbot that Crushed ChatGPT with Zero Cost AI Tools 2 | Repo of the code from the Medium article 3 | 4 | 5 | 6 | --- 7 | 8 | Challenge Accepted! How I created a chatbot that surpassed the performance of the famous ChatGPT model using free and open source AI tools that you can use too. 9 | 10 | ### The SoMoE way 11 | I think that the best way to approach a text we don't know anything about consists at least of 2 steps: 12 | - read a summary 13 | - get an idea of the main questions about that text 14 | 15 | You can find in the GiHub repo 2 Google Colab notebook: one that runs only with CPU, one that you can use with a free T4 instance (GPU). 16 | -------------------------------------------------------------------------------- /Article-edited.txt: -------------------------------------------------------------------------------- 1 | Apple's iOS App Store announces sweeping changes in the EU 2 | https://www.axios.com/2024/01/25/apple-app-store-eu-changes 3 | Author: Ashley Gold, author of Axios Pro 4 | 5 | 6 | Apple will allow alternative app stores and other new options for app developers in order to comply with Europe's Digital Markets Act, the company said Thursday. 7 | 8 | Driving the news: Europe's major tech competition law, set to go into effect March 7, requires Apple to loosen its strict rules requiring developers to rely on the App Store for distribution and payment processing. 9 | 10 | Apple has long resisted any changes to its App Store rules, citing security and privacy. The company also argues its services for developers are best-in-class and ensure smooth user experiences free of spam or harmful content. 11 | 12 | Why it matters: Apple is being forced to make sweeping changes to one of its flagship "walled garden" systems in what some smaller companies are seeing as a major win. 13 | 14 | Spotify previewed what its app will look like in Europe post-March 7 this week. 15 | Apple said it has been in touch with developers about the coming changes and that its compliance adheres to the letter of the law. 16 | 17 | What they're saying: Apple is making these changes with the caveat that the company has done everything it can to ensure iOS devices remain secure and malware-free, but it has no plans to expand these options outside of Europe, citing risk. 18 | 19 | The company believes that after the DMA-imposed changes go through, people will start to understand why Apple has maintained its strict policies for developers. 20 | "Across every change, Apple is introducing new safeguards that reduce — but don't eliminate — new risks the DMA poses to EU users," the company said in a release. 21 | 22 | Yes, but: Apple is also introducing new fee structures for developers who take advantage of the new freedoms. 23 | 24 | Details: As part of iOS 17.4, Apple will charge a "core technology fee" of €.50 for "each first annual install per year" for developers whose apps have achieved more than 1 million downloads, to be counted once per Apple account. 25 | 26 | That fee will apply to apps that switch to their own marketplaces or remain on the App Store. Apple says the fee "reflects the many ways Apple creates value for developers' businesses." 27 | The App Store commission, for developers who continue to use it, will drop from 30% to 17%. The discounted rate for certain developers will drop from 15% to 10%. 28 | No commission will be charged to developers who want to distribute and facilitate in-app payments outside of the App Store. Apple said that approximate 99% of developers will pay the same or less in fees. 29 | 30 | Go deeper: The iOS changes will include notarization for iOS apps, authorization for marketplace developers and disclosures on alternative payments. Apple says in the release that if apps opt out of Apple's system, the company "has less ability to address other risks" like "scam, fraud, abuse" or "objectionable or harmful" content. 31 | 32 | Users in the EU will also see a browser choice screen in iOS 17.4 to pick a default browser. 33 | 34 | The other side: Epic Games CEO Tim Sweeney said on X: "Apple's plan to thwart Europe's new Digital Markets Act law is a devious new instance of Malicious Compliance... Epic has always supported the notion of Apple notarization and malware scanning for apps, but we strongly reject Apple's twisting this process to undermine competition and continue imposing Apple taxes on transactions they're not involved in." 35 | 36 | What to watch: It's up to the European Commission to determine whether Apple's plan fully complies with the DMA. iPhone app developers face a whole new world of choices, and time will tell if the changes boost competition and improve experiences for users. 37 | -------------------------------------------------------------------------------- /Article-original.txt: -------------------------------------------------------------------------------- 1 | Apple's iOS App Store announces sweeping changes in the EU 2 | https://www.axios.com/2024/01/25/apple-app-store-eu-changes 3 | 4 | Skip to main content 5 | Axios Homepage 6 | Sections 7 | Local news 8 | Axios Pro 9 | About Axios 10 | Sign up 11 | Log In 12 | Jan 25, 2024 - 13 | Technology 14 | Apple announces sweeping EU App Store changes 15 | Ashley Gold 16 | , author of 17 | Axios Pro: Tech Policy 18 | Share on facebook (opens in new window) 19 | Share on twitter (opens in new window) 20 | Share on linkedin (opens in new window) 21 | Share on email (opens in new window) 22 | 23 | Illustration: Shoshana Gordon/Axios 24 | 25 | Apple will allow alternative app stores and other new options for app developers in order to comply with Europe's Digital Markets Act, the company said Thursday. 26 | 27 | Driving the news: Europe's major tech competition law, set to go into effect March 7, requires Apple to loosen its strict rules requiring developers to rely on the App Store for distribution and payment processing. 28 | 29 | Apple has long resisted any changes to its App Store rules, citing security and privacy. The company also argues its services for developers are best-in-class and ensure smooth user experiences free of spam or harmful content. 30 | 31 | Why it matters: Apple is being forced to make sweeping changes to one of its flagship "walled garden" systems in what some smaller companies are seeing as a major win. 32 | 33 | Spotify previewed what its app will look like in Europe post-March 7 this week. 34 | Apple said it has been in touch with developers about the coming changes and that its compliance adheres to the letter of the law. 35 | 36 | What they're saying: Apple is making these changes with the caveat that the company has done everything it can to ensure iOS devices remain secure and malware-free, but it has no plans to expand these options outside of Europe, citing risk. 37 | 38 | The company believes that after the DMA-imposed changes go through, people will start to understand why Apple has maintained its strict policies for developers. 39 | "Across every change, Apple is introducing new safeguards that reduce — but don't eliminate — new risks the DMA poses to EU users," the company said in a release. 40 | 41 | Yes, but: Apple is also introducing new fee structures for developers who take advantage of the new freedoms. 42 | 43 | Details: As part of iOS 17.4, Apple will charge a "core technology fee" of €.50 for "each first annual install per year" for developers whose apps have achieved more than 1 million downloads, to be counted once per Apple account. 44 | 45 | That fee will apply to apps that switch to their own marketplaces or remain on the App Store. Apple says the fee "reflects the many ways Apple creates value for developers' businesses." 46 | The App Store commission, for developers who continue to use it, will drop from 30% to 17%. The discounted rate for certain developers will drop from 15% to 10%. 47 | No commission will be charged to developers who want to distribute and facilitate in-app payments outside of the App Store. Apple said that approximate 99% of developers will pay the same or less in fees. 48 | 49 | Go deeper: The iOS changes will include notarization for iOS apps, authorization for marketplace developers and disclosures on alternative payments. Apple says in the release that if apps opt out of Apple's system, the company "has less ability to address other risks" like "scam, fraud, abuse" or "objectionable or harmful" content. 50 | 51 | Users in the EU will also see a browser choice screen in iOS 17.4 to pick a default browser. 52 | 53 | The other side: Epic Games CEO Tim Sweeney said on X: "Apple's plan to thwart Europe's new Digital Markets Act law is a devious new instance of Malicious Compliance... Epic has always supported the notion of Apple notarization and malware scanning for apps, but we strongly reject Apple's twisting this process to undermine competition and continue imposing Apple taxes on transactions they're not involved in." 54 | 55 | What to watch: It's up to the European Commission to determine whether Apple's plan fully complies with the DMA. iPhone app developers face a whole new world of choices, and time will tell if the changes boost competition and improve experiences for users. 56 | 57 | Share on facebook (opens in new window) 58 | Share on twitter (opens in new window) 59 | Share on linkedin (opens in new window) 60 | Share on email (opens in new window) 61 | Go deeper 62 | Ashley Gold 63 | , author of 64 | Axios Pro: Tech Policy 65 | Jan 24, 2024 - 66 | Technology 67 | Spotify previews new EU app with App Store bypass 68 | 69 | Illustration: Sarah Grillo/Axios 70 | 71 | Spotify will unveil a newly designed iPhone app in March that takes advantage of options that weren't possible before the EU's Digital Markets Act takes effect around then, per a preview shared with Axios. 72 | 73 | Driving the news: Thanks to the EU's major tech competition law, Spotify will soon be able to advertise promotions and enable purchases for products like audiobooks in the app without having to go through Apple, and without paying Apple a 30% commission. 74 | 75 | Go deeper (2 min. read) 76 | Share on facebook (opens in new window) 77 | Share on twitter (opens in new window) 78 | Share on linkedin (opens in new window) 79 | Share on email (opens in new window) 80 | Joseph Gallivan 81 | Jan 24, 2024 82 | - 83 | Axios Portland 84 | A trio of Portland landmarks recover, slowly 85 | 86 | Portland's Apple Store lost its good looks when it reopened with plastic windows in 2023. Other landmarks have been slower to return. Photo: Joseph Gallivan/Axios 87 | 88 | Portland still bears the scars of 2020's unrest and lockdown, and change is coming very slowly. 89 | 90 | Why it matters: Missing or marred landmarks affect the image of Portland. With less office workers and tourists on the streets, it can seem like a recovery stalemate. 91 | 92 | Go deeper (1 min. read) 93 | Share on facebook (opens in new window) 94 | Share on twitter (opens in new window) 95 | Share on linkedin (opens in new window) 96 | Share on email (opens in new window) 97 | Kathryn Varn 98 | , author of 99 | Axios Tampa Bay 100 | Jan 25, 2024 101 | - 102 | Axios Tampa Bay 103 | Here's why Pinellas' library app is down 104 | 105 | Illustration: Shoshana Gordon/Axios 106 | 107 | A dispute between vendors has caused outages of library apps across the country — including one in the Tampa Bay area. 108 | 109 | Driving the news: The Pinellas Public Library Cooperative app has been down since late last year. The app's functions, like searching the catalog and placing books on hold, "will not be available for the foreseeable future," per a Q&A on the library's website. 110 | 111 | Go deeper (1 min. read) 112 | Share on facebook (opens in new window) 113 | Share on twitter (opens in new window) 114 | Share on linkedin (opens in new window) 115 | Share on email (opens in new window) 116 | News worthy of your time. 117 | Download the app 118 | About 119 | About Axios 120 | Advertise with us 121 | Careers 122 | Events 123 | Axios on HBO 124 | Axios HQ 125 | Privacy and terms 126 | Accessibility Statement 127 | Online tracking choices 128 | Your Privacy Choices 129 | Contact us 130 | Subscribe 131 | Axios newsletters 132 | Axios Pro 133 | Axios app 134 | Axios podcasts 135 | Courses 136 | Earn Axios rewards 137 | Axios Homepage -------------------------------------------------------------------------------- /What is Entrepreneurship 5 Factors Affecting Ent.txt: -------------------------------------------------------------------------------- 1 | title: What is Entrepreneurship - 5 Factors Affecting Entrepreneurship  2 | author: Lynsey PT from Adamo Software | Predict | Jun, 2024 | Medium 3 | url: https://medium.com/predict/what-is-entrepreneurship-5-factors-affecting-entrepreneurship-4aadad3f161e 4 | 5 | 6 | What is Entrepreneurship — 5 Factors Affecting Entrepreneurship 7 | Ever dreamt of turning your idea into a reality? Explore the world of entrepreneurship! This guide dives into what it means to be an entrepreneur. 8 | Have you ever dreamt of being your own boss, building something from the ground up, and making a positive impact on the world? If so, then entrepreneurship might be the path for you! But what exactly is entrepreneurship? 9 | Entrepreneurship is the process of identifying opportunities, creating new businesses, and taking calculated risks to bring ideas to life. It’s a dynamic and challenging journey filled with both immense rewards and potential setbacks. 10 | I. What is entrepreneurship 11 | The world of business is brimming with established giants and innovative upstarts. But what drives the creation of these new ventures? This is where the concept of entrepreneurship steps in. 12 | Entrepreneurship is the process of identifying opportunities, turning ideas into reality, and creating new businesses. It’s a captivating blend of innovation, initiative, and calculated risk-taking. Entrepreneurs are the trailblazers who: 13 | Spot a gap in the market: They have a keen eye for unmet needs or problems waiting for solutions. 14 | Craft unique solutions: They translate those needs into a product, service, or business model that addresses the identified gap. 15 | Embrace calculated risks: They invest their time, resources, and effort into bringing their vision to life, understanding the potential rewards and challenges that lie ahead. 16 | Build and manage the business: They assemble a team, secure funding, navigate the complexities of running a successful enterprise, and ensure its growth and sustainability. 17 | In essence, entrepreneurship is about taking ownership and turning ideas into action. It’s about being the architect of your own destiny and building something from the ground up. 18 | II. Different types of entrepreneurships 19 | The entrepreneurial spirit manifests in various forms, each with its unique purpose and approach. 20 | Let’s delve into some of the most common types of entrepreneurship ventures: 21 | There are 4 common types of entrepreneurship 22 | 1. Startup entrepreneurship 23 | Often associated with high-growth potential and disruptive innovation, startup entrepreneurship involves launching a new and innovative business. Startups typically focus on technology-driven solutions or entirely new business models. Think Uber revolutionizing transportation or Airbnb shaking up the hospitality industry. These ventures are often characterized by: 24 | Rapid Growth: Startups aim to scale quickly and achieve a dominant market position. 25 | High Risk, High Reward: The potential for significant returns is balanced by the inherent risk of failure in a competitive landscape. 26 | Focus on Technology: Many startups leverage technology to create innovative products or services. 27 | 2. Small business entrepreneurship 28 | The backbone of many communities, small business entrepreneurship centers around establishing a local business that caters to a specific niche or geographic area. Think your friendly neighborhood bakery or a local bookstore. These ventures often prioritize: 29 | Stability and Sustainability: Small businesses focus on building a loyal customer base and providing reliable goods and services within their community. 30 | Community Focus: Understanding and catering to the specific needs of the local market is paramount. 31 | Lower Risk Profile: While growth is still important, small businesses tend to prioritize stability over rapid expansion. 32 | 3. Corporate entrepreneurship (Intrapreneurship) 33 | Innovation doesn’t have to happen outside established organizations. Intrapreneurship fosters a culture of innovation within existing companies. Intrapreneurs are employees who identify and develop new business ideas or products within the larger company structure. They might: 34 | Develop new product lines or services. 35 | Identify new market opportunities. 36 | Streamline internal processes to improve efficiency. 37 | Entrepreneurial ventures benefit from the resources and infrastructure of the established company, but navigating internal approval processes and overcoming resistance to change can be challenging. 38 | 4. Social entrepreneurship 39 | Entrepreneurship can also be a powerful tool for positive social impact. Social entrepreneurship focuses on creating businesses that address social or environmental problems. These ventures aim to generate both financial and social returns, striving for: 40 | Social Impact: The core mission is to create a positive impact on a social or environmental issue, such as poverty, education, or sustainability. 41 | Sustainable Business Model: Social enterprises need to be financially viable to ensure long-term impact. 42 | Community Focus: Social entrepreneurs often work collaboratively with communities to develop solutions that address their specific needs. 43 | Whether you’re passionate about disrupting an industry, building a local haven, or creating positive social change, there’s a type of entrepreneurship that aligns with your vision. 44 | III. Why entrepreneurship important 45 | Entrepreneurship isn’t just about individual journeys and building successful businesses. It plays a crucial role in shaping the economic and social landscape around us. Here’s why entrepreneurship is so important: 46 | 1. Driving Economic Growth: Entrepreneurs are the lifeblood of economic dynamism. By starting new businesses, they create jobs, stimulate competition, and introduce innovative products and services. This fosters a healthy and growing economy for everyone. 47 | 2. Fostering Innovation: Entrepreneurs are constantly pushing boundaries and seeking solutions to problems. Their drive to create something new leads to breakthroughs in technology, business models, and social approaches. This continuous innovation keeps industries evolving and benefits society as a whole. 48 | 3. Job Creation: New businesses create new jobs. In fact, startups and small businesses are responsible for a significant portion of job growth in many economies. Entrepreneurship provides opportunities for people to develop their skills, pursue their passions, and contribute to the community. 49 | 4. Increased Competition: When entrepreneurs enter a market with new ideas, they challenge established players to innovate and improve their offerings. This healthy competition benefits consumers by leading to lower prices, higher quality products and services, and a wider range of choices. 50 | 5. Addressing Social Issues: Social entrepreneurship tackles some of society’s most pressing challenges. By creating businesses focused on social impact, entrepreneurs can address issues like poverty, healthcare access, and environmental sustainability. This contributes to a more just and equitable society. 51 | 6. Building Resilience: A vibrant entrepreneurial ecosystem with a diverse range of businesses makes an economy more resilient to external shocks. New ventures can fill gaps left by failing businesses and offer alternative solutions during challenging times. 52 | 7. Empowering Individuals: Entrepreneurship allows individuals to take control of their destinies and build something meaningful. It fosters self-reliance, creativity, and problem-solving skills, empowering people to shape their own futures and contribute to a more dynamic society. 53 | IV. Important entrepreneurship skills 54 | Important entrepreneurship skills 55 | The world of entrepreneurship is an exciting adventure, but it’s not without its challenges. To navigate the twists and turns successfully, a unique blend of skills and attributes is essential. 56 | Here are some of the most important skills for aspiring entrepreneurs: 57 | 1. Creativity and Innovation 58 | Thinking Outside the Box: Entrepreneurs need to see the world from different perspectives and identify opportunities where others might see only problems. For example, if you want to start a F&B business, you can stay competitive by thinking about adapting lastest technologies such as Restaurant POS System, or develop your own On-demand Odering System. 59 | Generating New Ideas: The ability to come up with innovative solutions and fresh approaches is crucial for creating a successful business. 60 | Adaptability and Iteration: The entrepreneurial journey is rarely linear. Being adaptable and willing to refine your ideas based on market feedback is essential. 61 | 2. Problem-Solving 62 | Identifying Challenges: Entrepreneurs face a constant stream of challenges, from funding hurdles to operational difficulties. Being able to identify and analyze problems effectively is key. 63 | Developing Solutions: Critical thinking skills and the ability to develop creative solutions to overcome obstacles are vital for success. 64 | Resilience: The road to entrepreneurial success is paved with setbacks. Developing resilience and the ability to bounce back from challenges is crucial. 65 | 3. Business Acumen 66 | Understanding Business Fundamentals: Having a solid grasp of core business concepts like marketing, finance, and accounting is essential. You don’t need to be an expert, but a foundational understanding helps make informed decisions. 67 | Financial Literacy: Entrepreneurs need to manage their business finances effectively. Understanding financial statements, budgeting, and fundraising strategies is crucial. 68 | Strategic Planning: Setting clear goals, developing a sound business plan, and making strategic decisions are essential for ensuring your venture’s long-term viability. 69 | 4. Leadership 70 | Vision and Inspiration: Entrepreneurs need a clear vision for their business and the passion to inspire others to believe in that vision. 71 | Team Building: Building a strong and talented team is essential for any business. Entrepreneurs need to be effective leaders who can motivate, delegate, and foster collaboration. 72 | Communication: Clear and concise communication, both within your team and with external stakeholders, is critical for success. 73 | 5. Other Important Skills 74 | Marketing and Sales: Entrepreneurs need to effectively market their products or services and convince customers of their value. 75 | Time Management and Organization: The ability to manage your time effectively and prioritize tasks is crucial when juggling multiple responsibilities. 76 | Networking and Relationship Building: Building strong relationships with potential customers, investors, and partners can significantly benefit your business. 77 | Remember, entrepreneurship is a journey of continuous learning. As you gain experience, you’ll develop and refine your skillset. By focusing on these core areas and fostering a commitment to lifelong learning, you’ll be well-equipped to navigate the exciting and rewarding world of entrepreneurship. 78 | V. Factors affecting entrepreneurship 79 | The path of an entrepreneur is paved with both immense potential and inherent challenges. Several factors can influence the success or failure of an entrepreneurial venture. Here’s a closer look at five key factors that significantly impact entrepreneurship: 80 | Factors affecting entrepreneurship 81 | 1. Market Opportunity 82 | Identifying a Valid Need: The cornerstone of any successful business is a genuine need or problem in the market. Entrepreneurs need to conduct thorough market research to validate their idea, understand their target audience, and ensure there’s a sufficient customer base for their product or service. 83 | Competitive Landscape: It’s crucial to analyze existing competitors, their strengths and weaknesses, and any potential gaps in the market your venture can address. Can you offer a unique value proposition or a more efficient solution? 84 | 2. Funding and Resources 85 | Securing Capital: Launching and growing a business requires financial resources. Entrepreneurs need to explore different funding options, such as personal savings, loans, angel investors, or venture capital. The amount of funding required will depend on the nature and scale of your business. 86 | Access to Resources: Beyond financial capital, entrepreneurs also need access to other resources like technology, talent, and infrastructure. Understanding your resource needs and exploring different channels to secure them is crucial. 87 | 3. Business Model 88 | Sustainability and Profitability: A well-defined business model outlines how your venture will create value for customers, capture a portion of that value through pricing, and ultimately generate sustainable profits. This model needs to be realistic and adaptable based on market feedback. 89 | Scalability: Can your business model be replicated and grow beyond a local market? Consideration for scalability is especially important for startups aiming for high-growth potential. 90 | 4. Team and Talent 91 | Building a Strong Team: The success of any business hinges on the quality of its team. Surrounding yourself with talented and passionate individuals who complement your skillset is essential. Building a diverse and inclusive team fosters innovation and broader perspectives. 92 | Leadership and Delegation: Effective leadership skills are crucial for motivating your team, fostering collaboration, and delegating tasks efficiently. 93 | 5. Regulatory Environment 94 | Understanding Regulations: Every industry has its own set of regulations. Entrepreneurs need to be aware of the legal and regulatory framework that governs their business operations and ensure compliance to avoid any potential obstacles. 95 | Adaptability: Regulatory environments can evolve over time. The ability to adapt your business practices to comply with changing regulations is important for long-term success. 96 | By carefully considering these factors, entrepreneurs can increase their chances of navigating the challenges and maximizing the opportunities within the dynamic world of entrepreneurship. 97 | VI. Step-by-step guide to get started with entrepreneurship 98 | Step-by-step guide to get started with entrepreneurship 99 | The world of entrepreneurship beckons with the promise of innovation, independence, and the chance to make a real difference. If you’re brimming with an idea and ready to embark on this exciting path, here’s a roadmap to guide you through the initial stages: 100 | 1. Validate Your Idea 101 | Market Research: Don’t be afraid to get out there and talk to people! Conduct thorough market research to understand if there’s a genuine need for your product or service. Who is your target audience? What are their pain points? Is there a sufficient market size to sustain your business? 102 | Competitive Analysis: Research your competitors thoroughly. What are their strengths and weaknesses? Can you offer a unique value proposition or a more efficient solution? 103 | 2. Develop a Business Plan 104 | Roadmap to Success: Your business plan serves as a roadmap for your venture. It outlines your vision, mission, target market, marketing strategy, financial projections, and operational plan. While it’s a dynamic document that can evolve as you learn and grow, a well-crafted business plan will help you stay focused and attract potential investors. 105 | Also read: Crafting an Effective Product Launch Strategy: Best Practices and Examples 106 | 3. Secure Funding 107 | Bootstrapping: Many entrepreneurs start by bootstrapping their businesses using personal savings, loans from family and friends, or crowdfunding platforms. 108 | Seeking Investors: For ventures requiring significant capital, exploring options like angel investors or venture capital firms might be necessary. Be prepared to present a compelling pitch that highlights the potential of your business. 109 | 4. Build Your Team 110 | Assemble Your A-Team: Surround yourself with talented and passionate individuals who complement your skillset. Delegate tasks effectively and foster a collaborative environment where everyone feels valued and empowered to contribute. 111 | 5. Choose a Business Structure 112 | Sole Proprietorship, Partnership, LLC, or Corporation? The legal structure you choose for your business can impact taxes, liabilities, and regulations. Consult with a lawyer or accountant to determine the most suitable structure for your venture. 113 | 6. Obtain Necessary Licenses and Permits 114 | Comply with Regulations: Research the licenses and permits required to operate your business legally. Failure to comply can lead to fines and other legal issues. 115 | 7. Launch and Market Your Business 116 | Go Live!: It’s time to unveil your product or service to the world! Develop a strong marketing strategy to reach your target audience and effectively communicate the value proposition of your offering. 117 | 8. Continuously Learn and Adapt 118 | Embrace Feedback: The entrepreneurial journey is a continuous learning process. Be receptive to feedback from your customers and adapt your approach based on market demands. 119 | Stay Agile: The business landscape is constantly evolving. Maintaining a growth mindset and being adaptable to change will allow you to navigate challenges and capitalize on new opportunities. 120 | Remember, this is just the first step on your exciting entrepreneurial journey. With dedication, resilience, and a willingness to learn, you can turn your innovative ideas into a thriving business and make a meaningful impact on the world. 121 | -------------------------------------------------------------------------------- /Persistent_RISE_FreeAI_Agents.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 0, 4 | "metadata": { 5 | "colab": { 6 | "provenance": [], 7 | "authorship_tag": "ABX9TyM9UlKw4Kxg3Mg6ILt72KVN", 8 | "include_colab_link": true 9 | }, 10 | "kernelspec": { 11 | "name": "python3", 12 | "display_name": "Python 3" 13 | }, 14 | "language_info": { 15 | "name": "python" 16 | } 17 | }, 18 | "cells": [ 19 | { 20 | "cell_type": "markdown", 21 | "metadata": { 22 | "id": "view-in-github", 23 | "colab_type": "text" 24 | }, 25 | "source": [ 26 | "\"Open" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "source": [ 32 | "# Tests to create FREE AI AGENTS" 33 | ], 34 | "metadata": { 35 | "id": "FFyfgHcnsur2" 36 | } 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": 1, 41 | "metadata": { 42 | "colab": { 43 | "base_uri": "https://localhost:8080/" 44 | }, 45 | "id": "_mXrrYRj0VW8", 46 | "outputId": "731964aa-2a76-4c53-afce-31dcc5b012f0" 47 | }, 48 | "outputs": [ 49 | { 50 | "output_type": "stream", 51 | "name": "stdout", 52 | "text": [ 53 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m401.7/401.7 kB\u001b[0m \u001b[31m6.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 54 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m974.0/974.0 kB\u001b[0m \u001b[31m15.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 55 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.2/2.2 MB\u001b[0m \u001b[31m24.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 56 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m88.3/88.3 kB\u001b[0m \u001b[31m7.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 57 | "\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", 58 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m27.0/27.0 MB\u001b[0m \u001b[31m13.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 59 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m14.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 60 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m318.1/318.1 kB\u001b[0m \u001b[31m15.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 61 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m314.7/314.7 kB\u001b[0m \u001b[31m5.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 62 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m124.9/124.9 kB\u001b[0m \u001b[31m3.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 63 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.7/2.7 MB\u001b[0m \u001b[31m22.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 64 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m142.5/142.5 kB\u001b[0m \u001b[31m1.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 65 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.2/49.2 kB\u001b[0m \u001b[31m4.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 66 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m75.6/75.6 kB\u001b[0m \u001b[31m5.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 67 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m129.9/129.9 kB\u001b[0m \u001b[31m10.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 68 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m53.0/53.0 kB\u001b[0m \u001b[31m5.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 69 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m77.9/77.9 kB\u001b[0m \u001b[31m8.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 70 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m4.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 71 | "\u001b[?25h Building wheel for google-search-results (setup.py) ... \u001b[?25l\u001b[?25hdone\n" 72 | ] 73 | } 74 | ], 75 | "source": [ 76 | "%pip install --upgrade --quiet gradio_tools huggingface_hub langchain langchain-community langgraph google-search-results faiss-cpu tiktoken duckduckgo-search" 77 | ] 78 | }, 79 | { 80 | "cell_type": "code", 81 | "source": [ 82 | "from rich.markdown import Markdown\n", 83 | "import warnings\n", 84 | "warnings.filterwarnings(action='ignore')\n", 85 | "import datetime\n", 86 | "from rich.console import Console\n", 87 | "console = Console(width=90)\n", 88 | "from typing import Any, Dict, Iterator, List, Mapping, Optional\n", 89 | "from langchain.callbacks.manager import CallbackManagerForLLMRun\n", 90 | "from langchain_core.language_models.llms import LLM\n", 91 | "from langchain_core.outputs import GenerationChunk\n", 92 | "from langchain_core.output_parsers import StrOutputParser\n", 93 | "from langchain_core.prompts import ChatPromptTemplate\n", 94 | "from gradio_client import Client\n", 95 | "from langchain_core.prompts import PromptTemplate" 96 | ], 97 | "metadata": { 98 | "id": "EdcClnV7GCBe" 99 | }, 100 | "execution_count": 2, 101 | "outputs": [] 102 | }, 103 | { 104 | "cell_type": "markdown", 105 | "source": [ 106 | "# ReACT examples with Chains - Using Qwen2-57B\n", 107 | "\n", 108 | "https://huggingface.co/spaces/Qwen/Qwen2-57b-a14b-instruct-demo\n", 109 | "\n", 110 | "Following the instructions in Chapter 4 let's have a look at ReAct. Reason and Act is a general paradigm that combines reasoning and acting with LLMs. ReAct prompts the language model to generate verbal reasoning traces and actions for a task, and also receives observations from external sources such as web searches or databases.\n", 111 | "\n", 112 | "\n", 113 | "\n", 114 | "> For example, let's say we want to ask our model for some up-to-date information about What is the ATP ranking of Jannik Sinner.\n", 115 | "> This is something you would usually do yourself browsing your google or bing search and collecting the information manually.\n", 116 | "\n", 117 | "But what if we give the task to an AI agent? It will decide if it is necessary to browse relevant search engines to find updated or extended information about a topic, and then process the new data for you.\n", 118 | "\n", 119 | "To do so, we are going to build a smart LangChain agent (as described in Chapter 2 of the book) leveraging DuckDuckGoSearchAPIWrapper (totally free tool to wrap the DuckDuckGo search engine to navigate the web), the AgentType tool (to decide which type of agent to use for our goal), and other prompt-related modules (to make it easier to \"templatize\" our instructions). Let's see how we can do this:" 120 | ], 121 | "metadata": { 122 | "id": "MlRvjBJmVjsU" 123 | } 124 | }, 125 | { 126 | "cell_type": "code", 127 | "source": [ 128 | "from langchain_core.language_models.llms import LLM\n", 129 | "class Qwen2MOEChat(LLM):\n", 130 | " \"\"\"\n", 131 | " Custom LLM class based on the Gradio API call.\n", 132 | " \"\"\"\n", 133 | " from typing import Any, Dict, Iterator, List, Mapping, Optional\n", 134 | " from langchain.callbacks.manager import CallbackManagerForLLMRun\n", 135 | " from langchain_core.language_models.llms import LLM\n", 136 | " from langchain_core.outputs import GenerationChunk\n", 137 | " from langchain_core.output_parsers import StrOutputParser\n", 138 | " from langchain_core.prompts import ChatPromptTemplate\n", 139 | " from gradio_client import Client\n", 140 | " chatbot: Any = None\n", 141 | "\n", 142 | " def __init__(self, *args, **kwargs):\n", 143 | " super().__init__(*args, **kwargs)\n", 144 | " self.chatbot = Client(\"Qwen/Qwen2-57b-a14b-instruct-demo\")\n", 145 | "\n", 146 | " @property\n", 147 | " def _llm_type(self) -> str:\n", 148 | " return \"Gradio API client Qwen2-57b-a14b-instruct-demo\"\n", 149 | "\n", 150 | " def _call(\n", 151 | " self,\n", 152 | " prompt: str,\n", 153 | " stop: Optional[List[str]] = None,\n", 154 | " run_manager: Optional[CallbackManagerForLLMRun] = None,\n", 155 | " chatbot=None,\n", 156 | " request: float = 0.95, #it's the history touple\n", 157 | " param: str = 'You are a helpful assistant', #it's the system message\n", 158 | " ) -> str:\n", 159 | " \"\"\"\n", 160 | " Make an API call to the Gradio API client Qwen2-57b-a14b-instruct-demo using the specified prompt and return the response.\n", 161 | " \"\"\"\n", 162 | " if chatbot is None:\n", 163 | " chatbot = self.chatbot\n", 164 | "\n", 165 | " # Return the response from the API\n", 166 | " result = chatbot.predict( #.submit for streaming effect / .predict for normal output\n", 167 | " query=prompt,\n", 168 | " history=[],\n", 169 | " system=\"You are a helpful assistant.\",\n", 170 | " api_name=\"/model_chat\"\n", 171 | " )\n", 172 | " return result[1][0][1]" 173 | ], 174 | "metadata": { 175 | "id": "yWqG_xF8wCok" 176 | }, 177 | "execution_count": 3, 178 | "outputs": [] 179 | }, 180 | { 181 | "cell_type": "markdown", 182 | "source": [ 183 | "### test DuckDuckGo free API wrapper and call - no registration!" 184 | ], 185 | "metadata": { 186 | "id": "qrvW107Uh0KH" 187 | } 188 | }, 189 | { 190 | "cell_type": "code", 191 | "source": [ 192 | "from langchain_community.tools import DuckDuckGoSearchRun" 193 | ], 194 | "metadata": { 195 | "id": "BaIyshBVegab" 196 | }, 197 | "execution_count": 3, 198 | "outputs": [] 199 | }, 200 | { 201 | "cell_type": "code", 202 | "source": [ 203 | "search = DuckDuckGoSearchRun()" 204 | ], 205 | "metadata": { 206 | "id": "TB7dkkP1egW2" 207 | }, 208 | "execution_count": null, 209 | "outputs": [] 210 | }, 211 | { 212 | "cell_type": "code", 213 | "source": [ 214 | "search.run(\"Obama's first name?\", verbose=True)" 215 | ], 216 | "metadata": { 217 | "colab": { 218 | "base_uri": "https://localhost:8080/", 219 | "height": 160 220 | }, 221 | "id": "11ZUP09TegJI", 222 | "outputId": "8407287e-3c44-40d7-b1f6-9d860aa52d54" 223 | }, 224 | "execution_count": null, 225 | "outputs": [ 226 | { 227 | "output_type": "stream", 228 | "name": "stdout", 229 | "text": [ 230 | "\u001b[32;1m\u001b[1;3mBarack Obama—with his wife, Michelle—being sworn in as the 44th president of the United States, January 20, 2009. Key events in the life of Barack Obama. Barack Obama (born August 4, 1961, Honolulu, Hawaii, U.S.) is the 44th president of the United States (2009-17) and the first African American to hold the office. Most common names of U.S. presidents 1789-2021. Published by. Aaron O'Neill , Feb 2, 2024. The most common first name for a U.S. president is James, followed by John and then William. Six U.S ... Barack and Michelle Obama's daughters, Malia and Sasha, grew up in the White House from 2009 to 2017. To most of the world, Barack and Michelle Obama are the former president and first lady of ... Michelle Obama (born January 17, 1964, Chicago, Illinois, U.S.) is an American first lady (2009-17), the wife of Barack Obama, 44th president of the United States.She was the first African American first lady. Michelle Robinson, who grew up on Chicago's South Side, was the daughter of Marian, a homemaker, and Frasier Robinson, a worker in the city's water-purification plant. Michelle and Barack Obama's daughter Malia Obama debuted a new name as her Hollywood career heats up, helping distance herself from the former president and first lady. By Sabba Rahbar Feb 21 ...\u001b[0m" 231 | ] 232 | }, 233 | { 234 | "output_type": "execute_result", 235 | "data": { 236 | "text/plain": [ 237 | "\"Barack Obama—with his wife, Michelle—being sworn in as the 44th president of the United States, January 20, 2009. Key events in the life of Barack Obama. Barack Obama (born August 4, 1961, Honolulu, Hawaii, U.S.) is the 44th president of the United States (2009-17) and the first African American to hold the office. Most common names of U.S. presidents 1789-2021. Published by. Aaron O'Neill , Feb 2, 2024. The most common first name for a U.S. president is James, followed by John and then William. Six U.S ... Barack and Michelle Obama's daughters, Malia and Sasha, grew up in the White House from 2009 to 2017. To most of the world, Barack and Michelle Obama are the former president and first lady of ... Michelle Obama (born January 17, 1964, Chicago, Illinois, U.S.) is an American first lady (2009-17), the wife of Barack Obama, 44th president of the United States.She was the first African American first lady. Michelle Robinson, who grew up on Chicago's South Side, was the daughter of Marian, a homemaker, and Frasier Robinson, a worker in the city's water-purification plant. Michelle and Barack Obama's daughter Malia Obama debuted a new name as her Hollywood career heats up, helping distance herself from the former president and first lady. By Sabba Rahbar Feb 21 ...\"" 238 | ], 239 | "application/vnd.google.colaboratory.intrinsic+json": { 240 | "type": "string" 241 | } 242 | }, 243 | "metadata": {}, 244 | "execution_count": 7 245 | } 246 | ] 247 | }, 248 | { 249 | "cell_type": "code", 250 | "source": [ 251 | "from langchain_community.tools import DuckDuckGoSearchResults\n", 252 | "search = DuckDuckGoSearchResults()" 253 | ], 254 | "metadata": { 255 | "id": "EFIHpVMnerHs" 256 | }, 257 | "execution_count": 4, 258 | "outputs": [] 259 | }, 260 | { 261 | "cell_type": "code", 262 | "source": [ 263 | "search = DuckDuckGoSearchResults(max_results=8, backend='news')\n", 264 | "search.run(\"What is the ATP ranking of Jannik Sinner?\")" 265 | ], 266 | "metadata": { 267 | "colab": { 268 | "base_uri": "https://localhost:8080/", 269 | "height": 105 270 | }, 271 | "id": "al3INsJ_erCm", 272 | "outputId": "370c4e89-5b07-4e88-e83f-84c2a777f560" 273 | }, 274 | "execution_count": 6, 275 | "outputs": [ 276 | { 277 | "output_type": "execute_result", 278 | "data": { 279 | "text/plain": [ 280 | "\"[snippet: Analyzing the beginning of the Roland Garros, we can see how Jannik Sinner is currently virtually the new ATP No.1\\xa0in the live ranking. It would be a historic result as no Italian tennis player has ever managed to become No., title: ATP Ranking live: Jannik Sinner is virtually No.1, link: https://www.msn.com/en-us/sports/tennis/atp-ranking-live-jannik-sinner-is-virtually-no1/ar-BB1nbKVl, date: 2024-05-28T09:15:00+00:00, source: Tennis World on MSN.com], [snippet: The Italian becomes the first from his country to rank No. 1. After his Dimitrov win, he's 12-0 in Grand Slam events this year and 33-2 overall on the season., title: Jannik Sinner Becomes First Italian To Reach The ATP No. 1 Ranking, link: https://www.tennis-x.com/xblog/2024-06-04/37972.php, date: 2024-06-04T11:41:00+00:00, source: Tennis-X], [snippet: Not only did Jannik Sinner advance to the first French Open semifinal of his career on Tuesday, but the Italian tennis star also made some history., title: Jannik Sinner Found Out He Was New World No. 1 After French Open Win In Cool Moment, link: https://www.msn.com/en-us/sports/tennis/jannik-sinner-found-out-he-was-new-world-no-1-after-french-open-win-in-cool-moment/ar-BB1nCLCf, date: 2024-06-04T22:57:00+00:00, source: Sports Illustrated on MSN.com], [snippet: PARIS — Jannik Sinner is just 22 and Carlos Alcaraz just 21, yet they've already built quite a rivalry on the ATP Tour heading into their French Open semifinal on Friday., title: Carlos Alcaraz, Jannik Sinner will renew rivalry at French Open, link: https://www.timesfreepress.com/news/2024/jun/06/carlos-alcaraz-jannik-sinner-will-renew-rivalry/, date: 2024-06-07T00:01:00+00:00, source: Chattanooga Times Free Press]\"" 281 | ], 282 | "application/vnd.google.colaboratory.intrinsic+json": { 283 | "type": "string" 284 | } 285 | }, 286 | "metadata": {}, 287 | "execution_count": 6 288 | } 289 | ] 290 | }, 291 | { 292 | "cell_type": "code", 293 | "source": [ 294 | "search = DuckDuckGoSearchResults(max_results=8)\n", 295 | "search.run(\"What is the ATP ranking of Jannik Sinner?\")" 296 | ], 297 | "metadata": { 298 | "colab": { 299 | "base_uri": "https://localhost:8080/", 300 | "height": 174 301 | }, 302 | "id": "2B0QCUO0eq_z", 303 | "outputId": "44feb4f6-3f6c-4416-850f-c86bf38c78aa" 304 | }, 305 | "execution_count": 7, 306 | "outputs": [ 307 | { 308 | "output_type": "execute_result", 309 | "data": { 310 | "text/plain": [ 311 | "\"[snippet: Jannik Sinner is set to climb to No. 1 in the PIF ATP Rankings on 10 June. The 22-year-old will become the first Italian and just the 29th player overall to top men's tennis. Sinner began the year at World No. 4. But with a massive surge to begin 2024, highlighted by his first major title at the Australian Open, an ATP Masters 1000 title in ..., title: Jannik Sinner assured of rise to World No. 1 | ATP Tour | Tennis, link: https://www.atptour.com/en/news/sinner-roland-garros-2024-world-no-1-guaranteed], [snippet: Jannik Sinner clinches No. 2 ranking, a new career-high, after winning Miami Open title The 22-year-old will become the first Italian tennis player to reach the Top 2 in either ATP or WTA rankings ..., title: Jannik Sinner clinches No. 2 ranking, a new career-high, after winning ..., link: https://www.tennis.com/news/articles/jannik-sinner-clinches-no-2-ranking-a-new-career-high-after-winning-miami-open-title], [snippet: If Sinner can win the title this year, he'll rise from No. 3 to a new career-high ranking of No. 2, one-upping his own record for highest-ranked Italian player in either ATP or WTA rankings history., title: Jannik Sinner has now had wins over every Top 10 ranking after victory ..., link: https://www.tennis.com/news/articles/jannik-sinner-has-now-had-wins-over-every-top-10-ranking-after-victory-over-no-4-medvedev-at-miami-open], [snippet: Jannik Sinner backed up his maiden Grand Slam title at the Australian Open with trophies in Rotterdam and Miami this season, and he is now through to the Roland Garros semifinals for the first time.With the injured Novak Djokovic pulling of the clay-court major ahead of his quarterfinal match, Sinner is now guaranteed to rise above the Serbian for the world No. 1 ranking following the tournament., title: Jannik Sinner set to debut as world No. 1 after Roland Garros, link: https://www.usopen.org/en_US/news/articles/2024-06-04/jannik_sinner_set_to_debut_as_world_no_1_after_roland_garros.html]\"" 312 | ], 313 | "application/vnd.google.colaboratory.intrinsic+json": { 314 | "type": "string" 315 | } 316 | }, 317 | "metadata": {}, 318 | "execution_count": 7 319 | } 320 | ] 321 | }, 322 | { 323 | "cell_type": "code", 324 | "source": [], 325 | "metadata": { 326 | "id": "73deo1jGeq9I" 327 | }, 328 | "execution_count": null, 329 | "outputs": [] 330 | }, 331 | { 332 | "cell_type": "markdown", 333 | "source": [ 334 | "## GradioLLM + DuckDuckGo AI agent tool" 335 | ], 336 | "metadata": { 337 | "id": "J8OyTTJUeriT" 338 | } 339 | }, 340 | { 341 | "cell_type": "code", 342 | "source": [ 343 | "import os\n", 344 | "#from https://python.langchain.com/v0.1/docs/integrations/tools/ddg/\n", 345 | "from langchain_community.utilities import DuckDuckGoSearchAPIWrapper\n", 346 | "#wrapper = DuckDuckGoSearchAPIWrapper(region=\"de-de\", time=\"d\", max_results=8)\n", 347 | "from langchain.agents import AgentType, initialize_agent\n", 348 | "from langchain.chat_models import ChatOpenAI\n", 349 | "from langchain.tools import BaseTool, StructuredTool, Tool, tool\n", 350 | "from langchain.schema import HumanMessage\n", 351 | "from gradio_client import Client\n", 352 | "\n", 353 | "model = Qwen2MOEChat()\n", 354 | "search = DuckDuckGoSearchAPIWrapper(max_results=10)\n", 355 | "tools = [\n", 356 | " Tool.from_function(\n", 357 | " func=search.run,\n", 358 | " name=\"Search\",\n", 359 | " description=\"useful for when you need to answer questions about current events, search online news\"\n", 360 | " )\n", 361 | " ]\n", 362 | "\n", 363 | "agent_executor = initialize_agent(tools, model, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True)" 364 | ], 365 | "metadata": { 366 | "colab": { 367 | "base_uri": "https://localhost:8080/" 368 | }, 369 | "id": "Ur67dG6TVkk7", 370 | "outputId": "caf7bde0-9d69-4553-c8cf-c7ab2b5834db" 371 | }, 372 | "execution_count": 9, 373 | "outputs": [ 374 | { 375 | "output_type": "stream", 376 | "name": "stdout", 377 | "text": [ 378 | "Loaded as API: https://qwen-qwen2-57b-a14b-instruct-demo.hf.space ✔\n" 379 | ] 380 | }, 381 | { 382 | "output_type": "stream", 383 | "name": "stderr", 384 | "text": [ 385 | "/usr/local/lib/python3.10/dist-packages/langchain_core/_api/deprecation.py:119: LangChainDeprecationWarning: The function `initialize_agent` was deprecated in LangChain 0.1.0 and will be removed in 0.3.0. Use Use new agent constructor methods like create_react_agent, create_json_agent, create_structured_chat_agent, etc. instead.\n", 386 | " warn_deprecated(\n" 387 | ] 388 | } 389 | ] 390 | }, 391 | { 392 | "cell_type": "code", 393 | "source": [ 394 | "console.print(agent_executor.agent.llm_chain.prompt.template)" 395 | ], 396 | "metadata": { 397 | "colab": { 398 | "base_uri": "https://localhost:8080/", 399 | "height": 345 400 | }, 401 | "id": "SRZuqqJwVkh5", 402 | "outputId": "de6410b6-80b4-47c5-ad04-12094aca0349" 403 | }, 404 | "execution_count": 6, 405 | "outputs": [ 406 | { 407 | "output_type": "display_data", 408 | "data": { 409 | "text/plain": [ 410 | "Answer the following questions as best you can. You have access to the following tools:\n", 411 | "\n", 412 | "\u001b[1;35mSearch\u001b[0m\u001b[1m(\u001b[0mquery: str\u001b[1m)\u001b[0m -> str - useful for when you need to answer questions about current \n", 413 | "events, search online news\n", 414 | "\n", 415 | "Use the following format:\n", 416 | "\n", 417 | "Question: the input question you must answer\n", 418 | "Thought: you should always think about what to do\n", 419 | "Action: the action to take, should be one of \u001b[1m[\u001b[0mSearch\u001b[1m]\u001b[0m\n", 420 | "Action Input: the input to the action\n", 421 | "Observation: the result of the action\n", 422 | "\u001b[33m...\u001b[0m \u001b[1m(\u001b[0mthis Thought/Action/Action Input/Observation can repeat N times\u001b[1m)\u001b[0m\n", 423 | "Thought: I now know the final answer\n", 424 | "Final Answer: the final answer to the original input question\n", 425 | "\n", 426 | "Begin!\n", 427 | "\n", 428 | "Question: \u001b[1m{\u001b[0minput\u001b[1m}\u001b[0m\n", 429 | "Thought:\u001b[1m{\u001b[0magent_scratchpad\u001b[1m}\u001b[0m\n" 430 | ], 431 | "text/html": [ 432 | "
Answer the following questions as best you can. You have access to the following tools:\n",
433 |               "\n",
434 |               "Search(query: str) -> str - useful for when you need to answer questions about current \n",
435 |               "events, search online news\n",
436 |               "\n",
437 |               "Use the following format:\n",
438 |               "\n",
439 |               "Question: the input question you must answer\n",
440 |               "Thought: you should always think about what to do\n",
441 |               "Action: the action to take, should be one of [Search]\n",
442 |               "Action Input: the input to the action\n",
443 |               "Observation: the result of the action\n",
444 |               "... (this Thought/Action/Action Input/Observation can repeat N times)\n",
445 |               "Thought: I now know the final answer\n",
446 |               "Final Answer: the final answer to the original input question\n",
447 |               "\n",
448 |               "Begin!\n",
449 |               "\n",
450 |               "Question: {input}\n",
451 |               "Thought:{agent_scratchpad}\n",
452 |               "
\n" 453 | ] 454 | }, 455 | "metadata": {} 456 | } 457 | ] 458 | }, 459 | { 460 | "cell_type": "code", 461 | "source": [ 462 | "agent_executor(\"what is the ATP ranking of Jannik Sinner?\")" 463 | ], 464 | "metadata": { 465 | "colab": { 466 | "base_uri": "https://localhost:8080/" 467 | }, 468 | "id": "cmpEkhTK3zoi", 469 | "outputId": "5b6f3283-1c15-4c8e-8ba4-9342483baf56" 470 | }, 471 | "execution_count": 14, 472 | "outputs": [ 473 | { 474 | "output_type": "stream", 475 | "name": "stdout", 476 | "text": [ 477 | "\n", 478 | "\n", 479 | "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n", 480 | "\u001b[32;1m\u001b[1;3mI should use a search engine to find the current ATP ranking of Jannik Sinner.\n", 481 | "Action: Search\n", 482 | "Action Input: Jannik Sinner ATP ranking\u001b[0m\n", 483 | "Observation: \u001b[36;1m\u001b[1;3mOfficial tennis player profile of Jannik Sinner on the ATP Tour. Featuring news, bio, rankings, playing activity, coach, stats, win-loss, points breakdown, videos, and more. ... Rank {{playerData.PlayerRank}} 1st Serve points won {{playerData.PlayerFirstServePointsWon}} Aces {{playerData.Aces}} Career Win/Loss {{playerData.CareerWinLoss ... Official ATP Rankings and Race points breakdown of Jannik Sinner by tournament and drop date for singles and doubles. Jannik Sinner won't win the 2024 French Open, but he will leave Paris as the new world No 1 while Novak Djokovic could slip two places in the ATP Rankings after the tournament. The 22-year-old Sinner already had one hand on the No 1 ranking before the clay-court Grand Slam got underway as Djokovic had to reach at least the semi-final to deny ... Before the Italian Open, Djokovic held a comfortable lead atop the live rankings, boasting 9,860 points compared to Jannik Sinner's 8,770 and Carlos Alcaraz's 7,300. However, his surprising early exit in Rome left the door ajar for his competitors, particularly Sinner, who is now poised to seize the top spot. Jannik Sinner clinches No. 2 ranking, a new career-high, after winning Miami Open title The 22-year-old will become the first Italian tennis player to reach the Top 2 in either ATP or WTA rankings ... Jannik Sinner took an unexpected path to the world number one ranking on Tuesday after Novak Djokovic's French Open withdrawal but the youngster said it was the culmination of years of hard work ... Jannik Sinner has moved up from No. 4 to a new career-high of No. 3 following his triumph at the ATP 500 indoor event in Rotterdam. And it's historic: not only is he now the highest-ranked ... Jannik Sinner's 7-6 (4), 6-1 win over No. 2-ranked Carlos Alcaraz in the semifinals of Beijing today was big for a few reasons—not only did it put him into his fifth ATP final of the year, but ... Kevin Palmer 13 Aug 2023 11:24 PM. Jannik Sinner wins his first ATP Masters 1000 title in Toronto. Italy's Jannik Sinner claimed his first ATP Masters 1000 title in Toronto and the win secured the 21-year-old a new career-high ranking after a convincing victory in Canada. Sinner struck the ball with clinical brilliance as he saw off Alex De ... The 15 countries to produce ATP world No 1 singles players: Italy joins list after Jannik Sinner's rise Sinner No 14 In Terms Of Age. Sinner will be aged 22 years, nine months and 25 days when the rankings update on June 10 and he is some way away from Alcaraz's record for the youngest-ever world No 1.\u001b[0m\n", 484 | "Thought:\u001b[32;1m\u001b[1;3mI now know the final answer\n", 485 | "Final Answer: As of my last update, Jannik Sinner's ATP ranking was No. 3. Please check the official ATP website for the most recent rankings, as they can change weekly based on tournament results.\u001b[0m\n", 486 | "\n", 487 | "\u001b[1m> Finished chain.\u001b[0m\n" 488 | ] 489 | }, 490 | { 491 | "output_type": "execute_result", 492 | "data": { 493 | "text/plain": [ 494 | "{'input': 'what is the ATP ranking of Jannik Sinner?',\n", 495 | " 'output': \"As of my last update, Jannik Sinner's ATP ranking was No. 3. Please check the official ATP website for the most recent rankings, as they can change weekly based on tournament results.\"}" 496 | ] 497 | }, 498 | "metadata": {}, 499 | "execution_count": 14 500 | } 501 | ] 502 | }, 503 | { 504 | "cell_type": "code", 505 | "source": [ 506 | "res = agent_executor(\"search the web and tell me what is the ATP ranking of Jannik Sinner?\")" 507 | ], 508 | "metadata": { 509 | "colab": { 510 | "base_uri": "https://localhost:8080/" 511 | }, 512 | "id": "ZQNkue503QXr", 513 | "outputId": "eafa283e-36c9-429c-c645-8ebf8d649683" 514 | }, 515 | "execution_count": 12, 516 | "outputs": [ 517 | { 518 | "output_type": "stream", 519 | "name": "stdout", 520 | "text": [ 521 | "\n", 522 | "\n", 523 | "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n", 524 | "\u001b[32;1m\u001b[1;3mI need to search the web to find out the current ATP ranking of Jannik Sinner.\n", 525 | "Action: Search\n", 526 | "Action Input: \"ATP ranking Jannik Sinner\"\u001b[0m\n", 527 | "Observation: \u001b[36;1m\u001b[1;3mOfficial tennis player profile of Jannik Sinner on the ATP Tour. Featuring news, bio, rankings, playing activity, coach, stats, win-loss, points breakdown, videos, and more. ... Rank {{playerData.PlayerRank}} 1st Serve points won {{playerData.PlayerFirstServePointsWon}} Aces {{playerData.Aces}} Career Win/Loss {{playerData.CareerWinLoss ... Jannik Sinner backed up his maiden Grand Slam title at the Australian Open with trophies in Rotterdam and Miami this season, and he is now through to the Roland Garros semifinals for the first time.With the injured Novak Djokovic pulling of the clay-court major ahead of his quarterfinal match, Sinner is now guaranteed to rise above the Serbian for the world No. 1 ranking following the tournament. Jannik Sinner clinches No. 2 ranking, a new career-high, after winning Miami Open title The 22-year-old will become the first Italian tennis player to reach the Top 2 in either ATP or WTA rankings ... The ATP's year-end rankings are out today and it's official: Jannik Sinner is the first Italian player to finish a year in the Top 5—not just in ATP rankings history, but in ATP or WTA ... Jannik Sinner's 7-6 (4), 6-1 win over No. 2-ranked Carlos Alcaraz in the semifinals of Beijing today was big for a few reasons—not only did it put him into his fifth ATP final of the year, but ... Jannik Sinner took an unexpected path to the world number one ranking on Tuesday after Novak Djokovic's French Open withdrawal but the youngster said it was the culmination of years of hard work ... Jannik Sinner remains unbeaten in 2024 and will rise to a new career-high ranking after claiming the Rotterdam Open title with a straight sets win over Alex De Minaur on Sunday. Sinner has won his last 15 singles matches on the bounce and will leapfrog former world No 1 Daniil Medvedev into third spot on the ATP Rankings on Monday. Jannik Sinner is set to climb to No. 1 in the PIF ATP Rankings on 10 June following Novak Djokovic's loss in the fourth round at Roland Garros to Francisco Cerundolo Monday. The 22-year-old will become the first Italian and just the 29th player overall to top men's tennis. Sinner, who turns 23 in August, is on the verge of becoming the first Italian man to claim the ATP No.1 ranking. He currently leads the live standings with rival Novak Djokovic required to reach at least the semi-final stage in Paris to have a chance of maintaining his position. The 15 countries to produce ATP world No 1 singles players: Italy joins list after Jannik Sinner's rise Sinner No 14 In Terms Of Age. Sinner will be aged 22 years, nine months and 25 days when the rankings update on June 10 and he is some way away from Alcaraz's record for the youngest-ever world No 1.\u001b[0m\n", 528 | "Thought:\u001b[32;1m\u001b[1;3mI now know the final answer\n", 529 | "Final Answer: As of the latest information available, Jannik Sinner is ranked number 3 in the ATP rankings. He is set to rise to number 1 in the rankings on June 10, 2023, following Novak Djokovic's loss in the fourth round at Roland Garros. This will make him the first Italian man to claim the ATP No. 1 ranking.\u001b[0m\n", 530 | "\n", 531 | "\u001b[1m> Finished chain.\u001b[0m\n" 532 | ] 533 | } 534 | ] 535 | }, 536 | { 537 | "cell_type": "code", 538 | "source": [ 539 | "console.print(res['output'])" 540 | ], 541 | "metadata": { 542 | "colab": { 543 | "base_uri": "https://localhost:8080/", 544 | "height": 83 545 | }, 546 | "id": "jjXCYPAj3QU5", 547 | "outputId": "3f2f09c5-2c34-4c4e-d738-f496ca9f15d3" 548 | }, 549 | "execution_count": 13, 550 | "outputs": [ 551 | { 552 | "output_type": "display_data", 553 | "data": { 554 | "text/plain": [ 555 | "As of the latest information available, Jannik Sinner is ranked number \u001b[1;36m3\u001b[0m in the ATP \n", 556 | "rankings. He is set to rise to number \u001b[1;36m1\u001b[0m in the rankings on June \u001b[1;36m10\u001b[0m, \u001b[1;36m2023\u001b[0m, following Novak \n", 557 | "Djokovic's loss in the fourth round at Roland Garros. This will make him the first Italian\n", 558 | "man to claim the ATP No. \u001b[1;36m1\u001b[0m ranking.\n" 559 | ], 560 | "text/html": [ 561 | "
As of the latest information available, Jannik Sinner is ranked number 3 in the ATP \n",
562 |               "rankings. He is set to rise to number 1 in the rankings on June 10, 2023, following Novak \n",
563 |               "Djokovic's loss in the fourth round at Roland Garros. This will make him the first Italian\n",
564 |               "man to claim the ATP No. 1 ranking.\n",
565 |               "
\n" 566 | ] 567 | }, 568 | "metadata": {} 569 | } 570 | ] 571 | }, 572 | { 573 | "cell_type": "code", 574 | "source": [], 575 | "metadata": { 576 | "id": "Poc94Z7v3QSV" 577 | }, 578 | "execution_count": null, 579 | "outputs": [] 580 | }, 581 | { 582 | "cell_type": "markdown", 583 | "source": [ 584 | "\n", 585 | "\n", 586 | "\n", 587 | "---\n", 588 | "\n", 589 | "\n", 590 | "---\n", 591 | "\n", 592 | "\n", 593 | "\n", 594 | "---\n", 595 | "\n" 596 | ], 597 | "metadata": { 598 | "id": "Jh0AA3084pm6" 599 | } 600 | } 601 | ] 602 | } --------------------------------------------------------------------------------