Spaces:
Paused

MEOW commited on
Commit
1a973f6
·
unverified ·
1 Parent(s): 8581b8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -11,7 +11,7 @@ logging.basicConfig(level=logging.INFO)
11
  logger = logging.getLogger(__name__)
12
 
13
  # Assuming xAI provides their endpoint for generating text
14
- XAI_API_URL = "https://api.x.ai/v1/chat/completions" # Replace with actual endpoint
15
 
16
  # Custom LLM class for xAI
17
  class XAILLM:
@@ -25,7 +25,7 @@ class XAILLM:
25
  data = {
26
  "model": "grok-beta", # Adjust model name as per xAI's API
27
  "messages": [{"role": "user", "content": prompt}],
28
- "stream": False # or True if you want streaming responses
29
  }
30
  response = requests.post(XAI_API_URL, headers=headers, json=data)
31
  response.raise_for_status()
@@ -37,7 +37,7 @@ Settings.llm = XAILLM()
37
  class XAIEmbedding:
38
  def __init__(self):
39
  self.api_key = os.getenv('XAI_API_KEY')
40
- self.model_id = "v1" # Replace with the correct model ID
41
 
42
  def get_text_embedding(self, text):
43
  headers = {
 
11
  logger = logging.getLogger(__name__)
12
 
13
  # Assuming xAI provides their endpoint for generating text
14
+ XAI_API_URL = "https://api.x.ai/v1/chat/completions"
15
 
16
  # Custom LLM class for xAI
17
  class XAILLM:
 
25
  data = {
26
  "model": "grok-beta", # Adjust model name as per xAI's API
27
  "messages": [{"role": "user", "content": prompt}],
28
+ "stream": True # or True if you want streaming responses
29
  }
30
  response = requests.post(XAI_API_URL, headers=headers, json=data)
31
  response.raise_for_status()
 
37
  class XAIEmbedding:
38
  def __init__(self):
39
  self.api_key = os.getenv('XAI_API_KEY')
40
+ self.model_id = "v1"
41
 
42
  def get_text_embedding(self, text):
43
  headers = {