Skip to content

Devika is the first open-source implementation of an Agentic Software Engineer. Initially started as an open-source alternative to Devin.

Python

Groq Added

Vasanth0557bcfa9168
diff --git a/config.toml b/config.toml
index 8e45dbc..e049eca 100644
--- a/config.toml
+++ b/config.toml
@@ -11,6 +11,7 @@ BING = "<YOUR_BING_API_KEY>"
CLAUDE = "<YOUR_CLAUDE_API_KEY>"
NETLIFY = "<YOUR_NETLIFY_API_KEY>"
OPENAI = "<YOUR_OPENAI_API_KEY>"
+GROQ = "<YOUR_GROQ_API_KEY>"
[API_ENDPOINTS]
BING = "https://api.bing.microsoft.com/v7.0/search"
diff --git a/requirements.txt b/requirements.txt
index 53496f4..65823cd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -20,4 +20,5 @@ keybert
GitPython
netlify-py
Markdown
-xhtml2pdf
\ No newline at end of file
+xhtml2pdf
+groq
\ No newline at end of file
diff --git a/src/config.py b/src/config.py
index 4f0d06b..0a73d6e 100644
--- a/src/config.py
+++ b/src/config.py
@@ -22,6 +22,9 @@ class Config:
def get_netlify_api_key(self):
return self.config["API_KEYS"]["NETLIFY"]
+ def get_groq_api_key(self):
+ return self.config["API_KEYS"]["GROQ"]
+
def get_sqlite_db(self):
return self.config["STORAGE"]["SQLITE_DB"]
diff --git a/src/llm/groq_client.py b/src/llm/groq_client.py
new file mode 100644
index 0000000..92fb840
--- /dev/null
+++ b/src/llm/groq_client.py
@@ -0,0 +1,24 @@
+from groq import Groq
+
+from src.config import Config
+
+class Groq:
+ def __init__(self, api_key: str):
+ config = Config()
+ api_key = config.get_groq_api_key()
+ self.client = Groq(
+ api_key=api_key,
+ )
+
+ def inference(self, model_id: str, prompt: str) -> str:
+ chat_completion = self.client.chat.completions.create(
+ messages=[
+ {
+ "role": "user",
+ "content": prompt.strip(),
+ }
+ ],
+ model=model_id,
+ )
+
+ return chat_completion.choices[0].message.content