chmielvu commited on
Commit
46d50df
·
verified ·
1 Parent(s): c064cac

Update huggingface_inference_node.py

Browse files
Files changed (1) hide show
  1. huggingface_inference_node.py +0 -43
huggingface_inference_node.py CHANGED
@@ -4,11 +4,9 @@ from datetime import datetime
4
 
5
  import anthropic
6
  from groq import Groq
7
- from openai import OpenAI
8
 
9
  huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
10
  groq_api_key = os.getenv("GROQ_API_KEY")
11
- sambanova_api_key = os.getenv("SAMBANOVA_API_KEY")
12
 
13
 
14
  class LLMInferenceNode:
@@ -18,9 +16,6 @@ class LLMInferenceNode:
18
  api_key=huggingface_token,
19
  )
20
  self.groq_client = Groq(api_key=groq_api_key)
21
- self.sambanova_client = OpenAI(
22
- api_key=sambanova_api_key,
23
- base_url="https://api.sambanova.ai/v1",
24
  )
25
 
26
  def generate(
@@ -108,35 +103,6 @@ You are allowed to make up film and branding names, and do them like 80's, 90's
108
  )
109
  output = response.choices[0].message.content.strip()
110
 
111
- elif provider == "OpenAI":
112
- openai_client = OpenAI(api_key=api_key)
113
- response = openai_client.chat.completions.create(
114
- model=model or "gpt-4",
115
- max_tokens=1024,
116
- temperature=0.7,
117
- messages=[
118
- {"role": "system", "content": system_message},
119
- {"role": "user", "content": user_message},
120
- ],
121
- )
122
- output = response.choices[0].message.content.strip()
123
-
124
- elif provider == "Anthropic":
125
- anthropic_client = anthropic.Anthropic(api_key=api_key)
126
- response = anthropic_client.messages.create(
127
- model=model or "claude-3-5-sonnet-20240620",
128
- max_tokens=1024,
129
- temperature=0.7,
130
- system=system_message,
131
- messages=[
132
- {
133
- "role": "user",
134
- "content": [{"type": "text", "text": user_message}],
135
- }
136
- ],
137
- )
138
- output = response.content[0].text
139
-
140
  elif provider == "Groq":
141
  response = self.groq_client.chat.completions.create(
142
  model=model or "llama-3.1-70b-versatile",
@@ -148,15 +114,6 @@ You are allowed to make up film and branding names, and do them like 80's, 90's
148
  ],
149
  )
150
  output = response.choices[0].message.content.strip()
151
-
152
- elif provider == "SambaNova":
153
- response = self.sambanova_client.chat.completions.create(
154
- model=model or "Meta-Llama-3.1-70B-Instruct",
155
- max_tokens=1024,
156
- temperature=0.7,
157
- messages=[
158
- {"role": "system", "content": system_message},
159
- {"role": "user", "content": user_message},
160
  ],
161
  )
162
  output = response.choices[0].message.content.strip()
 
4
 
5
  import anthropic
6
  from groq import Groq
 
7
 
8
  huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
9
  groq_api_key = os.getenv("GROQ_API_KEY")
 
10
 
11
 
12
  class LLMInferenceNode:
 
16
  api_key=huggingface_token,
17
  )
18
  self.groq_client = Groq(api_key=groq_api_key)
 
 
 
19
  )
20
 
21
  def generate(
 
103
  )
104
  output = response.choices[0].message.content.strip()
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  elif provider == "Groq":
107
  response = self.groq_client.chat.completions.create(
108
  model=model or "llama-3.1-70b-versatile",
 
114
  ],
115
  )
116
  output = response.choices[0].message.content.strip()
 
 
 
 
 
 
 
 
 
117
  ],
118
  )
119
  output = response.choices[0].message.content.strip()