mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
24 lines
No EOL
1.1 KiB
Python
24 lines
No EOL
1.1 KiB
Python
import click
|
|
from dotenv import load_dotenv
|
|
load_dotenv()
|
|
|
|
@click.command()
|
|
@click.option('--port', default=8000, help='Port to bind the server to.')
|
|
@click.option('--api_base', default=None, help='API base URL.')
|
|
@click.option('--model', required=True, help='The model name to pass to litellm expects')
|
|
@click.option('--debug', is_flag=True, help='To debug the input')
|
|
@click.option('--temperature', default=None, type=float, help='Set temperature for the model')
|
|
@click.option('--max_tokens', default=None, help='Set max tokens for the model')
|
|
@click.option('--telemetry', default=True, type=bool, help='Helps us know if people are using this feature. Turn this off by doing `--telemetry False`')
|
|
def run_server(port, api_base, model, debug, temperature, max_tokens, telemetry):
|
|
from .proxy_server import app, initialize
|
|
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)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run_server() |