Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This image shows
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
exportedRestServices:
- endpoint: "https://www.opportunitysummary.com"
description: "REST Service to return company details from the CRM"
name: "Tutorial_OpportunityDetails"
authType: "noAuth"
restServiceMethods:
- restServiceMethodType: "GET"
contentType: "application/json"
statusCode: 200
methodIncrementId: 0
mockResponsePayload: "{\n \"opportunity_id\": \"SO-12345\",\n \"company_name\"\
: \"Elemental Design\",\n \"contact_person\": {\n \"name\": \"Connor\
\ Adams\",\n \"title\": \"Director, IT\",\n \"email\": \"elemental.design@averydennison.com\"\
,\n \"phone\": \"+1(555)123-4567\"\n },\n \"company_description\"\
: \"Elemental Design operates in the sports equipment and apparel industry,\
\ focusing on the manufacturing and retail of sports equipment, footwear, and\
\ apparel.The company's mission is to empower athletes and sports enthusiasts\
\ with high-quality products that enhance performance and comfort.Elemental\
\ Design envisions becoming a global leader in sports equipment and apparel,\
\ promoting a healthy and active lifestyle for all. The company currently employs\
\ 250 dedicated professionals.\",\n \"products\": [\n {\n \
\ \"product_id\": \"SP-98765\",\n \"product_name\": \"High-Performance\
\ Running Shoes\",\n \"category\": \"Footwear\",\n \"\
price\": 120,\n \"currency\": \"USD\",\n \"quantity\"\
: 500,\n \"revenue\": 65000\n },\n {\n \"\
product_id\": \"SP-98766\",\n \"product_name\": \"Breathable Sports\
\ T-Shirt\",\n \"category\": \"Apparel\",\n \"price\"\
: 35,\n \"currency\": \"USD\",\n \"quantity\": 1000,\n\
\ \"revenue\": 35000\n },\n {\n \"product_id\"\
: \"SP-98767\",\n \"product_name\": \"Quick-Dry Athletic Shorts\"\
,\n \"category\": \"Apparel\",\n \"price\": 45,\n \
\ \"currency\": \"USD\",\n \"quantity\": 800,\n \
\ \"revenue\": 36000\n }\n ],\n \"deal_value\": 60000,\n \"\
sales_stage\": \"Proposal/Price Quote\",\n \"win_probability\": 0.75,\n \
\ \"close_date\": \"2023-08-15\",\n \"competitors\": [\n {\n \
\ \"name\": \"AthleticGear Co.\",\n \"product\": \"AG-Runner\
\ Pro\",\n \"price\": 110,\n \"strengths\": [\n \
\ \"Lower price\",\n \"Established brand\"\n \
\ ],\n \"weaknesses\": [\n \"Lower quality materials\"\
,\n \"Less comfortable\"\n ]\n },\n \
\ {\n \"name\": \"FitLife Inc.\",\n \"product\": \"FL-Speedster\"\
,\n \"price\": 130,\n \"strengths\": [\n \
\ \"High-quality materials\",\n \"Advanced cushioning technology\"\
\n ],\n \"weaknesses\": [\n \"Higher price\"\
,\n \"Lesser-known brand\"\n ]\n }\n ],\n\
\ \"next_steps\": [\n {\n \"activity\": \"Send product\
\ samples\",\n \"due_date\": \"2023-06-10\",\n \"owner\"\
: \"Jane Doe\"\n },\n {\n \"activity\": \"Schedule\
\ product demo\",\n \"due_date\": \"2023-06-15\",\n \"\
owner\": \"Jane Doe\"\n },\n {\n \"activity\": \"Meeting\
\ to negotiate pricing and terms\",\n \"due_date\": \"2023-06-25\"\
,\n \"owner\": \"Jane Doe\"\n }\n ],\n \"key_activities\"\
: [\n {\n \"activity\": \"Initial contact\",\n \
\ \"date\": \"2023-05-10\",\n \"outcome\": \"Positive response, interest\
\ in product\"\n },\n {\n \"activity\": \"Product presentation\"\
,\n \"date\": \"2023-05-15\",\n \"outcome\": \"Good feedback,\
\ requested samples and demo\"\n }\n ],\n \"customer_needs\": [\n\
\ \"High-quality materials for durability and performance\",\n \
\ \"Competitive pricing to fit within budget\",\n \"Responsive customer\
\ support and after-sales service\",\n \"Customizable design options\
\ for team branding\"\n ]\n}"
restServiceParams:
- type: "query"
key: "company"
value: "ElementalDesign"
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This image highlights the Add Public Key button in the web console
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Prompt Parameters section of the Component page. There are two fields, Name and Value. The Save and Cancel icons are at the bottom right of the dialog.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Add State dialog. This dialog has two panels -- templates on the left and the details for the selected item on the right. In this image, Invoke Large Language Model is selected on the left and the detail, which includes a rendering of the invokLLM and showLLMError states, also has a Name field (populated with GenerateEmail) and a Description field.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Add State dialog with the Invoke Large Language Model template selected.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Add State dialog with the Service Integration template selected.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a partial view of Component page of the GenerateEmail state. In this image the Build Prompt button, which is located in between the LLM Service and Prompt fields (also shown) is highlighted.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The completed dialog flow. From left to right, the flow has the following states: GetEmailDetail, GetCompanyDetails, GenerateEmail and showLLMError.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a image of the Skill Tester showing a conversation between the user and LLM.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A view of the Conversation pane of the Bot Tester. In the rendered traversal, the GenerateEmail state is at the end.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is view of the Skill Tester. In this image, the response from the LLM has been refined, which results in an Undo button getting rendered under the response.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This image shows the Create Virtual Cloud Network button in the web console of Oracle Cloud Infrastructure
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This image shows the Create Virtual Cloud Network dialog box in the web console of Oracle Cloud Infrastructure
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Create REST Service dialog. From top to bottom, this dialog has the following fields: Name, Endpoint, Description, Methods. The Create button is at the bottom right of the dialog.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Create Service dialog. From top to bottom, this dialog has the following fields: Name, Description, Service Type (with the following options: Embedded container, which is emphasized here, Oracle Mobile Cloud, Oracle Function), Upload Package and New Component radio buttons (the latter selected in this image), Component Name, Enable Component Logging (a toggle switch). The Create button is at the bottom right.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Create Skill dialog. From top to bottom, this dialog has the following fields: Display Name, Name, Skill Version, Platform Version, Display Mode (Yaml and Visual radio buttons with the latter selected in this image), Language, and One-Sentence Description. The Create button is at the bottom right.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Prompt Parameters section of the Prompt Builder. This dialog have Name and Mock Value fields.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Component page of the InvokeLLM Sevrvice property dialog. In this image, the following UI elements are show. From top to bottom: LLM Service (a dropdown menu), Prompt (an input field), Test Prompt button.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the flow traversal in the Conversation tester. This flow, which branches off from the main flow, has the following states: GenerateEmail, GetCompanyDetails, GenerateEmail, and showLLMError.
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
'use strict';

// Documentation for writing REST Service query event handlers: https://github.com/oracle/bots-node-sdk/blob/master/REST_SERVICE_EVENT_HANDLER.md

// You can use your favorite http client package to make REST calls, however, the node fetch API is pre-installed with the bots-node-sdk.
// Documentation can be found at https://www.npmjs.com/package/node-fetch
// Un-comment the next line if you want to make REST calls using node-fetch.
// const fetch = require("node-fetch");

module.exports = {
metadata: {
name: 'Cohere_Command',
eventHandlerType: 'RestService'
},
handlers: {

/**
* Handler to transform the request payload
* @param {TransformPayloadEvent} event
* @param {RestServiceContext} context
* @returns {object} the transformed request payload
*/
transformRequestPayload: async (event, context) => {
let messages = event.payload.messages;
let contentString = '';

if (messages.length > 1) {

const message = messages[messages.length - 2];
contentString += `Previous message : ${message.content}\n`;

const refinement = messages[messages.length - 1];
contentString += `${refinement.content}`;

} else if (messages.length === 1) {
const message = messages[0];
contentString = message.content;
}

let payload = {
"model_name": "command",
"input": contentString,
"config": {
"max_tokens": 512,
"presence_penalty": 0.01,
"temperature": 0.01,
"top_p": 0.95,
"top_k": 50
}
};



return payload;
},

/**
* Handler to transform the response payload
* @param {TransformPayloadEvent} event
* @param {RestServiceContext} context
* @returns {object} the transformed response payload
*/
transformResponsePayload: async (event, context) => {
let llmPayload = {};

// 'error' field here is a stringified json object.
// TODO: Decode it to extract more details.
if (event.payload.error) {
llmPayload.errorCode = 'unknown';
llmPayload.errorMessage = event.payload.error;
return llmPayload;
}

// non-streaming case
llmPayload.candidates = [];
const content = event.payload.output ? event.payload.output : "";
llmPayload.candidates.push({
content: content
});


return llmPayload;
},

/**
* Handler to transform the error response payload, invoked when HTTP status code is 400 or higher and the error
* response body received is a JSON object
* @param {TransformPayloadEvent} event
* @param {RestServiceContext} context
* @returns {object} the transformed error response payload
*/
transformErrorResponsePayload: async (event, context) => {
let errorCode = 'unknown';
if (event.payload.error) {
if ( 'context_length_exceeded' === event.payload.error.code) {
errorCode = 'modelLengthExceeded';
} else if ('content_filter' === event.payload.error.code) {
errorCode = 'flagged';
}
return {"errorCode" : errorCode, "errorMessage": event.payload.error.message};
} else {
return {"errorCode" : errorCode, "errorMessage": JSON.stringify(event.payload)};
}
}

}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This image shows
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This image shows the fingerprint generated for a public key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Thsi image shows the Generate Token button in the web console of Oracle Cloud Infrastructure
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Edit Component Code editor. This editor has starter code and at the top right, the buttons Validate, Save, and Close.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the API Service page. In this image, the imported mock REST service, Tutorial_OpportunityDetails, is selected in the left menu.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the visual dialog flow. The sequence of the state pictured in this flow are, from left to right, unresolvedMessage (start state), invokeLLM, and showLLMError. A next transition connects unresolvedMessage to invokeLLM. An error transition connections invokeLLM to showLLMError.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Large Language Model Services section of the Settings page. From top to bottom: the +New LLM Service button, placeholders for Name, REST service, and RESt Service Handler. No service has been added, so the message "No LLM services are configured" appears.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the left menu. This menu is divided into the following sections, which include Home and Development, which is expanded in this image. The Development section's Skills option is selected.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of a portion of the Component page for the invokeLLM template properties inspector. In this image, the LLM Sevice dropdown is expanded to reveal the Default Value item and an item for a configured LLM service.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Large Language Model Services section of Settings. This image shows a completed service: the Name, REST Service, and REST Event Handler fields all have values.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the LLM Call tab in the Skill Tester. This view has a table that describes the processing. It has fields called Turn, Request, Execution Time(s), Provider Request and Provider Response. In this view, a refinement request has been processed. This results in a second entry added to this table.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Bot Tester with the LLM Calls view open. In this image, the conversation has terminated because the LLM could not process the request. In the Bot Tester view, the final message in the conversation is from the skill. It begins with "An unexpected error occurred while invoking the Large Language Model..."
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Prompt Builder. The Prompt Builder is divided into two panes. The Prompt field for inputting the text, the Generate Output button, and the LLM Output field (located below it ) occupy the right pane. The left pane has the following fields: LLM Service, Temperature, Max Tokens, Prompt Parameters, the Generate Mock Values button, and at the bottom right, the Save Settings button.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the right panel of the LLM Prompt Tester. This section of the dialog has the following fields and elements. From left to right: LLM Service, Temperature, Max Tokens, Generate Output (a button). Directly below is the LLM Output field.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TThis is an image of the right panel of the LLM Prompt Tester. This section of the dialog has the following fields and elements. From left to right: LLM Service, Temperature, Max Tokens, Generate Output (a button). Directly below is the LLM Output field.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Test Prompt field in the Prompt Tester.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the right panel of the LLM Prompt Tester. This section of the dialog has the following fields and elements. From left to right: LLM Service, Temperature, Max Tokens, Generate Output (a button). Directly below is the LLM Output field.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
You are a professional email writer. Draft an email to the ${OPPORTUNITY} sales team for the following purpose: ${TOPIC} considering the following details about the opportunity:

Opportunity details:

${OPPORTUNITY_DETAILS}

Email Signature:

${EMAIL_SIGNATURE}

- Your email should be concise, and friendly yet remains professional.
- Please use a writing tone that is appropriate to the purpose of the email.
- Ensure to make it obvious when the opportunity is to close.
- Optionally include the things that are important to the customer when making their buying decisions
- If the purpose of the email is negative; for example to communicate miss or loss, do the following: { Step 1: please be very brief. Step 2: please and do not mention activities }
- If the purpose of the email is positive or neutral; for example to congratulate or follow-up on progress, do the following: { Step 1: the products section is the main team objective to achieve, please mention it with enthusiasm in your opening paragraph. Step 2: please motivate the team to finalize the pending activities. }
- Remove signature block
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Prompt Builder. In this image, the generate email prompt has been entered in the Prompt field. Beneath the field, a list enumerates errors for prompt parameters that are declared in the prompt, but have not been defined with mock values.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an image of the Response Validation section of the invokeLLM component editor. From top to bottom, this section has the following fields and options: Validation Entities, Enforce JSON-formatted Response, Number of Retries, Retry Message, Validation and Customization Handler.
Loading