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
'Olet ohjelmistotuotanto kurssin avustaja. Jos käyttäjä kysyy jotain, niin arvioi ensin liittyykö se ohjelmistotuotannon kurssiin. Jos liittyy, niin toteuta file_search. jos et löydä sopivia tiedostoja, niin sano että haulla ei löytynyt mitään. Jos käyttäjän viesti ei liittynyt ohjelmistotuotannon kurssiin, niin kysy ystävällisesti voitko auttaa jotenkin muuten kurssimateriaalien suhteen.'
54
+
this.tools=[
55
+
// ohtuRAGTest.definition,
56
+
fileSearchTest.definition,
57
+
]
50
58
}
51
59
52
60
asynccreateResponse({
@@ -57,10 +65,12 @@ export class ResponsesClient {
57
65
try{
58
66
returnawaitclient.responses.create({
59
67
model: this.model,
68
+
// previous_response_id=response.id // THIS MIGHT BE IT!!!!!!1
60
69
instructions: this.instructions,
61
70
input,
62
71
stream: true,
63
72
tools: this.tools,
73
+
tool_choice: 'auto',
64
74
})
65
75
}catch(error: any){
66
76
logger.error(error)
@@ -75,7 +85,7 @@ export class ResponsesClient {
75
85
encoding,
76
86
res,
77
87
}: {
78
-
events: Stream<any>
88
+
events: Stream<ResponseStreamEvent>
79
89
prevMessages: ResponseInput
80
90
encoding: Tiktoken
81
91
res: Response
@@ -94,27 +104,20 @@ export class ResponsesClient {
'Test tool for knowledge retrieval. Always call this when user says TEST-RAG',
15
+
parameters: {
16
+
type: 'object',
17
+
properties: {
18
+
query: {
19
+
type: 'string',
20
+
description: 'Users query for knowledge retrieval',
21
+
},
22
+
},
23
+
required: ['query'],
24
+
additionalProperties: false,
25
+
},
26
+
strict: true,// or true, depending on your requirements
27
+
},
28
+
function: async(
29
+
client: AzureOpenAI,
30
+
query: string
31
+
): Promise<{query: string;result: string}>=>{
32
+
// Simulate a tool function that returns a simple message
33
+
return{
34
+
query,
35
+
result:
36
+
'This is a test result from the test tool. The secret is: Chili kastike',
37
+
}
38
+
},
39
+
}
40
+
41
+
exportconstohtuRAGTest: functionCallObject={
42
+
// FUNCITON TOOL CALL FOR VECTOR DB /search ENDPOINT IS NOT CURRENTLY SUPPORTED BY OPENAI
43
+
definition: {
44
+
type: 'function',
45
+
name: 'ohtu_retrieval',
46
+
description:
47
+
'Helsingin yliopiston ohjelmistotuotannon kurssimateriaalin haku funktio. Kutsu tätä kun käyttäjä haluaa tietoa kurssiin liittyen. Muuten älä kutsu tätä.',
48
+
parameters: {
49
+
type: 'object',
50
+
properties: {
51
+
query: {
52
+
type: 'string',
53
+
description: 'Käyttäjän kysymys kurssimateriaalista',
54
+
},
55
+
},
56
+
required: ['query'],
57
+
additionalProperties: false,
58
+
},
59
+
strict: true,// or true, depending on your requirements
0 commit comments