Initial Commit

This commit is contained in:
2025-04-21 21:24:55 -03:00
commit 0cb8298272
10 changed files with 2357 additions and 0 deletions

15
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,15 @@
{
// para o Language Server enxergar seu src como pacote
"python.analysis.extraPaths": [
"${workspaceFolder}/backend"
],
// para o autocompletar do VSCode
"python.autoComplete.extraPaths": [
"${workspaceFolder}/backend"
],
// para o terminal integrado herdar o PYTHONPATH
"terminal.integrated.env.linux": {
"PYTHONPATH": "${workspaceFolder}/backend"
},
"python.analysis.autoImportCompletions": false
}

1
backend/.python-version Normal file
View File

@@ -0,0 +1 @@
3.12

View File

@@ -0,0 +1,18 @@
from .models.DB_model import DBInterface;
class ChromaDB(DBInterface):
def __init__(self):
super().__init__()
def connect(self):
def disconnect(self):
raise NotImplementedError
def execute(self, command, parameters):
raise NotImplementedError

8
backend/LLM/Ollama.py Normal file
View File

@@ -0,0 +1,8 @@
from interfaces.LLM_model import LLMInterface
from langchain_core.prompts import ChatMessagePromptTemplate
class OllamaLLM(LLMInterface):
def __init__(self):
super().__init__()

0
backend/README.md Normal file
View File

View File

@@ -0,0 +1,25 @@
from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional
class DBInterface(ABC):
@abstractmethod
def connect(self) -> None:
"""
Cria a conexão com o banco de dados
"""
pass
@abstractmethod
def disconnect(self) -> bool:
"""
Disconecta a instancia do banco de dados
Returns:
bool: _description_
"""
pass
@abstractmethod
def execute(self, command: str, parameters: Dict[str, any]):
pass

View File

@@ -0,0 +1,22 @@
from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional, TypedDict
class GenerateParams(TypedDict):
temperature: float
top_p: float
max_tokens: int
stop_sequences: Optional[list[str]]
class LLMInterface(ABC):
@abstractmethod
def reset_context(self) -> None:
"""Reseta o contexto da conversa"""
pass
@abstractmethod
def generate(self, prompt: str,):
pass
@abstractmethod
def set_parameters(self, params: GenerateParams) -> None:
pass

6
backend/main.py Normal file
View File

@@ -0,0 +1,6 @@
def main():
print("Hello from backend!")
if __name__ == "__main__":
main()

13
backend/pyproject.toml Normal file
View File

@@ -0,0 +1,13 @@
[project]
name = "backend"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"chromadb>=0.6.3",
"fastapi[standard]>=0.115.12",
"langchain>=0.3.23",
"langchain-community>=0.3.21",
"langchain-ollama>=0.3.2",
]

2249
backend/uv.lock generated Normal file

File diff suppressed because it is too large Load Diff