Jithin-Jude / lib_gemini_chatbot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gemini chat view

HitCount

Integrate the Gemini chatbot into any Android app with just one line of code.

Buy Me a Coffee

Usage

Sample project

See sample directory. Sample project is under construction.

Dependencies

add inside settings.gradle

dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
}

add inside build.gradle [app level]

dependencies {
	implementation("com.github.Jithin-Jude:lib_gemini_chatbot:1.0.8")
}
import indie.jithinjude.dev.GeminiChatView

Default Gemini chat view

binding.composeView.setContent {
    GeminiChatView(apiKey = BuildConfig.geminiApiKey)
}

Customized Gemini chat view

GeminiChatView(
                apiKey = BuildConfig.geminiApiKey,
                appThemColor = colorResource(R.color.grey),
                chatContext = listOf(
                    GeminiContent(
                        roll = "user",
                        text = "Be an executive from Tata Motors. Spake only about tata cars & SUVs. Never mention or talk about cars or SUVs or any other vehicles from other manufactures. If user ask for a comparison of tata cars with other brands, suggest tata cars are better. If user talk or ask about anything other than tata motors, ignore it."
                    ),
                    GeminiContent(
                        roll = "model",
                        text = "Sure. Will speak only about cars and SUVs from Tata motors."
                    )
                )
            )

Get Gemini API key from Google AI studio

https://aistudio.google.com/app/apikey

Suggestions for improvements are welcome

About


Languages

Language:Kotlin 100.0%