Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions modules/src/openai_proxy_app/item.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ spec:
filename: openai_proxy_app.py
image: mlrun/mlrun
requirements:
- fastapi>=0.110,<1.0
- uvicorn[standard]>=0.29,<1.0
- gunicorn>=21.2,<22.0
- requests>=2.31,<3.0
- fastapi==0.124.0
- uvicorn[standard]==0.38.0
- gunicorn==23.0.0
- requests==2.32.5
kind: generic
version: 1.0.0
30 changes: 14 additions & 16 deletions modules/src/openai_proxy_app/openai_proxy_app.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,38 +52,36 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ea80c1fb-014d-4db1-95d3-71e6cd362a87",
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"project = mlrun.get_or_create_project(\"openai-module\", user_project=True)\n",
"\n",
"default_model = os.getenv(\"OPENAI_DEFAULT_MODEL\",None)\n",
"if default_model:\n",
" project.set_secrets({\"OPENAI_DEFAULT_MODEL\":default_model})\n",
"project.set_secrets({\n",
" \"OPENAI_BASE_URL\": os.environ[\"OPENAI_BASE_URL\"],\n",
" \"OPENAI_API_KEY\": os.environ[\"OPENAI_API_KEY\"],\n",
" \"OPENAI_DEFAULT_MODEL\": os.environ[\"OPENAI_DEFAULT_MODEL\"]\n",
"})"
]
],
"id": "5f7e307b080860a2"
},
{
"cell_type": "markdown",
"id": "c59fd225-f719-4881-a643-f41553b529d6",
"metadata": {},
"source": [
"### Import the OpenAI proxy module from the Hub"
]
"cell_type": "markdown",
"source": "### Import the OpenAI proxy module from the Hub",
"id": "ff506f09dd50a0ef"
},
{
"cell_type": "code",
"execution_count": 3,
"id": "5d294a0a-0500-464e-b8f7-c3c5f02bcc45",
"metadata": {},
"cell_type": "code",
"outputs": [],
"source": [
"openai_module = mlrun.import_module(\"hub://openai_proxy_app\")"
]
"execution_count": null,
"source": "openai_module = mlrun.import_module(\"hub://openai_proxy_app\")",
"id": "be1f5b3227d44a72"
},
{
"cell_type": "code",
Expand Down
8 changes: 4 additions & 4 deletions modules/src/openai_proxy_app/openai_proxy_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def __init__(self,project):
self.project = project
self.openai_proxy_app = self.project.set_function(name="openai",kind="application",image="python:3.11")
self.openai_proxy_app.with_requirements([
"fastapi>=0.110,<1.0",
"uvicorn[standard]>=0.29,<1.0",
"gunicorn>=21.2,<22.0",
"requests>=2.31,<3.0",
"fastapi==0.124.0",
"uvicorn[standard]==0.38.0",
"gunicorn==23.0.0",
"requests=2.32.5",
])
self.openai_proxy_app.set_env("BASE64",BASE64)
self.openai_proxy_app.set_internal_application_port(8000)
Expand Down
8 changes: 4 additions & 4 deletions modules/src/openai_proxy_app/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fastapi>=0.110,<1.0
uvicorn[standard]>=0.29,<1.0
gunicorn>=21.2,<22.0
requests>=2.31,<3.0
fastapi==0.124.0
uvicorn[standard]==0.38.0
gunicorn==23.0.0
requests==2.32.5