Pre-trained APIs
1. Pre-trained APIs
'SPEAKER: In the previous lesson, you learned about no to low-code solution of AutoML. Let's proceed to a low-code solution by using pre-trained APIs. Good machine learning models require lots of high-quality training data. You should aim for hundreds of thousands of records to train a custom model. But what if you don't have that kind of data? How can you use AI to serve your purposes? Pre-trained APIs are a great place to start. API stands for Application Programming Interface. APIs define how software components communicate with each other. Imagine APIs as electrical outlets. Different regions have different standards. For example, the US uses type A and B, whereas Europe uses type F. As a traveler, you only need to know which adapter to use without worrying about what's behind the wall or how the electrical network is built. The same principle applies to APIs. As a user, you only need to know which API to use and what parameters to pass and in what format without worrying about the implementation, specifically the intricacies of model training and deployment, much like calling a predefined function. Look at a simple example. The code uses the Google AI for Python SDK, or Software Development Kit, to communicate with the Gemini API following these steps. Authenticate your session by passing the unique API key as a parameter to the genai.configure function, granting you permission to use the API using the statement genai.configure(api key="YOUR API KEY"). 2, specify the Gemini models you want to process your request, like Gemini 2.5 Flash, using the statement model is equal to genai. GenerativeModel of Gemini 2.5. Flash. 3, make an API call to Google's servers sending the prompt data. This string of text passed to the model.generate_content function serves as the main input, the question or instruction that you want the AI to respond to. Follow the statement response = model.generate content("What are the three largest countries by area?") 4, receive the model's generated text back as a response by using the statement print(response.text). It's remarkable, isn't it? You don't need to train your own large language models. Instead, you can access and utilize the pre-trained AI models directly through API calls in the same way as a function call. So what are the API services provided by Google Cloud? Let's explore a short list. Generative AI APIs include foundation model APIs, such as the multimodal Gemini APIs, which can be leveraged to directly create content. Additionally, Vertex AI Agent Builder provides a comprehensive suite of features for discovering, building, and deploying AI agents. Machine learning APIs, like the Vertex AI API, can be used to train, monitor, and tune an ML model with minimal ML expertise and effort. Other APIs include speech, image, document, and conversation APIs. This list is constantly evolving with technological advancements. Many of these can be replaced by the Gemini APIs, which are considered multi-task and multimodal. Ever wondered what magic lies behind understanding human language? Discover the Natural Language API, a powerful tool that allows you to analyze text directly in your browser. Uncover hidden insights by identifying entities, sentiment, syntax, and categories, transforming raw text into meaningful data.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.