|
13 | 13 | "metadata": {},
|
14 | 14 | "outputs": [],
|
15 | 15 | "source": [
|
16 |
| - "from llmstudio import LLM\n", |
| 16 | + "from llmstudio.providers import LLM\n", |
17 | 17 | "from pprint import pprint"
|
18 | 18 | ]
|
19 | 19 | },
|
|
43 | 43 | {
|
44 | 44 | "data": {
|
45 | 45 | "text/plain": [
|
46 |
| - "ChatCompletion(id='47c45235-3cba-498a-9bfa-255c3f1b829a', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='I’m called Assistant. How can I help you today?', refusal=None, role='assistant', function_call=None, tool_calls=None))], created=1729090941, model='gpt-4o', object='chat.completion', service_tier=None, system_fingerprint=None, usage=None, chat_input=\"What's your name\", chat_output='I’m called Assistant. How can I help you today?', chat_output_stream='', context=[{'role': 'user', 'content': \"What's your name\"}], provider='openai', deployment='gpt-4o-2024-08-06', timestamp=1729090942.350497, parameters={}, metrics={'input_tokens': 4, 'output_tokens': 12, 'total_tokens': 16, 'cost_usd': 0.0002, 'latency_s': 1.0681071281433105, 'time_to_first_token_s': 0.911978006362915, 'inter_token_latency_s': 0.011577862959641676, 'tokens_per_second': 13.107299475040659})" |
| 46 | + "ChatCompletion(id='ec40a65d-77f0-43f3-b78e-510c362a8b65', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content=\"I'm called Assistant. How can I assist you today?\", refusal=None, role='assistant', function_call=None, tool_calls=None))], created=1729179436, model='gpt-4o', object='chat.completion', service_tier=None, system_fingerprint=None, usage=None, chat_input=\"What's your name\", chat_output=\"I'm called Assistant. How can I assist you today?\", chat_output_stream='', context=[{'role': 'user', 'content': \"What's your name\"}], provider='openai', deployment='gpt-4o-2024-08-06', timestamp=1729179437.0009851, parameters={}, metrics={'input_tokens': 4, 'output_tokens': 12, 'total_tokens': 16, 'cost_usd': 0.0002, 'latency_s': 0.8632550239562988, 'time_to_first_token_s': 0.7578170299530029, 'inter_token_latency_s': 0.007991174856821695, 'tokens_per_second': 15.059281022682017})" |
47 | 47 | ]
|
48 | 48 | },
|
49 | 49 | "execution_count": 3,
|
|
66 | 66 | "cell_type": "code",
|
67 | 67 | "execution_count": 4,
|
68 | 68 | "metadata": {},
|
69 |
| - "outputs": [ |
70 |
| - { |
71 |
| - "data": { |
72 |
| - "text/plain": [ |
73 |
| - "ChatCompletion(id='65b6f534-3aea-4361-995a-822628ff7950', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content=\"I'm called Assistant or ChatGPT. How can I help you today?\", refusal=None, role='assistant', function_call=None, tool_calls=None))], created=1729090942, model='gpt-4o', object='chat.completion', service_tier=None, system_fingerprint=None, usage=None, chat_input=\"What's your name\", chat_output=\"I'm called Assistant or ChatGPT. How can I help you today?\", chat_output_stream='', context=[{'role': 'user', 'content': \"What's your name\"}], provider='openai', deployment='gpt-4o-2024-08-06', timestamp=1729090943.4086301, parameters={}, metrics={'input_tokens': 4, 'output_tokens': 16, 'total_tokens': 20, 'cost_usd': 0.00026000000000000003, 'latency_s': 1.0519328117370605, 'time_to_first_token_s': 0.9430949687957764, 'inter_token_latency_s': 0.007242250442504883, 'tokens_per_second': 15.21009690113111})" |
74 |
| - ] |
75 |
| - }, |
76 |
| - "execution_count": 4, |
77 |
| - "metadata": {}, |
78 |
| - "output_type": "execute_result" |
79 |
| - } |
80 |
| - ], |
| 69 | + "outputs": [], |
81 | 70 | "source": [
|
82 | 71 | "await openai.achat(\"What's your name\", model=\"gpt-4o\")"
|
83 | 72 | ]
|
|
100 | 89 | "text": [
|
101 | 90 | "\n",
|
102 | 91 | "\n",
|
103 |
| - "Space, an immense and enigmatic expanse beyond Earth's atmosphere, captivates the imagination with its bound\n", |
| 92 | + "Space, the vast expanse beyond Earth's atmosphere, captivates the human imagination with its infinite possibilities\n", |
104 | 93 | "\n",
|
105 |
| - "less mysteries and wonders. It holds stars, planets, galaxies, and countless celestial phenomena that both intrigue\n", |
| 94 | + " and mysteries. It is a realm where celestial bodies such as planets, stars, comets, and\n", |
106 | 95 | "\n",
|
107 |
| - " and inspire humanity. The vastness of space is punctuated by brilliant constellations, swirling neb\n", |
| 96 | + " galaxies reside, each offering a unique insight into the origins and evolution of the universe. Space exploration has\n", |
108 | 97 | "\n",
|
109 |
| - "ulae, and the remnants of ancient supernovae, offering clues to the origins of the universe\n", |
| 98 | + " propelled technological advancements and fostered international collaboration as scientists and engineers strive to unravel the secrets of cosmic phenomena\n", |
110 | 99 | "\n",
|
111 |
| - ". Exploration through telescopes and spacecraft expands our understanding, revealing the intricate dance of cosmic bodies and the\n", |
| 100 | + " like black holes, dark matter, and the potential for extraterrestrial life. This boundless frontier continues\n", |
112 | 101 | "\n",
|
113 |
| - " potential for life beyond our planet. Space challenges us to push technological boundaries and ponder profound questions about our\n", |
| 102 | + " to inspire wonder, pushing the boundaries of human knowledge and ambition as we seek to understand our place in\n", |
114 | 103 | "\n",
|
115 |
| - " place in the cosmos, making it an endless frontier of discovery and curiosity.\n", |
| 104 | + " the cosmos and the potential for future habitation beyond our home planet. With each mission and discovery, space\n", |
| 105 | + "\n", |
| 106 | + " challenges and expands our perceptions, fueling the quest for discovery and innovation.\n", |
116 | 107 | "\n",
|
117 | 108 | "## Metrics:\n",
|
118 |
| - "{'cost_usd': 0.002095,\n", |
| 109 | + "{'cost_usd': 0.0024100000000000002,\n", |
119 | 110 | " 'input_tokens': 8,\n",
|
120 |
| - " 'inter_token_latency_s': 0.018547398955733686,\n", |
121 |
| - " 'latency_s': 3.2096359729766846,\n", |
122 |
| - " 'output_tokens': 137,\n", |
123 |
| - " 'time_to_first_token_s': 0.7052650451660156,\n", |
124 |
| - " 'tokens_per_second': 42.37240644890664,\n", |
125 |
| - " 'total_tokens': 145}\n" |
| 111 | + " 'inter_token_latency_s': 0.011506473863279664,\n", |
| 112 | + " 'latency_s': 2.5703747272491455,\n", |
| 113 | + " 'output_tokens': 158,\n", |
| 114 | + " 'time_to_first_token_s': 0.7979397773742676,\n", |
| 115 | + " 'tokens_per_second': 60.302491444849906,\n", |
| 116 | + " 'total_tokens': 166}\n" |
126 | 117 | ]
|
127 | 118 | }
|
128 | 119 | ],
|
|
156 | 147 | "text": [
|
157 | 148 | "\n",
|
158 | 149 | "\n",
|
159 |
| - "Space, the vast and seemingly infinite expanse beyond our planet, captivates the imagination and fuels\n", |
| 150 | + "Space, the vast and seemingly infinite expanse that extends beyond our planet, captivates the imagination\n", |
| 151 | + "\n", |
| 152 | + " and fuels our curiosity about the universe. It is a realm where celestial bodies like stars, planets,\n", |
160 | 153 | "\n",
|
161 |
| - " human curiosity. It is a realm of celestial wonders, from the swirling galaxies and shimmering stars to the\n", |
| 154 | + " and galaxies interact through complex gravitational forces, giving rise to phenomena such as black holes, supernovae\n", |
162 | 155 | "\n",
|
163 |
| - " enigmatic black holes and majestic nebulae. In this cosmic backdrop, the laws of physics reign supreme\n", |
| 156 | + ", and cosmic radiation. The sheer scale of space is mind-boggling—vast distances measured in\n", |
164 | 157 | "\n",
|
165 |
| - ", governing the motion of planets and the life cycles of stars. Space not only challenges our understanding of\n", |
| 158 | + " light-years and the potential for countless worlds yet to be discovered. As humanity ventures further into this un\n", |
166 | 159 | "\n",
|
167 |
| - " the universe but also invites exploration, as humanity pushes the boundaries of technology to uncover its secrets. As\n", |
| 160 | + "charted territory with missions to distant planets and explorations of exoplanets, we grapple with fundamental questions\n", |
| 161 | + "\n", |
| 162 | + " about our place in the cosmos and the possibility of life beyond Earth. Each new discovery adds to our\n", |
| 163 | + "\n", |
| 164 | + " understanding of the origin and evolution of the universe, inspiring dreams of what lies beyond the final frontier.\n", |
168 | 165 | "\n",
|
169 |
| - " we gaze at the night sky, we are reminded of our place in the cosmos and the endless possibilities\n", |
170 | 166 | "\n",
|
171 |
| - " that lie beyond, beckoning us to explore and discover the mysteries of the universe.\n", |
172 | 167 | "\n",
|
173 | 168 | "## Metrics:\n",
|
174 |
| - "{'cost_usd': 8.46e-05,\n", |
| 169 | + "{'cost_usd': 9.839999999999999e-05,\n", |
175 | 170 | " 'input_tokens': 8,\n",
|
176 |
| - " 'inter_token_latency_s': 0.0063348164523605015,\n", |
177 |
| - " 'latency_s': 2.652230739593506,\n", |
178 |
| - " 'output_tokens': 139,\n", |
179 |
| - " 'time_to_first_token_s': 1.7840969562530518,\n", |
180 |
| - " 'tokens_per_second': 52.031672033614456,\n", |
181 |
| - " 'total_tokens': 147}\n" |
182 |
| - ] |
183 |
| - }, |
184 |
| - { |
185 |
| - "ename": "", |
186 |
| - "evalue": "", |
187 |
| - "output_type": "error", |
188 |
| - "traceback": [ |
189 |
| - "\u001b[1;31mThe Kernel crashed while executing code in the current cell or a previous cell. \n", |
190 |
| - "\u001b[1;31mPlease review the code in the cell(s) to identify a possible cause of the failure. \n", |
191 |
| - "\u001b[1;31mClick <a href='https://aka.ms/vscodeJupyterKernelCrash'>here</a> for more info. \n", |
192 |
| - "\u001b[1;31mView Jupyter <a href='command:jupyter.viewOutput'>log</a> for further details." |
| 171 | + " 'inter_token_latency_s': 0.014622557163238525,\n", |
| 172 | + " 'latency_s': 2.8971738815307617,\n", |
| 173 | + " 'output_tokens': 162,\n", |
| 174 | + " 'time_to_first_token_s': 0.5567238330841064,\n", |
| 175 | + " 'tokens_per_second': 55.57139701774939,\n", |
| 176 | + " 'total_tokens': 170}\n" |
193 | 177 | ]
|
194 | 178 | }
|
195 | 179 | ],
|
|
0 commit comments