@@ -3,26 +3,6 @@ import "./../../components/monaco-editor/monaco-editor.js";
33import "./../../components/dynamic-columns/dynamic-columns.js" ;
44import "./../../components/dynamic-rows/dynamic-rows.js" ;
55
6- const tools = [
7- {
8- "type" : "function" ,
9- "function" : {
10- "name" : "age" ,
11- "description" : "Return the age of a person" ,
12- "parameters" : {
13- "type" : "object" ,
14- "properties" : {
15- "personAge" : {
16- "type" : "integer" ,
17- "description" : "The age of the person"
18- }
19- } ,
20- "required" : [ "personAge" ]
21- }
22- }
23- }
24- ] ;
25-
266export default class OllamaToolsView extends HTMLElement {
277 static tag = "ollama-tools-view" ;
288
@@ -59,6 +39,8 @@ export default class OllamaToolsView extends HTMLElement {
5939 text : "Do you know how old the person is?"
6040 } ) ;
6141
42+ const tools = JSON . parse ( this . shadowRoot . querySelector ( "#tools" ) . value ) ;
43+
6244 const callResult = await OllamaModule . chat ( {
6345 "model" : "llama3.2" ,
6446 "tools" : tools ,
@@ -75,8 +57,6 @@ export default class OllamaToolsView extends HTMLElement {
7557 const functionName = functionDefinition . function . name ;
7658 const functionArgs = functionDefinition . function . arguments ;
7759
78- console . log ( functionName , functionArgs ) ;
79-
8060 const functionCallMessage = await OllamaModule . create_message ( {
8161 role : ChatRoles . TOOL ,
8262 text : `22`
@@ -95,7 +75,7 @@ export default class OllamaToolsView extends HTMLElement {
9575 result . push ( data ) ;
9676 }
9777
98- this . shadowRoot . querySelector ( ".container " ) . textContent = JSON . parse ( result [ 0 ] ) . message . content ;
78+ this . shadowRoot . querySelector ( "text-area " ) . textContent = JSON . parse ( result [ 0 ] ) . message . content ;
9979 }
10080}
10181
0 commit comments