artificialguybr commited on
Commit
ae1288e
1 Parent(s): 359b1cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -13,11 +13,10 @@ def generate_knowledge_graph(api_key, user_input):
13
  completion = openai.ChatCompletion.create(
14
  model="gpt-3.5-turbo-16k",
15
  messages=[
16
- {"role": "system", "content": "You are a helpful assistant."},
17
  {
18
  "role": "user",
19
  "content": f"Help me understand following by describing as a detailed knowledge graph: {user_input}",
20
- },
21
  ],
22
  functions=[
23
  {
@@ -83,9 +82,11 @@ def generate_knowledge_graph(api_key, user_input):
83
  "required": ["nodes", "edges"],
84
  },
85
  }
86
- ]
 
87
  )
88
- response_data = completion.choices[0]["message"]["function_results"]["knowledge_graph"]
 
89
  print(response_data)
90
 
91
  # Visualizar o conhecimento usando Graphviz
 
13
  completion = openai.ChatCompletion.create(
14
  model="gpt-3.5-turbo-16k",
15
  messages=[
 
16
  {
17
  "role": "user",
18
  "content": f"Help me understand following by describing as a detailed knowledge graph: {user_input}",
19
+ }
20
  ],
21
  functions=[
22
  {
 
82
  "required": ["nodes", "edges"],
83
  },
84
  }
85
+ ],
86
+ function_call={"name": "knowledge_graph"},
87
  )
88
+
89
+ response_data = completion.choices[0]["message"]["function_call"]["arguments"]
90
  print(response_data)
91
 
92
  # Visualizar o conhecimento usando Graphviz