|
23 | 23 | "name": "stdout", |
24 | 24 | "output_type": "stream", |
25 | 25 | "text": [ |
26 | | - "Running LLMstudio Engine on http://0.0.0.0:8001 \n", |
| 26 | + "Running LLMstudio Proxy on http://0.0.0.0:8001 \n", |
27 | 27 | "Running LLMstudio Tracking on http://0.0.0.0:8002 \n" |
28 | 28 | ] |
29 | 29 | } |
30 | 30 | ], |
31 | 31 | "source": [ |
32 | | - "from llmstudio.server import start_server\n", |
33 | | - "start_server()" |
| 32 | + "from llmstudio.server import start_servers\n", |
| 33 | + "start_servers()" |
34 | 34 | ] |
35 | 35 | }, |
36 | 36 | { |
|
47 | 47 | } |
48 | 48 | ], |
49 | 49 | "source": [ |
50 | | - "from llmstudio.engine.provider import LLMProxyProvider as LLM\n", |
51 | | - "from llmstudio.engine.provider import ProxyConfig\n", |
| 50 | + "from llmstudio_proxy.provider import LLMProxyProvider as LLM\n", |
| 51 | + "from llmstudio_proxy.provider import ProxyConfig\n", |
52 | 52 | "\n", |
53 | 53 | "# from llmstudio_core import LLMCore as LLM\n", |
54 | 54 | "# from llmstudio import LLM\n", |
|
61 | 61 | "cell_type": "code", |
62 | 62 | "execution_count": 3, |
63 | 63 | "metadata": {}, |
64 | | - "outputs": [], |
| 64 | + "outputs": [ |
| 65 | + { |
| 66 | + "ename": "Exception", |
| 67 | + "evalue": "{\"detail\":\"Not Found\"}", |
| 68 | + "output_type": "error", |
| 69 | + "traceback": [ |
| 70 | + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
| 71 | + "\u001b[0;31mException\u001b[0m Traceback (most recent call last)", |
| 72 | + "Cell \u001b[0;32mIn[3], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mllm\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mchat\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43molá\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mgpt-4o\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n", |
| 73 | + "File \u001b[0;32m~/fun/LLMstudio/libs/proxy/llmstudio_proxy/provider.py:63\u001b[0m, in \u001b[0;36mLLMProxyProvider.chat\u001b[0;34m(self, chat_input, model, is_stream, retries, parameters, **kwargs)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m response\u001b[38;5;241m.\u001b[39mok:\n\u001b[1;32m 62\u001b[0m error_data \u001b[38;5;241m=\u001b[39m response\u001b[38;5;241m.\u001b[39mtext\n\u001b[0;32m---> 63\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m(error_data)\n\u001b[1;32m 65\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_stream:\n\u001b[1;32m 66\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgenerate_chat(response)\n", |
| 74 | + "\u001b[0;31mException\u001b[0m: {\"detail\":\"Not Found\"}" |
| 75 | + ] |
| 76 | + } |
| 77 | + ], |
65 | 78 | "source": [ |
66 | 79 | "result = llm.chat(\"olá\", model=\"gpt-4o\")\n" |
67 | 80 | ] |
|
74 | 87 | { |
75 | 88 | "data": { |
76 | 89 | "text/plain": [ |
77 | | - "('Olá! Como posso ajudar você hoje?',\n", |
| 90 | + "('Olá! Como posso ajudá-lo hoje?',\n", |
78 | 91 | " {'input_tokens': 2,\n", |
79 | 92 | " 'output_tokens': 11,\n", |
80 | 93 | " 'total_tokens': 13,\n", |
81 | 94 | " 'cost_usd': 0.000175,\n", |
82 | | - " 'latency_s': 0.6496210098266602,\n", |
83 | | - " 'time_to_first_token_s': 0.5341501235961914,\n", |
84 | | - " 'inter_token_latency_s': 0.01241710450914171,\n", |
85 | | - " 'tokens_per_second': 15.393590799454474})" |
| 95 | + " 'latency_s': 0.9914300441741943,\n", |
| 96 | + " 'time_to_first_token_s': 0.8828918933868408,\n", |
| 97 | + " 'inter_token_latency_s': 0.011675781673855253,\n", |
| 98 | + " 'tokens_per_second': 10.086440348223903})" |
86 | 99 | ] |
87 | 100 | }, |
88 | 101 | "execution_count": 4, |
|
117 | 130 | "metadata": {}, |
118 | 131 | "outputs": [ |
119 | 132 | { |
120 | | - "name": "stdout", |
121 | | - "output_type": "stream", |
122 | | - "text": [ |
123 | | - "host='0.0.0.0' port='8001' url=None username=None password=None\n", |
124 | | - "Connected to LLMStudio Proxy @ 0.0.0.0:8001\n" |
| 133 | + "ename": "ModuleNotFoundError", |
| 134 | + "evalue": "No module named 'llmstudio_proxyprovider'", |
| 135 | + "output_type": "error", |
| 136 | + "traceback": [ |
| 137 | + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
| 138 | + "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", |
| 139 | + "Cell \u001b[0;32mIn[6], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# You can set OPENAI_API_KEY and ANTHROPIC_API_KEY on .env file\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mllmstudio_proxyprovider\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m ProxyConfig\n\u001b[1;32m 3\u001b[0m proxy \u001b[38;5;241m=\u001b[39m ProxyConfig(host\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m0.0.0.0\u001b[39m\u001b[38;5;124m\"\u001b[39m, port\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m8001\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(proxy)\n", |
| 140 | + "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'llmstudio_proxyprovider'" |
125 | 141 | ] |
126 | 142 | } |
127 | 143 | ], |
128 | 144 | "source": [ |
129 | 145 | "# You can set OPENAI_API_KEY and ANTHROPIC_API_KEY on .env file\n", |
130 | | - "from llmstudio.engine.provider import ProxyConfig\n", |
| 146 | + "from llmstudio_proxyprovider import ProxyConfig\n", |
131 | 147 | "proxy = ProxyConfig(host=\"0.0.0.0\", port=\"8001\")\n", |
132 | 148 | "print(proxy)\n", |
133 | 149 | "\n", |
|
0 commit comments