ProductPromotion
Logo

Angular.JS

made by https://0x3d.site

GitHub - gsans/mini-bard-palm2-angular: Mini-Bard client for Angular using Gemini Pro via API key from Google AI Studio
Mini-Bard client for Angular using Gemini Pro via API key from Google AI Studio - gsans/mini-bard-palm2-angular
Visit Site

GitHub - gsans/mini-bard-palm2-angular: Mini-Bard client for Angular using Gemini Pro via API key from Google AI Studio

GitHub - gsans/mini-bard-palm2-angular: Mini-Bard client for Angular using Gemini Pro via API key from Google AI Studio

Mini-Gemini Chatbot Angular client using Gemini API (via API key and Google AI Studio)

Features

  • Support for Google AI and VertexAI APIs
  • Gemini API (generateContent, startChat and sendMessage)
  • Demonstration of Gemini for Text with text-to-speech (ElevenLabs)
  • Demonstration of Gemini for Chat with Rich Media support (markdown, code, emojis, formulas and diagrams)
  • Demonstration of Gemini for Images with Rich Media support (markdown, code, emojis, formulas and diagrams)

Libraries

  • Angular Material
  • Gemini for Text:
    • ngx-quill - Angular QuillJS wrapper, a Rich Text Editor
    • QuillJS. Custom non-editable block (embed blot) to handle model responses.
    • ElevenLabs API - High quality natural voices
  • Gemini for Chat:
    • ngx-markdown - Markdown renderer with support for multiple extensions (code fences and highlighting, emojis, Katex mathematic formulas, MermaidJS diagrams and more)
  • Gemini for Images:
    • ngx-markdown - Markdown renderer with support for multiple extensions (code fences and highlighting, emojis, Katex mathematic formulas, MermaidJS diagrams and more)

This project was generated with Angular CLI.

Project Set-up

Run this Angular CLI command to get the local environment setup:

ng g environments

This will create the following files for development and production:

src/environments/environment.development.ts
src/environments/environment.ts

Change these files to include your environment setup accordingly. For the examples below we will use the development file:

// src/environments/environment.development.ts
export const environment = {
  /// your setup
};

This project includes clients to both VertexAI and Gemini APIs.

Setup for Gemini API access via API key (Google AI Studio)

Get an API key from Google AI Studio, then configure it here.

Note that access is restricted to the US. Use a VPN to overcome this limitation while outside the US.

// src/environments/environment.development.ts
export const environment = {
  API_KEY: "<<YOUR-API-KEY-FROM-GOOGLE-AI-STUDIO>>",
};

Setup for API access via VertexAI (Google Cloud)

This setup requires a Google Cloud account and is more advanced both in security and capabilities. VertexAI has access to more advanced Generative AI features (image, code, voice and more) and foundational models.

To secure the API access, you need to create an account and get the credentials for your application so only you can access it. Here are the steps:

Once you have the project ID and access token, you are ready to move on to the Angular app. To verify everything is setup correctly you can try these curl commands.

// src/environments/environment.development.ts
export const environment = {
  PROJECT_ID: "<<YOUR-PROJECT-ID>>",
  GCLOUD_AUTH_PRINT_ACCESS_TOKEN: "<<YOUR-GCLOUD-AUTH-PRINT-ACCESS-TOKEN>>", 
};

Make sure that your access token remains private so you do not incur into expenses from unauthorised access.

You can find more details into how to setup the VertexAI access in this article

ElevenLabs Setup

This project supports the regular and streamed APIs for faster responsiveness.

You can use the newest eleven_multilingual_v2, a single foundational model supporting 28 languages including English, Chinese, Spanish, Hindi, Portuguese, French, German, Japanese, Arabic, Korean, Indonesian, Italian, Dutch, Turkish, Polish, Swedish, Filipino, Malay, Romanian, Ukrainian, Greek, Czech, Danish, Finnish, Bulgarian, Croatian, Slovak, and Tamil; or eleven_monolingual_v1, a low-latency model specifically trained for English speech.

You need to generate your API key (Sign In/Profile).

Picking a voice

Using your API key you can either use Speech Synthesis to listen to the voices and open Developer Tools/Network to extract the voice-id from the request or use the API as shown below:

curl -X 'GET' \
'https://api.elevenlabs.io/v1/voices' \
-H 'accept: application/json' \
-H 'xi-api-key: <<API-KEY>>'

Pick a voice from the response

{
  "voices": [
    {
      "voice_id": "21m00Tcm4TlvDq8ikWAM",
      "name": "Rachel",
      "category": "premade",
      "labels": {
        "accent": "american",
        "description": "calm",
        "age": "young",
        "gender": "female",
        "use case": "narration"
      },
      "preview_url": "https://storage.googleapis.com/eleven-public-prod/premade/voices/21m00Tcm4TlvDq8ikWAM/df6788f9-5c96-470d-8312-aab3b3d8f50a.mp3",
      ...
    },
  ]
}

Once you have the API key and voice-id you can fill in the remaining entries in the environment file.

// src/environments/environment.development.ts
export const environment = {
  ELEVEN_LABS_API_KEY: "<<ELEVEN-LABS-API-KEY>>",
  ELEVEN_LABS_VOICE_ID: "<<ELEVEN-LABS-VOICE-ID>>",
};

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory