Skip to content

LLMs

The LLMs endpoints allow interaction with the large language models available on the SipPulse AI platform. You can get a list of all available models and generate responses using the language models.

Endpoints

GET /llms/models

This endpoint returns a list of all available LLMs models.

Query Parameters

  • status (optional): The status of the models. Can be active or inactive. Default is active.

Example Request

bash
curl -X 'GET' \
  'https://api.sippulse.ai/v1/llms/models' \
  -H 'Content-Type: application/json' \
  -H 'api-key: $SIPPULSE_API_KEY'
python
import requests

url = "https://api.sippulse.ai/v1/llms/models"
headers = {
    "Content-Type": "application/json",
    "api-key": "SIPPULSE_API_KEY"
}

response = requests.get(url, headers=headers)
print(response.json())
javascript
const url = "https://api.sippulse.ai/v1/llms/models";
const headers = {
  "Content-Type": "application/json",
  "api-key": "SIPPULSE_API_KEY",
};

fetch(url, {
  method: "GET",
  headers: headers,
})
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

Example Response

json
[
  { "name": "claude-3-haiku-20240307", "status": "active" },
  { "name": "claude-3-sonnet-20240229", "status": "active" }
  // ...
]

POST /llms/completion

This endpoint generates a response based on a message input using the specified model.

Request Body

json
{
  "model": "string", // Name of the model to be used, use the /llms/models endpoint to get the list of available models
  "messages": [
    // List of messages that make up the conversation
    {
      "role": "system",
      "content": "You are a helpful and friendly assistant."
    },
    {
      "role": "user",
      "content": "What are the latest news in technology?"
    }
  ],
  "temperature": 0.7, // (optional) Control randomness
  "max_tokens": 150, // (optional) Maximum number of tokens to generate
  "top_p": 0.9, // (optional) Sample tokens with probability of `top_p`
  "frequency_penalty": 0, // (optional) Frequency penalty
  "presence_penalty": 0 // (optional) Presence penalty
}

Request Example

bash
curl -X 'POST' \
  'https://api.sippulse.ai/v1/llms/completion' \
  -H 'Content-Type: application/json' \
  -H 'api-key: $SIPPULSE_API_KEY' \
  -d '{
  "model": "gpt-4o",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful and friendly assistant."
    },
    {
      "role": "user",
      "content": "What are the latest news in technology?"
    }
  ],
  "temperature": 0.7,
  "max_tokens": 150,
  "top_p": 0.9
}'
python
import requests
import json

url = "https://api.sippulse.ai/v1/llms/completion"
headers = {
    "Content-Type": "application/json",
    "api-key": "SIPPULSE_API_KEY"
}
data = {
    "model": "gpt-4o",
    "messages": [
      {"role": "system", "content": "You are a helpful and friendly assistant."},
      {"role": "user", "content": "What are the latest news in technology?"}
    ],
    "temperature": 0.7,
    "max_tokens": 150,
    "top_p": 0.9
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
javascript
const url = "https://api.sippulse.ai/v1/llms/completion";
const headers = {
  "Content-Type": "application/json",
  "api-key": "SIPPULSE_API_KEY",
};
const data = {
  model: "gpt-4o",
  messages: [
    {
      role: "system",
      content: "You are a helpful and friendly assistant.",
    },
    {
      role: "user",
      content: "What are the latest news in technology?",
    },
  ],
  temperature: 0.7,
  max_tokens: 150,
  top_p: 0.9,
};

fetch(url, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(data),
})
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

Exemplo de Resposta

json
{
  "cached": false,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Unfortunately, I don't have real-time access to news or updates as my data was last updated in October 2023. However, I can inform you about some general trends and recent innovations up until that date:\n\n1. **Artificial Intelligence and Machine Learning**: Significant advancements continue to be made in AI and ML, with new applications in areas such as healthcare, industrial automation, and consumer services.\n\n2. **Quantum Computing**: Companies like Google, IBM, and others are making progress in quantum computing, promising to solve complex problems that are impractical for classical computers.\n\n3. **5G and Connectivity**: The implementation"
      },
      "logprobs": null,
      "finish_reason": "length"
    }
  ],
  "usage": {
    "input_tokens": 150,
    "output_tokens": 30
  },
  "model": "gpt-4o-2024-05-13",
  "execution_time": 3156
}

Conclusion

The LLMs endpoints from SipPulse AI offer a powerful way to integrate advanced text generation capabilities into your applications. Use the provided information and examples to start exploring and implementing these functionalities in your projects.