initial commit

This commit is contained in:
Ayomide
2025-07-11 22:29:45 +01:00
commit 0b5a7218b0
8 changed files with 370 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import cohere
from .config import Config
class EmbeddingGenerator:
def __init__(self):
self.client = cohere.Client(Config.COHERE_API_KEY)
def generate_embeddings(self, text: str):
response = self.client.embed(
texts=[text],
model=Config.EMBED_MODEL,
input_type="document"
)
return response.embeddings[0]
def rerank_issues(self, issues: list, query: str, top_n: int = 5):
response = self.client.rerank(
query=query,
documents=issues,
top_n=top_n,
model=Config.RERANK_MODEL
)
return [result.document for result in response.results]