Class ContextHelper
java.lang.Object
org.vrspace.server.connect.ollama.ContextHelper
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 Summary
FieldsModifier and TypeFieldDescriptionbooleanAdd absolute coordinates to the context?booleanWhen using absolute world coordinates, we should add current position and rotation of the clientbooleanAdd directions (left/right/back/forward) to objects?booleanAdd coordinates relative to the user position?booleanAdd object rotations? -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.ai.chat.prompt.PromptTemplatesceneDescription(Client client, VRObjectRepository db) Get description of the scene to be used as (part of) the context.
-
Field Details
-
appendClientCoordinates
public boolean appendClientCoordinatesWhen using absolute world coordinates, we should add current position and rotation of the client -
appendAbsolute
public boolean appendAbsoluteAdd absolute coordinates to the context? -
appendRelative
public boolean appendRelativeAdd coordinates relative to the user position? -
appendDirection
public boolean appendDirectionAdd directions (left/right/back/forward) to objects? -
appendRotation
public boolean appendRotationAdd object rotations?
-
-
Constructor Details
-
ContextHelper
public ContextHelper()
-
-
Method Details
-
sceneDescription
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()
-