llm-agent-api / README.md
caiocampos-hotmart
chore: add logs
a6981fd
metadata
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:

{
  "message": "Olá, como você está?",
  "max_tokens": 100,
  "temperature": 0.7
}

Response:

{
  "response": "Olá! Estou bem, obrigado por perguntar. Como posso ajudá-lo hoje?"
}

GET /health

Verifica status da API.

Response:

{
  "status": "healthy"
}

Como usar

Local

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

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

# Local
curl http://localhost:7860/health

# HF Spaces
curl https://caiiofc-llm-agent-api.hf.space/health

Tecnologias

  • FastAPI
  • llama-cpp-python
  • Uvicorn