diff --git a/docs/my-website/docs/completion/input.md b/docs/my-website/docs/completion/input.md index c1ae22c82f..53826c9d0f 100644 --- a/docs/my-website/docs/completion/input.md +++ b/docs/my-website/docs/completion/input.md @@ -1,4 +1,4 @@ -# Input Format - completion() +# Input Format The Input params are **exactly the same** as the OpenAI Create chat completion, and let you call Azure OpenAI, Anthropic, Cohere, Replicate, OpenRouter models in the same format. diff --git a/docs/my-website/docs/completion/model_alias.md b/docs/my-website/docs/completion/model_alias.md new file mode 100644 index 0000000000..0e6e897099 --- /dev/null +++ b/docs/my-website/docs/completion/model_alias.md @@ -0,0 +1,49 @@ +# Model Alias + +Model names can be long, and you might want to use more user-friendly names for your end-users - e.g. Calling it `GPT-3.5` when the model name is `gpt-3.5-turbo-16k`. + +LiteLLM supports this by letting you pass in a model alias mapping. + +# usage + +### Relevant Code +``` +model_alias_map = { + "GPT-3.5": "gpt-3.5-turbo-16k", + "llama2": "replicate/llama-2-70b-chat:2796ee9483c3fd7aa2e171d38f4ca12251a30609463dcfd4cd76703f22e96cdf" +} + +litellm.model_alias_map = model_alias_map +``` + +### Complete Code +``` +import litellm +from litellm import completion + + +## set ENV variables +os.environ["OPENAI_API_KEY"] = "openai key" +os.environ["REPLICATE_API_KEY"] = "cohere key" + +## set model alias map +model_alias_map = { + "GPT-3.5": "gpt-3.5-turbo-16k", + "llama2": "replicate/llama-2-70b-chat:2796ee9483c3fd7aa2e171d38f4ca12251a30609463dcfd4cd76703f22e96cdf" +} + +litellm.model_alias_map = model_alias_map + +messages = [{ "content": "Hello, how are you?","role": "user"}] + +# openai call +response = completion(model="GPT-3.5", messages=messages) + +# replicate call +response = completion("llama2", messages) +``` + + +# no-code + +If you use litellm client, you can also do this without going into code. [Learn more]("https://docs.litellm.ai/docs/debugging/hosted_debugging") \ No newline at end of file diff --git a/docs/my-website/docs/completion/output.md b/docs/my-website/docs/completion/output.md index 4fb12c91d0..6f7f503ff3 100644 --- a/docs/my-website/docs/completion/output.md +++ b/docs/my-website/docs/completion/output.md @@ -1,4 +1,4 @@ -# Output Format - completion() +# Output Format Here's the exact json output and type you can expect from all litellm `completion` calls for all models ```python diff --git a/docs/my-website/docs/completion/reliable_completions.md b/docs/my-website/docs/completion/reliable_completions.md index 97d93e2147..eb37c3941e 100644 --- a/docs/my-website/docs/completion/reliable_completions.md +++ b/docs/my-website/docs/completion/reliable_completions.md @@ -1,4 +1,4 @@ -# Reliability for completion() +# Reliability LiteLLM supports the following functions for reliability: * `completion_with_retries`: use tenacity retries diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js index 1a28783566..e9bf50e3c8 100644 --- a/docs/my-website/sidebars.js +++ b/docs/my-website/sidebars.js @@ -22,7 +22,7 @@ const sidebars = { { type: "category", label: "Completion()", - items: ["completion/input", "completion/output", "completion/reliable_completions", "completion/stream"], + items: ["completion/input", "completion/output", "completion/model_alias", "completion/reliable_completions", "completion/stream"], }, { type: "category",