kenken999 commited on
Commit
7f5c5f5
·
1 Parent(s): a24963e
Files changed (2) hide show
  1. proxy_server.py +20 -0
  2. requirements.txt +1 -0
proxy_server.py CHANGED
@@ -7,6 +7,8 @@ import secrets, subprocess
7
  import hashlib, uuid
8
  import warnings
9
  import importlib
 
 
10
  #######################
11
  messages: list = []
12
  sys.path.insert(
@@ -2480,6 +2482,24 @@ async def config_yaml_endpoint(config_info: ConfigYAML):
2480
  """
2481
  return {"hello": "world"}
2482
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2483
 
2484
  @router.get("/test", tags=["health"])
2485
  async def test_endpoint(request: Request):
 
7
  import hashlib, uuid
8
  import warnings
9
  import importlib
10
+ from groq import Groq
11
+ import os
12
  #######################
13
  messages: list = []
14
  sys.path.insert(
 
2482
  """
2483
  return {"hello": "world"}
2484
 
2485
+ @router.get("/groq/chat", tags=["groq"])
2486
+ async def config_yaml_endpoint(config_info: ConfigYAML):
2487
+ client = Groq(
2488
+ api_key=os.environ.get("GROQ_API_KEY"),
2489
+ )
2490
+
2491
+ chat_completion = client.chat.completions.create(
2492
+ messages=[
2493
+ {
2494
+ "role": "user",
2495
+ "content": "Explain the importance of fast language models",
2496
+ }
2497
+ ],
2498
+ model="llama3-8b-8192",
2499
+ )
2500
+
2501
+ print(chat_completion.choices[0].message.content)
2502
+
2503
 
2504
  @router.get("/test", tags=["health"])
2505
  async def test_endpoint(request: Request):
requirements.txt CHANGED
@@ -25,4 +25,5 @@ click==8.1.7 # for proxy cli
25
  jinja2==3.1.2 # for prompt templates
26
  certifi>=2023.7.22 # [TODO] clean up
27
  aiohttp==3.9.0 # for network calls
 
28
  ####
 
25
  jinja2==3.1.2 # for prompt templates
26
  certifi>=2023.7.22 # [TODO] clean up
27
  aiohttp==3.9.0 # for network calls
28
+ groq
29
  ####