Skip to content

Instantly share code, notes, and snippets.

@Konard
Last active March 19, 2023 14:45
Show Gist options
  • Save Konard/6241b32b37c8af19d3826339a5665608 to your computer and use it in GitHub Desktop.
Save Konard/6241b32b37c8af19d3826339a5665608 to your computer and use it in GitHub Desktop.
A way to ask GPT-4 to use Deep from https://deep.foundation

2032AC89-4B5E-4EA9-A27B-BAE1D5C8F489 https://youtu.be/saGuuxJMlaI?t=2806

Human:

    const userId = 362;

    // Create a node-link type with name Example1.
    await deep.insert({
      type_id: await deep.id('@deep-foundation/core', 'Type'),
      in: {
        data: {
          from_id: userId,
          type_id: await deep.id('@deep-foundation/core', 'Contain'),
          string: { data: { value: 'Example1' } },
        }
      },
    });

    // Create a node-link type with name Example2.
    // It has attached value of String type.
    await deep.insert({
      type_id: await deep.id('@deep-foundation/core', 'Type'),
      in: {
        data: {
          from_id: userId,
          type_id: await deep.id('@deep-foundation/core', 'Contain'),
          string: { data: { value: 'Example2' } },
        }
      },
      out: {
        data: {
          type_id: await deep.id('@deep-foundation/core', 'Value'),
          to_id: await deep.id('@deep-foundation/core', 'String'),
        }
      }
    });

    // Create a node-link type with name Human.
    // It has attached properties such as age (Number type), gender (String type), and name (String type).
    await deep.insert({
      type_id: await deep.id('@deep-foundation/core', 'Type'),
      in: {
        data: [
          {
            from_id: userId,
            type_id: await deep.id('@deep-foundation/core', 'Contain'),
            string: { data: { value: 'Human' } },
          },
          {
            from_id: await deep.id('@deep-foundation/core', 'Any'),
            type_id: await deep.id('@deep-foundation/core', 'Type'),
            in: {
              data: {
                from_id: userId,
                type_id: await deep.id('@deep-foundation/core', 'Contain'),
                string: { data: { value: 'Age' } },
              }
            },
            out: {
              data: {
                type_id: await deep.id('@deep-foundation/core', 'Value'),
                to_id: await deep.id('@deep-foundation/core', 'Number'),
              }
            }
          },
          {
            from_id: await deep.id('@deep-foundation/core', 'Any'),
            type_id: await deep.id('@deep-foundation/core', 'Type'),
            in: {
              data: {
                from_id: userId,
                type_id: await deep.id('@deep-foundation/core', 'Contain'),
                string: { data: { value: 'Name' } },
              }
            },
            out: {
              data: {
                type_id: await deep.id('@deep-foundation/core', 'Value'),
                to_id: await deep.id('@deep-foundation/core', 'String'),
              }
            }
          },
          {
            from_id: await deep.id('@deep-foundation/core', 'Any'),
            type_id: await deep.id('@deep-foundation/core', 'Type'),
            in: {
              data: {
                from_id: userId,
                type_id: await deep.id('@deep-foundation/core', 'Contain'),
                string: { data: { value: 'Gender' } },
              }
            },
            out: {
              data: {
                type_id: await deep.id('@deep-foundation/core', 'Value'),
                to_id: await deep.id('@deep-foundation/core', 'String'),
              }
            }
          },
        ]
      }
    });

Write the code using this example for the following command description:

Create Vehicle type.


AI:

    // Create a node-link type with name Vehicle.
    await deep.insert({
      type_id: await deep.id('@deep-foundation/core', 'Type'),
      in: {
        data: {
          from_id: userId,
          type_id: await deep.id('@deep-foundation/core', 'Contain'),
          string: { data: { value: 'Vehicle' } },
        }
      },
    });

Result:

Screenshot_20230319_004907


Human:

Create a Vehicle type.

It has a NumberOfWheels property.


AI:

    // Create a node-link type with name Vehicle.
    // It has attached properties such as NumberOfWheels (Number type).
    await deep.insert({
      type_id: await deep.id('@deep-foundation/core', 'Type'),
      in: {
        data: [
          {
            from_id: userId,
            type_id: await deep.id('@deep-foundation/core', 'Contain'),
            string: { data: { value: 'Vehicle' } },
          },
          {
            from_id: await deep.id('@deep-foundation/core', 'Any'),
            type_id: await deep.id('@deep-foundation/core', 'Type'),
            in: {
              data: {
                from_id: userId,
                type_id: await deep.id('@deep-foundation/core', 'Contain'),
                string: { data: { value: 'NumberOfWheels' } },
              }
            },
            out: {
              data: {
                type_id: await deep.id('@deep-foundation/core', 'Value'),
                to_id: await deep.id('@deep-foundation/core', 'Number'),
              }
            }
          },
        ]
      }
    });

Result:

Screenshot_20230319_005751


THE END OF CONVERSATION WITH GPT-4


P.S.

It is actually a good practice to contain Value links too (especially in deep packages), be careful to use this code in production environment, for example:

    // Create a node-link type with name Example.
    // It has attached value of String type.
    await deep.insert({
      type_id: await deep.id('@deep-foundation/core', 'Type'),
      in: {
        data: {
          from_id: packageId,
          type_id: await deep.id('@deep-foundation/core', 'Contain'),
          string: { data: { value: 'Example' } },
        }
      },
      out: {
        data: {
          type_id: await deep.id('@deep-foundation/core', 'Value'),
          to_id: await deep.id('@deep-foundation/core', 'String'),
          in: {
            data: {
              from_id: packageId,
              type_id: await deep.id('@deep-foundation/core', 'Contain'),
              string: { data: { value: 'exampleValue' } },
            }
          }
        }
      }
    });

Join the Deep on Discord: https://discord.gg/xcTVRAgH9t (All your questions will be answered)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment