You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-services/openai/includes/use-your-data-javascript.md
+25-53Lines changed: 25 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: glharper
5
5
ms.author: glharper
6
6
ms.service: azure-ai-openai
7
7
ms.topic: include
8
-
ms.date: 09/06/2023
8
+
ms.date: 03/04/2024
9
9
---
10
10
11
11
[!INCLUDE [Set up required variables](./use-your-data-common-variables.md)]
@@ -33,9 +33,10 @@ Your app's _package.json_ file will be updated with the dependencies.
33
33
34
34
Open a command prompt where you want the new project, and create a new file named ChatWithOwnData.js. Copy the following code into the ChatWithOwnData.js file.
console.log("Context information (e.g. citations) from chat extensions:");
85
-
console.log("===");
86
-
for (constmessageof contextMessages) {
87
-
// Display context included with chat responses (such as citations)
88
-
console.log(message.content);
89
-
}
90
-
}
75
+
constnewText=choice.delta?.content;
76
+
if (!!newText) {
77
+
response += newText;
78
+
// To see streaming results as they arrive, uncomment line below
79
+
// console.log(newText);
91
80
}
92
81
}
93
82
}
83
+
console.log(response);
94
84
}
95
85
96
86
main().catch((err) => {
97
87
console.error("The sample encountered an error:", err);
98
88
});
99
89
90
+
91
+
100
92
module.exports= { main };
101
93
```
102
94
@@ -110,28 +102,8 @@ node.exe ChatWithOwnData.js
110
102
## Output
111
103
112
104
```output
113
-
== Chat With Your Own Data Sample ==
114
-
assistant: Azure Machine Learning is a cloud-based service that provides tools and services to build, train, and deploy machine learning models. It offers a collaborative environment for data scientists, developers, and domain experts to work together on machine learning projects. Azure Machine Learning supports various programming languages, frameworks, and libraries, including Python, R, TensorFlow, and PyTorch [^1^].
115
-
===
116
-
Context information (e.g. citations) from chat extensions:
117
-
===
118
-
tool: {
119
-
'citations': [
120
-
{
121
-
'content':'...',
122
-
'id':null,
123
-
'title':'...',
124
-
'filepath':'...',
125
-
'url':'...',
126
-
'metadata': {
127
-
"chunking': 'orignal document size=1011. Scores=3.6390076 and None.Org Highlight count=38.'
128
-
},
129
-
'chunk_id': '2'
130
-
},
131
-
...
132
-
],
133
-
'intent': '[\u0022What are the differences between Azure Machine Learning and Azure AI services?\u0022]'
134
-
}
105
+
Message: What are the differences between Azure Machine Learning and Azure AI services?
106
+
Based on the retrieved document, an interesting fact is...
0 commit comments