Rocket Networking Docs🚀
  • About this Documentation
  • Basics of Rocket Networking
    • Room based multiplayer (Auto State Sharing)
      • Clients and clientId
      • Entities
      • Smart Entities
    • Single Message Sharing
    • Persistent Objects on the Server
    • Easy Matchmaking
    • Discord Server Integration
    • Database for your Account
    • Server Side Scripting
    • Global Multiplayer(Cross play)
  • Rocket Networking Code
    • Connecting and Disconnecting
      • ConnectToServer()
      • callback_ConnectToServer()
      • DisconnectFromServer()
      • callback_DisconnectFromServer()
    • Rooms
      • ChangeRoom( new_room_name )
      • callback_ChangeRoom()
      • LeaveRoom()
      • callback_LeaveRoom()
      • ShowAllClientsInRoom(room_name ) and callback_ShowAllClientsInRoom()
      • ShowAllRooms() and callback_ShowAllRooms()
    • Private Messaging
      • SendEventToClient
      • callback_ReceivedEvent
      • SendMessageToClient
      • callback_ReceivedMessage
    • Persistent Objects
      • CreatePersistentObject(roomId , persistentObjectStruct)
      • callback_CreatedPersistentObject()
      • EditPersistentObject(persistentObjectId , new_persistentObjectStruct)
      • DestroyPersistentObject(persistentObjectId)
      • ShowPersistentObjectsInRoom(room_name)
      • callback_ShowAllPersistentObjectsInRoom(array_of_persistent_objects)
    • Database Functions
      • SetSimpleData()
      • callback_SetSimpleData()
      • ReadSimpleData()
      • callback_ReadSimpleData()
      • AddToSimpleData()
      • callback_AddToSimpleData()
      • DeleteSimpleData()
    • Discord Integration
      • SendDiscordMessage()
      • callback_DiscordMessageReceived()
    • AI Functions
      • CallSimpleAI
      • callback_CallSimpleAI
      • CallGeneralAI
      • callback_CallGeneralAI
  • KickPlayer(client_id)
  • ViewServerActivity()
    • callback_ViewServerActivity()
  • oBrain - ping and pseudoHost
  • Admin Callbacks
  • API
    • Database
    • AI
  • Server Side Scripting
    • Basics
    • Understand the heirarchy on the server
    • Create a Persistent Object from Server
    • Important Scripts
      • "step" Script format
      • "client_sent_event" Script format
      • "game_server_created" Script format
    • Send Event to a Client from Server
    • Database Functions on Server
    • AI Functions on the Server
Powered by GitBook
On this page
  • Endpoint Details
  • Request
  • Response
  • Error Handling
  1. API

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.

PreviousDatabaseNextBasics

Last updated 1 year ago