For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create connections and label space

Set positive or negative relationships between people, teams, and spaces, and tag spaces with labels to guide AI allocation decisions.

Prerequisites

  • Completed Setup Your Development Environment and Send Your First API Request

  • Node.js v18+ and npm v9+

  • A valid gospace API key in your .env file

  • Known IDs (or external IDs) for the entities you want to relate

Allowed connection entity types: TEAM, PERSON, LABEL, SPACE, ROOM, ZONE. Strength is an integer (e.g., -100 → 100). Negative is an avoid signal; positive is a prefer signal.


1) Create connections (positive & negative)

Create create-connections.ts:

import "dotenv/config";
import GospaceAI from "@gospace-ai/api";

async function main() {
  const gospace = new GospaceAI(process.env.GOSPACE_API_KEY!);

  const res = await gospace.connections.createConnections({
    connections: [
      // Positive: person prefers to sit near a team
      {
        strength: 75,
        connection_from_entity: {
          connection_entity_id: "person_123",
          connection_entity_type: "PERSON",
          connection_entity_data: {
            first_name: "Alice",
            last_name: "Smith",
            email: "alice@example.com",
            person_id: "person_123",
            external_id: "ext-alice",
          },
        },
        connection_to_entity: {
          connection_entity_id: "team_456",
          connection_entity_type: "TEAM",
          connection_entity_data: {
            team_name: "Engineering",
            team_id: "team_456",
            external_id: "ext-team-eng",
          },
        },
      },

      // Negative: team should avoid a particular room
      {
        strength: -50,
        connection_from_entity: {
          connection_entity_id: "team_456",
          connection_entity_type: "TEAM",
          connection_entity_data: {
            team_name: "Engineering",
            team_id: "team_456",
          },
        },
        connection_to_entity: {
          connection_entity_id: "room_789",
          connection_entity_type: "ROOM",
          connection_entity_data: {
            room_name: "Conference Room A",
            room_id: "room_789",
          },
        },
      },
    ],
  });

  console.log(JSON.stringify(res.data.connections, null, 2));
}

main().catch((err) => {
  console.error("Create connections failed:", err);
  process.exit(1);
});

2) Query connections (by entity, type, or external_id)

Create get-connections.ts:


3) Update connection strength / endpoints

Create update-connections.ts:


4) Delete connections

Create delete-connections.ts:


5) Create labels (for tagging entities)

Create create-labels.ts:


6) Label space (map a label to SPACE/ROOM/ZONE/TEAM/PERSON)

Create map-labels.ts:


7) Query & manage label mappings

Get mappings (filter by label, entity, type, or external_id):

Update mappings:

Delete mappings:


Tips & patterns

  • Model behaviour:

    • Positive connections (> 0) indicate affinity or proximity preference.

    • Negative connections (< 0) indicate separation or avoidance.

  • Granularity:

    • Use people ↔ team for day‑to‑day seating preferences.

    • Use team ↔ room/zone/space for capacity and neighborhood tuning.

    • Use labels to tag assets (e.g., “Quiet”, “Client‑facing”, “Accessible”).

  • Searchability:

    • Use external_id on people/teams, then query getConnections with external_id to keep your system in sync.

  • Governance:

    • Keep connection strengths within a standard range (e.g., -100, -50, -25, 25, 50, 100) so they’re interpretable.

    • Periodically audit old connections and label mappings to avoid stale constraints.

Last updated