Umbraco.AI Getting the current content item Key in a custom tool

Haha, I’ve just realized why this isn’t working for you. It looks like we aren’t writing the content key to the system prompt.

Essentially when an entity is passed as context, we extract info an inject it into the system prompt as context and I’ve just checked the log and can see we don’t actually write the key :man_facepalming:

We do write the name though and that’ll be why you reliably get it. I’ll add a fix to this to write the content key to the system prompt to as it seems kinda important :joy:

By the way, if you add the following to appsettings, it’ll log the prompts to the log

{
  "Umbraco": {
    "AuditLog": {
      "Enabled": true,
      "DetailLevel": "Full",
      "PersistPrompts": true,
      "PersistResponses": true
    }
  },
}

NB In the next release, these will all be on by default and you’ll just need the app settings to disable them.

UPDATE: I’ve submitted the fix here for the next release fix(core): Actually write the entity key to the system prompt as context · umbraco/Umbraco.AI@fb5cefd · GitHub

1 Like