{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Hello! I'm an AI and don't have feelings, but I'm here and ready to help you. How can I assist you today?\n" ] } ], "source": [ "import litellm \n", "\n", "messages = [{ \"content\": \"Hello, how are you?\",\"role\": \"user\"}]\n", "\n", "# hosted_vllm is prefix key word and necessary\n", "response = litellm.completion(\n", " model=\"hosted_vllm/Qwen2.5-14B-Instruct\", # pass the vllm model name\n", " messages=messages,\n", " api_base=\"http://127.0.0.1:8000/v1\",\n", " temperature=0.2,\n", " max_tokens=80)\n", "\n", "print(response.choices[0].message.content)" ] }, { "cell_type": "code", "execution_count": null, "id": "da35003c", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "verl2", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.19" } }, "nbformat": 4, "nbformat_minor": 5 }