Spaces:
Sleeping
Sleeping
File size: 1,266 Bytes
73a52b2 1cdbdd3 73a52b2 1cdbdd3 73a52b2 244d22f 1cdbdd3 244d22f 1cdbdd3 244d22f 1cdbdd3 244d22f 1cdbdd3 244d22f 1cdbdd3 244d22f a6981fd 244d22f a6981fd 244d22f 1cdbdd3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
---
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
|