mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 02:34:29 +00:00
use deploy flag
This commit is contained in:
parent
f4465e301f
commit
7804aa1ddf
2 changed files with 45 additions and 7 deletions
|
@ -30,15 +30,20 @@ def run_server(port, api_base, model, deploy, debug, temperature, max_tokens, te
|
|||
click.echo('No .env.template file found.')
|
||||
|
||||
# from .proxy_server import app, initialize
|
||||
from proxy_server import app, initialize
|
||||
initialize(model, api_base, debug, temperature, max_tokens, telemetry)
|
||||
from proxy_server import app, initialize, deploy_proxy
|
||||
if deploy == True:
|
||||
click.echo('LiteLLM: Deploying your proxy server')
|
||||
url = deploy_proxy(model, api_base, debug, temperature, max_tokens, telemetry, deploy)
|
||||
click.echo(f'LiteLLM: Your deployed url: {url}')
|
||||
else:
|
||||
initialize(model, api_base, debug, temperature, max_tokens, telemetry)
|
||||
|
||||
|
||||
try:
|
||||
import uvicorn
|
||||
except:
|
||||
raise ImportError("Uvicorn needs to be imported. Run - `pip install uvicorn`")
|
||||
uvicorn.run(app, host='0.0.0.0', port=port)
|
||||
try:
|
||||
import uvicorn
|
||||
except:
|
||||
raise ImportError("Uvicorn needs to be imported. Run - `pip install uvicorn`")
|
||||
uvicorn.run(app, host='0.0.0.0', port=port)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -53,6 +53,39 @@ def initialize(model, api_base, debug, temperature, max_tokens, telemetry):
|
|||
user_telemetry = telemetry
|
||||
usage_telemetry()
|
||||
|
||||
def deploy_proxy(model, api_base, debug, temperature, max_tokens, telemetry, deploy):
|
||||
# Load .env file
|
||||
|
||||
# Prepare data for posting
|
||||
data = {
|
||||
"model": model,
|
||||
"api_base": api_base,
|
||||
"debug": debug,
|
||||
"temperature": temperature,
|
||||
"max_tokens": max_tokens,
|
||||
}
|
||||
|
||||
print(data)
|
||||
|
||||
# Make post request to the url
|
||||
url = "https://api.litellm.ai/deploy"
|
||||
files = {"file": open(".env", "rb")}
|
||||
print(files)
|
||||
# response = requests.post(url, data=data, files=files)
|
||||
|
||||
# # Check the status of the request
|
||||
# if response.status_code != 200:
|
||||
# return f"Request to url: {url} failed with status: {response.status_code}"
|
||||
|
||||
# # Reading the response
|
||||
# response_data = response.json()
|
||||
# print(response_data)
|
||||
|
||||
# # Do something with response_data
|
||||
|
||||
return url
|
||||
|
||||
|
||||
# for streaming
|
||||
def data_generator(response):
|
||||
print("inside generator")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue