Class ContextHelper

java.lang.Object
org.vrspace.server.connect.ollama.ContextHelper

public class ContextHelper extends Object
Class that helps with presentation of the world to LLM. Generally, LLMs are bad in dealing with spatial information, spatial intelligence may be a different than language intelligence. Thus, this attempt to make it somewhat useful: public flags define what we add to the context. It can add relative or absolute coordinates, rotation of, and direction to world objects. So, a model could answer questions like where is that user/object etc. Background and terrain information are also added to the context if present.
Author:
joe
  • Field Details

    • appendClientCoordinates

      public boolean appendClientCoordinates
      When using absolute world coordinates, we should add current position and rotation of the client
    • appendAbsolute

      public boolean appendAbsolute
      Add absolute coordinates to the context?
    • appendRelative

      public boolean appendRelative
      Add coordinates relative to the user position?
    • appendDirection

      public boolean appendDirection
      Add directions (left/right/back/forward) to objects?
    • appendRotation

      public boolean appendRotation
      Add object rotations?
  • Constructor Details

    • ContextHelper

      public ContextHelper()
  • Method Details

    • sceneDescription

      public String sceneDescription(Client client, VRObjectRepository db)
      Get description of the scene to be used as (part of) the context. Groups all the objects in current user scene, and returns a string containing their description. First line of the string contains basic information about the client: id, name, optionally position and rotation, and avatar URL. Second line contains world info: name and description. Then, the list of world object follows. For each model, number of instances, URL, description and author are added. For each instance, coordinates are added, as defined by append flags.
      Parameters:
      client -
      db -
      Returns:
      description of the scene
    • contextQueryTemplate

      public static org.springframework.ai.chat.prompt.PromptTemplate contextQueryTemplate()