Skip to content

Commit

Permalink
Create LLM Comparison file in /docs
Browse files Browse the repository at this point in the history
Perhaps we should move this file to another folder, to maintain a well organized storage structure.
  • Loading branch information
saulmf authored Feb 10, 2025
1 parent 8dc3d2b commit e59cf02
Showing 1 changed file with 110 additions and 0 deletions.
110 changes: 110 additions & 0 deletions docs/LLM_Comparison.adoc
Original file line number Diff line number Diff line change
@@ -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?");
----

0 comments on commit e59cf02

Please sign in to comment.