Devika is the first open-source implementation of an Agentic Software Engineer. Initially started as an open-source alternative to Devin.
Python
added gemini 1.0, 1.5, duckduckgo, bun i in setup
nalaso31969e887877
diff --git a/config.toml b/config.tomlindex 8e45dbc..0deafc7 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>"+GEMINI = "<YOUR_GEMINI_API_KEY>"[API_ENDPOINTS]BING = "https://api.bing.microsoft.com/v7.0/search"diff --git a/requirements.txt b/requirements.txtindex 53496f4..6a06c9d 100644--- a/requirements.txt+++ b/requirements.txt@@ -20,4 +20,6 @@ keybertGitPythonnetlify-pyMarkdown-xhtml2pdf\ No newline at end of file+xhtml2pdf+google-generativeai+duckduckgo-search\ No newline at end of filediff --git a/setup.sh b/setup.shindex bfefa50..9ddd3d2 100644--- a/setup.sh+++ b/setup.sh@@ -4,4 +4,4 @@ pip3 install -r requirements.txtplaywright installpython3 -m playwright install-depscd ui/-npm install+bun installdiff --git a/src/agents/agent.py b/src/agents/agent.pyindex 204360c..37b6cdb 100644--- a/src/agents/agent.py+++ b/src/agents/agent.py@@ -17,7 +17,7 @@ from src.state import AgentStatefrom src.bert.sentence import SentenceBertfrom src.memory import KnowledgeBase-from src.browser.search import BingSearch+from src.browser.search import BingSearch,DuckDuckGoSearchfrom src.browser import Browserfrom src.browser import start_interactionfrom src.filesystem import ReadCode@@ -63,7 +63,8 @@ class Agent:results = {}knowledge_base = KnowledgeBase()- bing_search = BingSearch()+ # web_search = BingSearch()+ web_search = DuckDuckGoSearch()browser = Browser()for query in queries:@@ -80,8 +81,8 @@ class Agent:"""Search for the query and get the first link"""- bing_search.search(query)- link = bing_search.get_first_link()+ web_search.search(query)+ link = web_search.get_first_link()"""Browse to the link and take a screenshot, then extract the textdiff --git a/src/browser/search.py b/src/browser/search.pyindex daa22d8..41954db 100644--- a/src/browser/search.py+++ b/src/browser/search.py@@ -1,5 +1,6 @@import requestsfrom src.config import Config+from duckduckgo_search import DDGSclass BingSearch:def __init__(self):@@ -23,3 +24,13 @@ class BingSearch:def get_first_link(self):return self.query_result["webPages"]["value"][0]["url"]+class DuckDuckGoSearch:+ def search(self, query):+ try:+ self.query_result = DDGS().text(query, max_results=5)+ return self.query_result+ except Exception as err:+ return err++ def get_first_link(self):+ return self.query_result[0]["href"]\ No newline at end of filediff --git a/src/config.py b/src/config.pyindex 4f0d06b..c594957 100644--- a/src/config.py+++ b/src/config.py@@ -19,6 +19,9 @@ class Config:def get_openai_api_key(self):return self.config["API_KEYS"]["OPENAI"]+ def get_gemini_api_key(self):+ return self.config["API_KEYS"]["GEMINI"]+def get_netlify_api_key(self):return self.config["API_KEYS"]["NETLIFY"]@@ -56,6 +59,10 @@ class Config:self.config["API_KEYS"]["OPENAI"] = keyself.save_config()+ def set_openai_api_key(self, key):+ self.config["API_KEYS"]["GEMINI"] = key+ self.save_config()+def set_netlify_api_key(self, key):self.config["API_KEYS"]["NETLIFY"] = keyself.save_config()diff --git a/src/llm/gemini_client.py b/src/llm/gemini_client.pynew file mode 100644index 0000000..4c6984a--- /dev/null+++ b/src/llm/gemini_client.py@@ -0,0 +1,14 @@+import google.generativeai as genai++from src.config import Config++class Gemini:+ def __init__(self):+ config = Config()+ api_key = config.get_gemini_api_key()+ genai.configure(api_key=api_key)++ def inference(self, model_id: str, prompt: str) -> str:+ model = genai.GenerativeModel(model_id)+ response = model.generate_content(prompt)+ return response.text\ No newline at end of filediff --git a/src/llm/llm.py b/src/llm/llm.pyindex 4080b5e..b5ee88b 100644--- a/src/llm/llm.py+++ b/src/llm/llm.py@@ -3,6 +3,7 @@ from enum import Enumfrom .ollama_client import Ollamafrom .claude_client import Claudefrom .openai_client import OpenAI+from .gemini_client import Geminiimport tiktoken@@ -15,6 +16,8 @@ class Model(Enum):CLAUDE_3_HAIKU = ("Claude 3 Haiku", "claude-3-haiku-20240307")GPT_4_TURBO = ("GPT-4 Turbo", "gpt-4-0125-preview")GPT_3_5 = ("GPT-3.5", "gpt-3.5-turbo-0125")+ GEMINI_1_0_PRO = ("Gemini 1.0 Pro", "gemini-1.0-pro")+ GEMINI_1_5_PRO = ("Gemini 1.5 Pro", "gemini-1.5-pro")OLLAMA_MODELS = [(model["name"].split(":")[0],@@ -56,6 +59,8 @@ class LLM:response = Claude().inference(self.model_id, prompt).strip()elif "GPT" in str(model):response = OpenAI().inference(self.model_id, prompt).strip()+ elif "GEMINI" in str(model):+ response = Gemini().inference(self.model_id, prompt).strip()else:raise ValueError(f"Model {model} not supported")