Exclusive Clothing Sale On Flipkart

Get up to 50% off on our latest collection.

Shop Now
Showing posts with label OpenAI. Show all posts
Showing posts with label OpenAI. Show all posts

OpenAI Anounced a new GPT-4o AI model | What is GPT-4o AI Model

On 13 May 2024, OpenAI announced a new AI model called GPT-4o; it is the updated model of GPT-4, which was almost launched 1 year before.


What it is

  • GPT-4o is a recent advancement in large language models by OpenAI.
  • It builds on the capabilities of its predecessor, GPT-4, by incorporating multimodal understanding.
  • This means it can process and respond to information across different formats: text, code, and video (images for now). 

Key features of GPT-4o

  • Multimodal capabilities: Highlight that GPT-4o isn't restricted to text. It can understand and respond to prompts that include images and video.
    for example, a user uploading a video of their code and GPT-4o explaining what the code does and how to errors if code has.
  • Efficiency: Briefly mention that GPT-4o is faster and more cost-effective than its predecessors.

Interactive Design Assistant

Imagine a designer working on a website. They could upload a sketch of their layout and ask GPT-4o to:

  • Generate code: GPT-4o could analyze the sketch and create the corresponding HTML and CSS code to bring the design to life.
  • Suggest improvements: Based on design principles and user experience best practices, GPT-4o could recommend changes to the layout or color scheme.

Real-time Accessibility Checks

A streamer or video creator uploads their latest video. GPT-4o analyzes the video and:

  • Generates captions: It creates accurate captions for the video, making it accessible to deaf or hard-of-hearing viewers.
  • Identifies visual elements: It can highlight objects or scenes in the video and describe them with text, aiding visually impaired viewers.

Educational Assistant with Multimodal Learning

A student is studying a complex biological concept. They can provide GPT-4o with a text description and:

  • GPT-4o generates a relevant image: It might create a 3D model of the biological structure the student is studying.
  • It can point to videos or simulations: These can help the student visualize the concept in action. Enhanced Customer Service Chatbots:

A customer is having trouble with their online order. They can describe the issue through text chat, and GPT-4o can:

  • Analyze the customer's message: It understands the sentiment and identifies the specific problem.
  • Offer solutions: It can suggest troubleshooting steps or connect the customer with the appropriate support agent.
  • If an image is included: For example, a picture of a damaged product, GPT-4o can use that information to expedite the resolution process.

These are just a few examples, and the possibilities are vast. As GPT-4o continues to develop, we can expect even more innovative real-time applications to emerge. 

Focus on Applications

  • Engaging Content Creation: This model's ability to understand different formats can be a boon for content creators.
    • They can use GPT-4o to generate content that combines text, images, and even video elements.
  • Enhanced User Experience: For applications like chatbots or virtual assistants, GPT-4o's multimodal capabilities can provide a more natural and interactive experience.
    • Users can provide information through text, images, or speech, and GPT-4o can understand and respond accordingly.
  • Improved Code Analysis: Briefly mention its potential in assisting programmers, like the example from the YouTube video where GPT-4o analyses code.

Note. it's still under development, and public access is limited

 

 


----------------------

Call chatgpt api from angular

Angular is a frontend framework that allows you to build web applications, and you can use it to make HTTP requests to external APIs, including the ChatGPT API. 

To call the ChatGPT API from Angular, you would typically use Angular's built-in HttpClient module to send HTTP requests to the API endpoint. Here's a basic example of how you might do this: 

First, make sure you have Angular CLI installed. If not, you can install it using npm:

npm install -g @angular/cli


Create a new Angular project:

ng new my-chatgpt-app


Navigate to your project directory:
cd my-chatgpt-app

Generate a new service to handle API calls:
ng generate service chatgpt


In your service file (chatgpt.service.ts), import HttpClient and inject it into your service constructor:

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class ChatGptService {
  private apiUrl = 'https://api.openai.com/v1/chat/completions'; // Example API endpoint

  constructor(private http: HttpClient) { }

  getChatResponse(prompt: string): Observable<any> {
    const headers = {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY' // Replace YOUR_API_KEY with your actual API key
    };

    const body = {
      prompt: prompt,
      max_tokens: 150
    };

    return this.http.post<any>(this.apiUrl, body, { headers });
  }
}



Replace 'https://api.openai.com/v1/chat/completions' with the actual URL of the ChatGPT API endpoint you want to call.
Replace 'YOUR_API_KEY' with your actual ChatGPT API key.
Now, you can use this service in your Angular components to make API calls. For example, in your component file (app.component.ts), you can inject the ChatGptService and call the getChatResponse method:
import { Component } from '@angular/core';
import { ChatGptService } from './chatgpt.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  constructor(private chatGptService: ChatGptService) {}

  ngOnInit() {
    this.chatGptService.getChatResponse('Hello, GPT!').subscribe(response => {
      console.log(response);
    });
  }
}



Here we are printing data to the console, you can print it in an HTML page as well.





----------------------

ChatGPT is now available in the Azure OpenAI Service

In this article we will see about ChatGPT is now available in Azure OpenAI Service

If you are new to ChatGPT then previously we discussed OpenAI and we have seen how to create a ChatGTP application using OpenAI, 

For more please follow the below link 👇

Now ChatGPT is available in Azure Open AI service as well, it is introduced and announced by Microsoft on 9th march 2023.

Now developers and the business team will be able to integrate the Open AI’s ChatGPT modes into their cloud applications, which enables communication in other apps and services.

Now the business team can use ChatGPT to customize the queries as per the customer feedback and can help in applications to send automated emails and so many others.

As per Microsoft's announcement Azure OpenAI, users now can start to access the preview of ChatGPT today, with the pricing set of $0.002 for the 1,000 tokens, now the billing for all the ChatGPT service starts on March 13th as part of the Azure OpenAI.

Developers need to apply for special access, as the Azure OpenAI Services requires registration and it is currently only available for Microsoft-managed customers and partners.

With the help of Azure OpenAI Service, more than 1,000 customers are applying the advanced AI model, including the Dall-E 2, GPT-3.5, Codex, and many other large language models to innovate in new ways, now the developers use OpenAI’s ChatGPT in the enhancement of PowerBI, MicrosoftTeams, GitHub, etc.

Now all the big and small levels of organizations are using the Azure OpenAI Services to achieve their business value, Microsoft also working internally to combine the large language models with the OpenAI and the AI-optimized infrastructure of Azure to introduce new experiences across the customer and products ex.

  • GitHub Copilot leverages AI models in the Azure OpenAI Service to give benefits to developers to enhance the code with its AI pair programmer.
  • Microsoft Teams Premium includes the intelligent recap and the AI-generated chapters to help the teams, individuals, and organizations become more productive.
  • Microsoft Viva Sales is the new AI-powered seller experience that offers suggested email content and data-driven insights to help the sales teams to focus on selling products to customers.
  • Microsoft Bing introduced the AI-powered chat option to enhance the consumer's search experience.

above are just a few examples of how Microsoft openAI is helping organizations to transform in AI models.

So in the future, AI will definitely change the way of work, and also improve the organization's growth with Open A.

Below are a couple of the Links given by Microsoft through that we can start working with Azure OpenAI services.

Getting started with the Azure OpenAI Service


    ---------------------------------------------------------------------------------------

    Integrate OpenAI with .NET Core and Angular15 | ChatGPT Completions In .NET Core Web API & Angular15

    Hello everyone, Here we are going to discuss, how to integrate OpenAI with .Net Core and Angular 15.

    ChatGPT Completions In .NET Core Web API & Angular15

    ChatGPT (Generative Pre-trained Transformer) is the chatbot developed by OpenAI on November 30, 2022.

    Previously we discussed OpenAI and we have seen how to create a ChatGTP application using OpenAI, 

    For more please follow the below link 👇

    Step 1 - Create an OpenAI account

    First, we need to create an OpenAI account; you can follow the below link to how to create an OpenAI account.

    Step 2 - Get the OpenAI API key

    Login to your OpenAI account and click on profile (personal, right-hand side) and click on view API

    ChatGPT Completions In .NET Core Web API & Angular15

    Once you click on View API Keys, you will ‘Create a new secret key, once you click on it an API key will generate in the Popup window, and you can copy it for using it in the application.

    ChatGPT Completions In .NET Core Web API & Angular15

     

    ChatGPT Completions In .NET Core Web API & Angular15

    Now open visual studio 2022 and create an Asp.net Core web API project like below

    ChatGPT Completions In .NET Core Web API & Angular15

    ChatGPT Completions In .NET Core Web API & Angular15

    Give additional information as per your requirement.

    ChatGPT Completions In .NET Core Web API & Angular15

    Once the project is created, now go to the NuGet package manager and add the OpenAI package like below

    ChatGPT Completions In .NET Core Web API & Angular15

    Now right-click on the Controller folder and add a new controller Called OpenAI and write the below code in it

    using Microsoft.AspNetCore.Http;
    using Microsoft.AspNetCore.Mvc;
    using OpenAI_API.Completions;
    using OpenAI_API;
    namespace OpenAIApp.Controllers {
        [Route("api/[controller]/[action]")]
        [ApiController]
        public class OpenAI: ControllerBase {
            [HttpGet]
            public async Task < IActionResult > GetData(string input) {
                string apiKey = "Your API Key";
                string response = "";
                OpenAIAPI openai = new OpenAIAPI(apiKey);
                CompletionRequest completion = new CompletionRequest();
                completion.Prompt = input;
                completion.Model = "text-davinci-003";
                completion.MaxTokens = 4000;
                var output = await openai.Completions.CreateCompletionAsync(completion);
                if (output != null) {
                    foreach(var item in output.Completions) {
                        response = item.Text;
                    }
                    return Ok(response);
                } else {
                    return BadRequest("Not found");
                }
            }
        }
    }
    C#

    Now click on the program.cs class and add the cors origin like below,

    builder.Services.AddCors(options => {
        options.AddPolicy(name: "AllowOrigin", policy => {
            policy.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
        });
    });
    app.UseCors("AllowOrigin");
    C#

    ChatGPT Completions In .NET Core Web API & Angular15

    When you will run this application, we will see our API in swagger and our API is ready to use in angular

    ChatGPT Completions In .NET Core Web API & Angular15

    Now we need to create the Angular 15 application, you can follow the below link for the same

    once the angular 15 application is created, now open the app.component.ts file and add the below code

    import { Component } from '@angular/core';
    import { OpenAIService } from './open-ai.service';
    
    @Component({
        selector: 'app-root',
        templateUrl: './app.component.html',
        styleUrls: ['./app.component.css']
    })
    export class AppComponent {
        searchTxtVal: string = '';
        showOutput: boolean = false;
        output: string = '';
        isLoading: boolean = false;
        constructor(private service: OpenAIService) {}
        getResult() {
            this.isLoading = true;
            this.output = "";
            this.service.getData(this.searchTxtVal).subscribe(data => {
                this.output = data as string;
                this.showOutput = true;
                this.isLoading = false;
            })
        }
    }
    JavaScript

    Add the below code in app.component.html file

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
    <div class="text-center">
      <div class="panel-default">
        <div class="panel-body">ChatGPT Completions In the ASP.NET Core Web API</div>
        <div class="panel-body">
          <div class="col-sm-8">
            <input type="text" [(ngModel)]="searchTxtVal" class="form-control" autocomplete="off" placeholder="Enter your question" />
          </div>
          <div class="col-sm-2" style="margin-left: -60px;">
            <button (click)="getResult()">Get Result</button>
          </div>
          <div class="col-sm-12 mt-5" *ngIf="showOutput">
            {{output}}
          </div>
          <div class="col-sm-12 mt-5" *ngIf="isLoading">
            <p style="color: red;">Loading...</p>
          </div>
        </div>
      </div>
    </div>
    JavaScript

    Now create a service file with the below command, here service name is ‘OpenAI’

    Ng g s openAI

    And write the below code in the openAI.service.ts file

    import { HttpClient } from '@angular/common/http';
    import { Injectable } from '@angular/core';
    import{ Observable} from 'rxjs';
    
    @Injectable({
        providedIn: 'root'
    })
    export class OpenAIService {
        constructor(private http: HttpClient) {}
        getData(input: string): Observable < any > {
            return this.http.get('https://localhost:7285/api/OpenAI/GetData?input=' + input, {
                responseType: 'text'
            });
        }
    }
    JavaScript

    In the above the Url path is ‘'https://localhost:7285’, you need to replace the port, which you are looking at locally, once you run your .Net Core application.

    Now add this service reference in the app.model.ts file in the provider array and apart from it we need to add the FormsModule and HttpClientModule like below

    ChatGPT Completions In .NET Core Web API & Angular15

    Now when you will run your angular 15 application, you will see UI like below

    ChatGPT Completions In .NET Core Web API & Angular15

    Here, now you can write your query and click on the getResult button, you will see the output below

    ChatGPT Completions In .NET Core Web API & Angular15

    The output will be like below

    ChatGPT Completions In .NET Core Web API & Angular15

    This is the way we can integrate the OpenAI with our angular application.

    Below is the video, on how we can integrate OpenAI with our angular application practically,





    ----------------------------------------------------------------

    Exclusive Clothing Sale On Flipkart

    Get up to 50% off on our latest collection.

    Shop Now