Spaces:
Runtime error
Runtime error
File size: 4,943 Bytes
ba2d62c 25c70ea bce5f94 ba2d62c aa09238 bce5f94 aa09238 bce5f94 aa09238 ba2d62c 1cccc5d dd77059 | 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | import os
from qdrant_client import QdrantClient
# from cerebras.cloud.sdk import Cerebras
qdrant_client = QdrantClient(
url=os.environ.get('QDRANT_URL'),
api_key=os.environ.get('QDRANT_API_KEY'),
)
print(qdrant_client.get_collections())
# client = Cerebras(
# # This is the default and can be omitted
# api_key=os.environ.get("CEREBRAS_API_KEY")
# )
# stream = client.chat.completions.create(
# messages=[
# {
# "role": "system",
# "content": ""
# }
# ],
# model="gpt-oss-120b",
# stream=True,
# max_completion_tokens=65536,
# temperature=1,
# top_p=1
# )
print()
print(os.environ.get('HF_API_KEY'))
print(os.environ.get('TOGETHER_API_KEY'))
print(os.environ.get('QDRANT_URL'))
print(os.environ.get('QDRANT_API_KEY'))
print(os.environ.get('CEREBRAS_API_KEY'))
"""
Debugging FastAPI:
uvicorn app.py:app --reload
MacOS:
export TOGETHER_API_KEY="YOUR_API_KEY"
Windows:
$env:CEREBRAS_API_KEY = "your_key"
$env:QDRANT_URL = "your_url"
$env:QDRANT_API_KEY = "your_key"
"""
"""Token Count Test
INPUT_token_count:10616
OUTPUT_token_count:4808
AVG_INPUT_token_count:1061.6
AVG_OUTPUT_token_count:480.8
TOTAL_TOKEN_COUNT:[1717 1743 1417 1419 1483 1630 1516 1619 1580 1300]
TOKEN_COUNT_PER_GENERATION - :[15424.]
AVG_TOKEN_COUNT_PER_GENERATION:[np.float64(15424.0), 1]
INPUT_token_count:10299.0
OUTPUT_token_count:5628.0
AVG_INPUT_token_count:1029.9
AVG_OUTPUT_token_count:562.8
TOTAL_TOKEN_COUNT:[1852. 1520. 1615. 1790. 1539. 1562. 1290. 1686. 1460. 1613.]
TOKEN_COUNT_PER_GENERATION - :[15424. 15927.]
AVG_TOKEN_COUNT_PER_GENERATION:[np.float64(15675.5), 2]
INPUT_token_count:9640.0
OUTPUT_token_count:5576.0
AVG_INPUT_token_count:964.0
AVG_OUTPUT_token_count:557.6
TOTAL_TOKEN_COUNT:[1252. 1835. 1490. 1537. 1394. 1620. 1670. 1707. 1458. 1253.]
TOKEN_COUNT_PER_GENERATION - :[15424. 15927. 15216.]
AVG_TOKEN_COUNT_PER_GENERATION:[np.float64(15522.333333333334), 3]
INPUT_token_count:9356.0
OUTPUT_token_count:5277.0
AVG_INPUT_token_count:935.6
AVG_OUTPUT_token_count:527.7
TOTAL_TOKEN_COUNT:[1368. 1295. 1849. 1523. 1468. 1473. 1486. 1426. 1595. 1150.]
TOKEN_COUNT_PER_GENERATION - :[15424. 15927. 15216. 14633.]
AVG_TOKEN_COUNT_PER_GENERATION:[np.float64(15300.0), 4]
INPUT_token_count:9828.0
OUTPUT_token_count:4758.0
AVG_INPUT_token_count:982.8
AVG_OUTPUT_token_count:475.8
TOTAL_TOKEN_COUNT:[1820. 1235. 1911. 1591. 1312. 1242. 1372. 1533. 1393. 1177.]
TOKEN_COUNT_PER_GENERATION - :[15424. 15927. 15216. 14633. 14586.]
AVG_TOKEN_COUNT_PER_GENERATION:[np.float64(15157.2), 5]
"""
import os
from qdrant_client import QdrantClient
qdrant_client = QdrantClient(
url=os.environ.get('QDRANT_URL'),
api_key=os.environ.get('QDRANT_API_KEY'),
)
print(qdrant_client.get_collections())
# qdrant_client.recreate_collection(
# collection_name="programming",
# vectors_config={
# "my_vector_name": models.VectorParams(size=1536, distance=models.Distance.COSINE),
# },
# )
print()
print(os.environ.get('HF_API_KEY'))
print(os.environ.get('TOGETHER_API_KEY'))
print(os.environ.get('QDRANT_URL'))
print(os.environ.get('QDRANT_API_KEY'))
print(os.environ.get('CEREBRAS_API_KEY'))
# cerebras API: your_key
"""
Debugging FastAPI:
uvicorn app.py:app --reload
MacOS:
export TOGETHER_API_KEY="YOUR_API_KEY"
Windows:
$env:CEREBRAS_API_KEY = "your_key"
$env:QDRANT_URL = "your_url"
$env:QDRANT_API_KEY = "your_key"
"""
"""Token Count Test
INPUT_token_count:10616
OUTPUT_token_count:4808
AVG_INPUT_token_count:1061.6
AVG_OUTPUT_token_count:480.8
TOTAL_TOKEN_COUNT:[1717 1743 1417 1419 1483 1630 1516 1619 1580 1300]
TOKEN_COUNT_PER_GENERATION - :[15424.]
AVG_TOKEN_COUNT_PER_GENERATION:[np.float64(15424.0), 1]
INPUT_token_count:10299.0
OUTPUT_token_count:5628.0
AVG_INPUT_token_count:1029.9
AVG_OUTPUT_token_count:562.8
TOTAL_TOKEN_COUNT:[1852. 1520. 1615. 1790. 1539. 1562. 1290. 1686. 1460. 1613.]
TOKEN_COUNT_PER_GENERATION - :[15424. 15927.]
AVG_TOKEN_COUNT_PER_GENERATION:[np.float64(15675.5), 2]
INPUT_token_count:9640.0
OUTPUT_token_count:5576.0
AVG_INPUT_token_count:964.0
AVG_OUTPUT_token_count:557.6
TOTAL_TOKEN_COUNT:[1252. 1835. 1490. 1537. 1394. 1620. 1670. 1707. 1458. 1253.]
TOKEN_COUNT_PER_GENERATION - :[15424. 15927. 15216.]
AVG_TOKEN_COUNT_PER_GENERATION:[np.float64(15522.333333333334), 3]
INPUT_token_count:9356.0
OUTPUT_token_count:5277.0
AVG_INPUT_token_count:935.6
AVG_OUTPUT_token_count:527.7
TOTAL_TOKEN_COUNT:[1368. 1295. 1849. 1523. 1468. 1473. 1486. 1426. 1595. 1150.]
TOKEN_COUNT_PER_GENERATION - :[15424. 15927. 15216. 14633.]
AVG_TOKEN_COUNT_PER_GENERATION:[np.float64(15300.0), 4]
INPUT_token_count:9828.0
OUTPUT_token_count:4758.0
AVG_INPUT_token_count:982.8
AVG_OUTPUT_token_count:475.8
TOTAL_TOKEN_COUNT:[1820. 1235. 1911. 1591. 1312. 1242. 1372. 1533. 1393. 1177.]
TOKEN_COUNT_PER_GENERATION - :[15424. 15927. 15216. 14633. 14586.]
AVG_TOKEN_COUNT_PER_GENERATION:[np.float64(15157.2), 5]
"""
|