@servicenow/sdk - v4.7.0
    Preparing search index...

    Function NowAssistSkillConfig

    • Creates a NowAssist Skill configuration

      Takes two arguments to solve the IntelliSense ordering problem:

      • Arg 1 (definition): Skill metadata, inputs, outputs, tools, security
      • Arg 2 (promptConfig): LLM provider configurations with prompts

      TypeScript infers function arguments LEFT-TO-RIGHT, so TInputs and TTools are fully resolved from arg 1 before arg 2 needs them. This guarantees p.tool.* and p.input.* IntelliSense works regardless of property order.

      Type Parameters

      Parameters

      Returns [SkillDefinitionWithID<TInputs, TTools>, SkillPromptConfig<TInputs, TTools>]

      // Basic skill without tools
      NowAssistSkillConfig(
      {
      $id: Now.ID['my_skill'],
      name: 'Customer Support Helper',
      shortDescription: 'Helps with customer inquiries',
      description: 'AI-powered customer support assistant',
      inputs: [
      {
      name: 'customer_inquiry',
      description: 'Customer question or issue',
      mandatory: true,
      dataType: 'string'
      }
      ],
      outputs: [
      { $id: Now.ID['my_skill_response_output'], name: 'response' },
      { $id: Now.ID['my_skill_provider_output'], name: 'provider' },
      { $id: Now.ID['my_skill_errorcode_output'], name: 'errorcode' },
      { $id: Now.ID['my_skill_status_output'], name: 'status' },
      { $id: Now.ID['my_skill_error_output'], name: 'error' },
      ],
      securityControls: {
      userAccess: { type: 'authenticated' },
      roleRestrictions: ['2831a114c611228501d4ea6c309d626d']
      }
      },
      {
      providers: [
      {
      provider: 'Now LLM Service',
      prompts: [
      {
      name: 'Support Prompt',
      versions: [
      {
      version: 1,
      model: 'llm_generic_small',
      temperature: 0.3,
      prompt: 'You are a helpful customer support agent...',
      promptState: 'published'
      }
      ]
      }
      ]
      }
      ]
      }
      )

      // Skill with tools — TTools inferred from arg 1, available in arg 2 prompts
      NowAssistSkillConfig(
      {
      $id: Now.ID['incident_skill'],
      name: 'Incident Processing Skill',
      inputs: [
      { name: 'incidentNumber', dataType: 'string', mandatory: true },
      { name: 'priority', dataType: 'string', mandatory: false }
      ],
      outputs: [
      { $id: Now.ID['inc_response_output'], name: 'response' },
      { $id: Now.ID['inc_provider_output'], name: 'provider' },
      { $id: Now.ID['inc_errorcode_output'], name: 'errorcode' },
      { $id: Now.ID['inc_status_output'], name: 'status' },
      { $id: Now.ID['inc_error_output'], name: 'error' },
      ],
      tools: (t) => ({
      FetchIncident: t.Script('FetchIncident', {
      scriptId: 'script_sys_id',
      inputs: [{ name: 'num', value: t.input.incidentNumber }]
      })
      }),
      securityControls: {
      userAccess: { type: 'authenticated' },
      roleRestrictions: ['2831a114c611228501d4ea6c309d626d']
      }
      },
      {
      providers: [
      {
      provider: 'Now LLM Service',
      prompts: [
      {
      name: 'Main Prompt',
      versions: [
      {
      model: 'llm_generic_small',
      promptState: 'published',
      prompt: (p) => `
      Incident: ${p.input.incidentNumber}
      Data: ${p.tool.FetchIncident.Output}
      `
      }
      ]
      }
      ]
      }
      ]
      }
      )