Tuesday, December 3, 2024

How Git Hub Copilot Write Code for you

 

This post will explain,  how we can configure Copilot in IntelliJ and how we can generate code using Copilot.

To configure GitHub Copilot in IntelliJ IDE, follow these step-by-step instructions:

Step 1: Prerequisites

GitHub Account: Ensure you have an active GitHub account with a subscription to GitHub Copilot.

IntelliJ Version: Update IntelliJ IDEA to the latest version for compatibility (2021.3 or later is recommended).

JetBrains Plugin Repository Access: Verify that your IntelliJ IDE is configured to access JetBrains plugins.


Step 2: Install the GitHub Copilot Plugin




  Open IntelliJ IDEA:

1. Launch IntelliJ IDEA on your system.

2. Access the Plugin Manager:

   Go to File > Settings (or Preferences on macOS).

     Navigate to Plugins in the left-hand menu.

3. Search for GitHub Copilot:

     In the Plugins tab, go to the Marketplace section.
     Type GitHub Copilot in the search bar.

4. Install the Plugin:

     Select the GitHub Copilot plugin from the search results and click Install.

5. Restart IntelliJ IDEA:

After installation, restart the IDE to activate the plugin


Step 3: Log In to GitHub

1. Activate GitHub Copilot:

Once IntelliJ restarts, you will be prompted to log in to GitHub.
Click the Sign in to GitHub button.

2. Authenticate via GitHub:

A browser window will open for authentication.
Log in to your GitHub account and authorize the plugin to access your GitHub account.




3. Complete Authentication:

After successful login, the browser will redirect you back to IntelliJ IDE.

Set up your account with all the configurations like billing details and other things which required to use copilot services. Once done below screen will appear.




Step 4: Configure GitHub Copilot Settings

Open Copilot Settings:

Go to File > Settings (or Preferences on macOS).
Navigate to GitHub Copilot in the left-hand menu.

Adjust Preferences:

Enable or disable specific features like inline suggestions or Copilot's behavior for different programming languages.
Set preferences for triggering suggestions (e.g., on typing).


Now set up is done. Once every thing is done, u can see the below image



Step 5: Start Using GitHub Copilot
Open a Project:

Open any project or file where you want to use Copilot.
Write Code:

Start typing, and GitHub Copilot will provide code suggestions automatically.
Accept Suggestions:

Use Tab or a similar keybinding (based on your settings) to accept Copilot’s suggestions.
Trigger Manual Suggestions:

Use the shortcut Ctrl + Space (Windows/Linux) or Command + Space (macOS) to manually request suggestions.


If you type your query in the above mentioned chat box, you will get response and include the same in your code.




This will enable developers to accelerate their coding process effectively.








Tuesday, October 8, 2024

How AI works simple in layman's terms

 

AI, or Artificial Intelligence, works by enabling computers to "learn" from data and make decisions or predictions without needing explicit programming for every possible situation. Here’s a simple breakdown of how AI works in layman's terms:

AI isn't "thinking" like humans do. It’s more like a sophisticated pattern-matching tool that learns from data and gets better at making decisions, predictions, or recommendations over time based on that data.




1. Learning from Data

Imagine AI as a child learning from examples. Instead of being told everything step-by-step, the child is shown lots of examples to recognize patterns. For example, to teach an AI to recognize pictures of cats, you show it thousands of images of cats, and over time, it starts to figure out what makes a cat a cat (fur, whiskers, eyes, etc.).


This process is called training. The more data the AI sees, the better it becomes at recognizing patterns.


2. Making Predictions

Once an AI is trained, it can be tested on new data it hasn’t seen before. If the AI was trained to recognize cats, you can show it a new picture, and based on what it has learned, it can predict whether the picture contains a cat or not.


This is like how you would recognize a cat even if you’ve never seen that particular one before. The AI doesn't "know" what a cat is the way humans do, but it uses patterns from the training data to guess.


3. Improving Over Time

Just like a human can get better with practice, AI can improve the more it learns. This process is often called machine learning, where the AI keeps adjusting itself to get more accurate predictions or decisions.


For example, a recommendation system like Netflix can learn your preferences over time by watching your behavior (what shows you watch, how long you watch them) and then get better at suggesting movies or shows you'll like.


4. Different Types of AI

There are different kinds of AI, but most can be grouped into:


Rule-based AI: Follows predefined rules to solve problems. Like a calculator – it knows the rules of math but doesn't "learn."

Machine learning AI: Learns from examples and improves over time. Most of the modern AI systems (like Siri, Alexa, and self-driving cars) use this.

Deep learning AI: A more advanced form of machine learning that uses networks similar to the human brain (called neural networks) to solve very complex problems like image recognition or understanding language.

5. Mimicking Human Tasks

AI can mimic a variety of human tasks, such as:


Recognizing objects: Like identifying faces in photos.

Understanding language: Chatbots or virtual assistants like Siri or Google Assistant.

Making decisions: AI used in self-driving cars or medical diagnostics.



Wednesday, August 21, 2024

Best Popular Free AI tools

1. ChatGPT (OpenAI)

  • Purpose: Conversational AI, language generation.
  • Use Cases: Answering questions, generating text, brainstorming ideas, language translation, coding assistance.
  • Platform: Web-based, also available through API.
  • Strengths: Versatile, human-like text generation.

2. DALL-E 2 (OpenAI)

  • Purpose: Image generation from text prompts.
  • Use Cases: Creating unique images for design, marketing, and creative projects.
  • Platform: Web-based, accessible through API.
  • Strengths: Generates high-quality, creative images from descriptive text inputs.

3. DeepL

  • Purpose: Language translation.
  • Use Cases: Translating documents, websites, and text into different languages.
  • Platform: Web-based, app, browser extensions.
  • Strengths: High accuracy and nuanced translation quality.

4. Canva Magic Write

  • Purpose: AI-powered content creation.
  • Use Cases: Writing social media posts, blogs, emails, presentations.
  • Platform: Canva's design platform.
  • Strengths: Easy integration with design tools, ideal for marketers and content creators.

5. Runway ML

  • Purpose: Video editing and AI tools for creatives.
  • Use Cases: Video effects, image generation, text-to-image, object detection.
  • Platform: Web-based.
  • Strengths: User-friendly interface, wide range of creative AI tools.

6. Copy.ai

  • Purpose: AI copywriting.
  • Use Cases: Generating marketing copy, product descriptions, blog content.
  • Platform: Web-based.
  • Strengths: Tailored content generation for marketers, easy to use.

7. Lumen5

  • Purpose: Video creation from text.
  • Use Cases: Turning blog posts, articles, or any text into engaging videos.
  • Platform: Web-based.
  • Strengths: Simple, drag-and-drop interface, ideal for content marketers.

8. Hugging Face Transformers

  • Purpose: Natural language processing and machine learning models.
  • Use Cases: Sentiment analysis, text classification, translation, summarization.
  • Platform: Open-source libraries for Python.
  • Strengths: Extensive library of pre-trained models, strong community support.

9. Google Colab

  • Purpose: Cloud-based Jupyter notebook environment.
  • Use Cases: Running Python code, experimenting with machine learning models, data analysis.
  • Platform: Web-based.
  • Strengths: Free GPU access, collaborative features, supports many libraries.

10. Notion AI

  • Purpose: Productivity and AI-assisted writing.
  • Use Cases: Task management, writing assistance, note-taking, brainstorming.
  • Platform: Web-based, app.
  • Strengths: Seamlessly integrated into Notion’s workspace, assists with various writing tasks.




Thursday, June 20, 2024

Getting started Spring AI with OpenAI Chat Model

 Problem statement :  develop spring boot API which connect's to Open AI and will give top 5

                                       personalities of any sports. Other than sports,

                                       if you give another details should display warning message.


We have different AI Chat models as mentioned below

This is post will explain you about , how we can use Open AI model to build simple spring boot application

Step 1 :  Signup : https://platform.openai.com/signup

              generate key -  https://platform.openai.com/account/api-keys





Step 2 :           spring boot intializr : https://start.spring.io/

dependencies :  OpenAI and other related dependencies

                        Provide group  artifact and other required details

                       import project to IntelliJ

Step3 :          Write Controller 

package com.personal.openai;

import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.SystemMessage;
import org.springframework.ai.chat.messages.UserMessage;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OpenAIController {


@Autowired
private OpenAiChatModel openAiChatModel;

@GetMapping("/sports")
public String getSportPersonaDetails(@RequestParam String name){
var systemMessage = new SystemMessage("Your primary function is to provide details about sports," +
" if anything else asks simply say that i can provide only sports details");
String promptMessage = String.format(" Could you please provide detailed information" +
" on the top 5 sports persons currently in %s ?",name);
Message message = new UserMessage(promptMessage);
return openAiChatModel.call(message,systemMessage);

}
}


Step 4: update the properties/yaml

spring.application.name=openai
spring.ai.openai.api-key=sk-proj-NNcDe2HRc1UUjcbIRkRsT3Blbk
spring.ai.openai.chat.enabled=true
spring.ai.openai.chat.options.model=gpt-3.5-turbo
spring.ai.openai.chat.options.temperature=0.7


Step 5 : Run the code and start the server


pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.personal</groupId>
<artifactId>openai</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>openai</name>
<description>Demo project for Spring Boot ai</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>17</java.version>
<spring-ai.version>1.0.0-M1</spring-ai.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-bom</artifactId>
<version>${spring-ai.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

</project>


 

Step 6:  Output :   http://localhost:8080/sports?name=cricket

              http://localhost:8080/sports?name=tollywood

              
This how we can work on any Models. 



















        

AddToAny

Contact Form

Name

Email *

Message *