From e59cf0274c50b7da1c837ea1d02742b8f554e440 Mon Sep 17 00:00:00 2001 From: Saul <158204665+UO294936@users.noreply.github.com> Date: Mon, 10 Feb 2025 08:18:44 +0100 Subject: [PATCH] Create LLM Comparison file in /docs Perhaps we should move this file to another folder, to maintain a well organized storage structure. --- docs/LLM_Comparison.adoc | 110 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 docs/LLM_Comparison.adoc diff --git a/docs/LLM_Comparison.adoc b/docs/LLM_Comparison.adoc new file mode 100644 index 00000000..78a10f95 --- /dev/null +++ b/docs/LLM_Comparison.adoc @@ -0,0 +1,110 @@ += Pros and Cons List + +== 1. Gemini API (by Google) + +=== Pros: +* *Advanced AI Capabilities:* Strong at understanding and generating human-like text, making it useful for giving hints dynamically. +* *Context Awareness:* Can remember previous interactions in a conversation, making it helpful for progressive hints. +* *Multimodal Support:* Can process text, images, and even voice (depending on the version). +* *Google Integration:* If your app involves other Google services (like Firebase or Google Cloud), integration is smoother. + +=== Cons: +* *Pricing:* Can become expensive depending on usage volume. +* *Latency:* Depending on API usage and complexity, response time might not be instant. +* *API Limits:* May have restrictions on request frequency and token limits. + +== 2. Empathy API + +=== Pros: +* *Emotion & Sentiment Analysis:* Focuses on understanding user emotions (could be useful for adjusting hint difficulty based on frustration level). +* *Customization:* Some versions allow fine-tuning responses for more user-friendly interactions. +* *Ethical AI Focus:* Designed to be safe, transparent, and aligned with responsible AI practices. + +=== Cons: +* *Limited AI Capabilities:* Less advanced than Gemini in complex reasoning and providing contextual hints dynamically. +* *Less Widespread Support:* Fewer developer resources and documentation compared to Google’s AI ecosystem. +* *Scalability:* Might not handle a high number of concurrent users as efficiently as Gemini. + +== Implementation Difficulty: Gemini API vs. Empathy API + +[options="header"] +|=== +| Feature | Gemini API | Empathy API +| *Ease of Setup* | 🟑 Moderate – Requires Google API Key, setting up permissions in Google Cloud | 🟒 Easier – Designed for user-friendly integration with simple REST calls +| *Documentation & Support* | 🟒 Excellent – Extensive Google support & community | 🟑 Limited – Fewer resources, but still documented +| *Integration Complexity* | πŸ”΄ More complex – Uses Google AI SDKs, may require Firebase integration for persistence | 🟒 Simpler – Mostly REST API-based, easier to use directly in a web app +| *Customization* | 🟒 Highly customizable – Can fine-tune responses | 🟑 Limited – More focused on sentiment analysis +| *Response Speed* | 🟑 Can be slow for complex queries | 🟒 Generally faster for simple interactions +|=== + +== Considering Ease of Implementation + +* An easy-to-integrate solution β†’ *Empathy API* is simpler to implement with basic REST API calls. +* Most powerful AI with more control over responses β†’ *Gemini API* is better, but requires more setup (Google Cloud configuration, API key, potential SDK use). + +== Usage Example + +=== 1. Gemini API (Google AI) Example +Google's Gemini API requires Google Cloud setup, an API key, and uses a RESTful API or Python SDK. + +==== Setup for Gemini API +. Get an API key from Google AI Studio or Google Cloud Console. +. Enable Gemini API in Google Cloud. +. Use a REST request to send queries. + +[source,javascript] +---- +const axios = require("axios"); + +// Replace with your actual Gemini API key +const API_KEY = "YOUR_GEMINI_API_KEY"; +const API_URL = `https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateText?key=${API_KEY}`; + +async function getHint(question) { + try { + const response = await axios.post(API_URL, { + prompt: { text: `Provide a hint for this question: ${question}` } + }); + + console.log("Hint:", response.data.candidates[0].output); + } catch (error) { + console.error("Error fetching hint:", error.message); + } +} + +// Example usage +getHint("What is the capital of France?"); +---- + +=== 2. Empathy API Example +Empathy API is easier to use and mainly focuses on sentiment-based interactions. + +==== Setup for Empathy API +. Sign up on Empathy API’s website to get an API key. +. Use a REST request to send queries. + +[source,javascript] +---- +const axios = require("axios"); + +// Replace with your actual Empathy API key +const API_KEY = "YOUR_EMPATHY_API_KEY"; +const API_URL = "https://api.empathy.co/hints"; + +async function getHint(question) { + try { + const response = await axios.post(API_URL, { + query: question, + apiKey: API_KEY + }); + + console.log("Hint:", response.data.hint); + } catch (error) { + console.error("Error fetching hint:", error.message); + } +} + +// Example usage +getHint("What is the capital of France?"); +---- +