Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion experiments/yandex_api/ExperimentYandexGPT2API.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.12.12"
}
},
"nbformat": 4,
Expand Down
9 changes: 6 additions & 3 deletions mlops/docker/docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ services:
- /etc/nginx/nginx.conf:/etc/nginx/nginx.conf # Главный конфиг
- /etc/nginx/conf.d:/etc/nginx/conf.d # Доп. конфиги (app.conf)

# SSL и токены
- /etc/letsencrypt/live/profkom-chatbot.ru/fullchain.pem:/etc/letsencrypt/live/profkom-chatbot.ru/fullchain.pem
- /etc/letsencrypt/live/profkom-chatbot.ru/privkey.pem:/etc/letsencrypt/live/profkom-chatbot.ru/privkey.pem
# SSL
- /etc/letsencrypt/live:/etc/letsencrypt/live:ro
- /etc/letsencrypt/archive:/etc/letsencrypt/archive:ro
# Certbot webroot
- /etc/certbot/www:/var/www/certbot
# Токены
- /etc/nginx/tokens:/etc/nginx/tokens # Файлы с токенами

# Логи
Expand Down
26 changes: 2 additions & 24 deletions mlops/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
version: '3.8'

services:
chatbot:
image: union-chatbot:latest
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
resources:
limits:
cpus: '2.0'
memory: 2G
reservations:
cpus: '1.0'
memory: 1G
expose:
- "32000"
env_file:
- /opt/unionchatbot/.env.prod
networks:
- app-network

redis:
image: redis:7-alpine
image: redis:latest
deploy:
restart_policy:
condition: on-failure
Expand Down Expand Up @@ -68,9 +47,8 @@ services:
networks:
- app-network

postgres_test:
postgres:
image: postgres:15-alpine
container_name: postgres_test
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "UnionChatBot"
version = "0.3.0"
version = "0.3.1"
description = "LangChain based Agent to please them all!"
readme = "README.md"
requires-python = "==3.12.*"
Expand Down Expand Up @@ -65,6 +65,8 @@ dev = [
"pytest-asyncio",
"httpx",
"pytest-cov>=7.1.0",
"deepeval",
"openai",
]

[tool.ruff]
Expand Down
2 changes: 1 addition & 1 deletion src/agents/profkom_consultant/nodes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def _node_span(self, name: str, state: AgentState):
yield span
finally:
if span:
span.end()
span.end(output=dict(state))
current_span.set(None)

def _llm_config(self, span):
Expand Down
8 changes: 8 additions & 0 deletions src/service/api/v1/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ async def chat(
"text": request.organisation + " | " + request.text,
"status": AgentStatus.ACTIVE,
}
trace = None
try:
client = await APP_CTX.get_postgres_client()
async with client.get_user_checkpointer() as checkpointer:
Expand Down Expand Up @@ -98,10 +99,17 @@ async def chat(
input=agent_payload,
config=config,
)
if trace:
trace.update(
input=agent_payload,
output=dict(result),
)
logger.debug(f"Ответ сгенерирован. Его длина {len(result['final_answer'])} символов")
return AgentChatResponse(response=result["final_answer"])

except Exception as e:
if trace:
trace.update(input=agent_payload, output={"error": str(e)})
logger.critical(
f"""Ошибка агента:
[user_id={headers.get("x-user-id")}],
Expand Down
Empty file added tests/evals/__init__.py
Empty file.
Loading
Loading