AI

The AI endpoint allows you to interact with the Rocket Networking AI service, powered by OpenAI. This endpoint allows you to make requests to generate AI-based responses using the GPT-3.5 Turbo model. You need to provide proper authentication using the Authorization header to access this endpoint.

Endpoint Details

  • URL: https://apps.rocketnetworking.net/api/ai

  • HTTP Method: POST

  • Authentication: Include your serverId in the Authorization header for all requests.

Request

The AI endpoint accepts POST requests with the following parameters:

Request Body

The request body should include the following fields:

  • messages: An array of message objects that form the conversation context. Each message object should have a role (either 'system', 'user', or 'assistant') and content containing the text of the message.

  • temperature: A floating-point value controlling the randomness of the AI's response. Higher values (e.g., 0.8) make the response more random, while lower values (e.g., 0.2) make it more deterministic.

Example Request Body

{
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Tell me a joke."},
    {"role": "assistant", "content": "Why did the chicken cross the road?"}
  ],
  "temperature": 0.7,

}

Response

Upon successful completion of the AI request, the API will return a JSON response with the following fields:

  • creditsUsed: The number of RNet credits used for this AI request.

  • message: The content of the AI-generated response.

Example Response

{
  "creditsUsed": 54,
  "message": "Because it wanted to get to the other side!"
}

Error Handling

  • If the request lacks proper authentication (missing or invalid Authorization header), the API will respond with a 401 Unauthorized status and an error message.

  • In case of internal server errors, the API will respond with a 500 Internal Server Error status.

Last updated