-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLLM_API.py
More file actions
31 lines (21 loc) · 742 Bytes
/
LLM_API.py
File metadata and controls
31 lines (21 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import unicodedata
from openai import OpenAI
client = OpenAI(
api_key="sk-8OQ6Ea0pzN4b6fAxvu26WNBgu4nquIhsVf4uWFZPgi7Uw9n7",
base_url="http://35.164.11.19:3887/v1"
)
def callOpenAI(prompt: str) -> str:
completion = client.chat.completions.create(
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": prompt}
],
model="gpt-5.1",
#model= "gpt-4o-2024-08-06",
#model="gpt-4-1106-preview",
#model="gpt-4-0314",
)
message = completion.choices[0].message
content = unicodedata.normalize('NFKC', message.content)
return content
#print(callOpenAI("hello, you are a helpful hardware fuzzing tester."))