llm-agent-api / README.md
caiocampos-hotmart
chore: add logs
a6981fd
---
title: Llm Agent Api
emoji: 🌍
colorFrom: blue
colorTo: gray
sdk: docker
pinned: false
license: mit
---
# 🧠 LLM Agent API
API REST com modelo Llama 2 7B rodando localmente usando llama-cpp-python.
## Endpoints
### POST /chat
Envia mensagem para o agente LLM.
**Request:**
```json
{
"message": "Olá, como você está?",
"max_tokens": 100,
"temperature": 0.7
}
```
**Response:**
```json
{
"response": "Olá! Estou bem, obrigado por perguntar. Como posso ajudá-lo hoje?"
}
```
### GET /health
Verifica status da API.
**Response:**
```json
{
"status": "healthy"
}
```
## Como usar
### Local
```bash
curl -X POST "http://localhost:7860/chat" \
-H "Content-Type: application/json" \
-d '{"message": "Explique machine learning em 3 frases", "max_tokens": 150, "temperature": 0.3}'
```
### Hugging Face Spaces
```bash
curl -X POST "https://caiiofc-llm-agent-api.hf.space/chat" \
-H "Content-Type: application/json" \
-d '{"message": "Explique machine learning em 3 frases", "max_tokens": 100, "temperature": 0.75}'
```
### Teste de saúde
```bash
# Local
curl http://localhost:7860/health
# HF Spaces
curl https://caiiofc-llm-agent-api.hf.space/health
```
## Tecnologias
- FastAPI
- llama-cpp-python
- Uvicorn