From 3043c3b6074de3819872d32f7b1c5d22f76421de Mon Sep 17 00:00:00 2001 From: Lu Peng Date: Tue, 10 Dec 2024 10:49:53 -0500 Subject: [PATCH 1/4] Updated doc. --- .../large_language_model/langchain_models.rst | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/docs/source/user_guide/large_language_model/langchain_models.rst b/docs/source/user_guide/large_language_model/langchain_models.rst index f079f5d74..459604948 100644 --- a/docs/source/user_guide/large_language_model/langchain_models.rst +++ b/docs/source/user_guide/large_language_model/langchain_models.rst @@ -26,15 +26,16 @@ By default, the integration uses the same authentication method configured with .. code-block:: python3 import ads - from ads.llm import ChatOCIModelDeploymentVLLM + from ads.llm import ChatOCIModelDeployment ads.set_auth(auth="resource_principal") - llm = ChatOCIModelDeploymentVLLM( + llm = ChatOCIModelDeployment( model="odsc-llm", endpoint= f"https://modeldeployment.oci.customer-oci.com//predict", - # Optionally you can specify additional keyword arguments for the model, e.g. temperature. + # Optionally you can specify additional keyword arguments for the model, e.g. temperature and headers. temperature=0.1, + headers={"route": "v1/chat/completions"}, # default header for chat models ) Alternatively, you may use specific authentication for the model: @@ -42,31 +43,33 @@ Alternatively, you may use specific authentication for the model: .. code-block:: python3 import ads - from ads.llm import ChatOCIModelDeploymentVLLM + from ads.llm import ChatOCIModelDeployment - llm = ChatOCIModelDeploymentVLLM( + llm = ChatOCIModelDeployment( model="odsc-llm", endpoint= f"https://modeldeployment.oci.customer-oci.com//predict", # Use security token authentication for the model auth=ads.auth.security_token(profile="my_profile"), - # Optionally you can specify additional keyword arguments for the model, e.g. temperature. + # Optionally you can specify additional keyword arguments for the model, e.g. temperature and headers. temperature=0.1, + headers={"route": "v1/chat/completions"}, # default header for chat models ) Completion Models ================= -Completion models takes a text string and input and returns a string with completions. To use completion models, your model should be deployed with the completion endpoint (``/v1/completions``). The following example shows how you can use the ``OCIModelDeploymentVLLM`` class for model deployed with vLLM container. If you deployed the model with TGI container, you can use ``OCIModelDeploymentTGI`` similarly. +Completion models takes a text string and input and returns a string with completions. To use completion models, your model should be deployed with the completion endpoint (``/v1/completions``). .. code-block:: python3 - from ads.llm import OCIModelDeploymentVLLM + from ads.llm import OCIModelDeploymentLLM - llm = OCIModelDeploymentVLLM( + llm = OCIModelDeploymentLLM( model="odsc-llm", endpoint= f"https://modeldeployment.oci.customer-oci.com//predict", # Optionally you can specify additional keyword arguments for the model. max_tokens=32, + headers={"route": "v1/completions"}, # default header for completion models ) # Invoke the LLM. The completion will be a string. @@ -87,18 +90,19 @@ Completion models takes a text string and input and returns a string with comple Chat Models =========== -Chat models takes `chat messages `_ as inputs and returns additional chat message (usually `AIMessage `_) as output. To use chat models, your models must be deployed with chat completion endpoint (``/v1/chat/completions``). The following example shows how you can use the ``ChatOCIModelDeploymentVLLM`` class for model deployed with vLLM container. If you deployed the model with TGI container, you can use ``ChatOCIModelDeploymentTGI`` similarly. +Chat models takes `chat messages `_ as inputs and returns additional chat message (usually `AIMessage `_) as output. To use chat models, your models must be deployed with chat completion endpoint (``/v1/chat/completions``). .. code-block:: python3 from langchain_core.messages import HumanMessage, SystemMessage - from ads.llm import ChatOCIModelDeploymentVLLM + from ads.llm import ChatOCIModelDeployment - llm = ChatOCIModelDeploymentVLLM( + llm = ChatOCIModelDeployment( model="odsc-llm", - endpoint=f">/predict", + endpoint=f"/predict", # Optionally you can specify additional keyword arguments for the model. max_tokens=32, + headers={"route": "v1/chat/completions"}, # default header for chat models ) messages = [ From b5370c4e3acfe58d4b9ed88885d5093e6ed64bff Mon Sep 17 00:00:00 2001 From: Lu Peng Date: Tue, 10 Dec 2024 14:04:52 -0500 Subject: [PATCH 2/4] Updated docs. --- .../large_language_model/langchain_models.rst | 12 ++++++------ .../model_registration/large_language_model.rst | 5 +++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/source/user_guide/large_language_model/langchain_models.rst b/docs/source/user_guide/large_language_model/langchain_models.rst index 459604948..a3018f6e6 100644 --- a/docs/source/user_guide/large_language_model/langchain_models.rst +++ b/docs/source/user_guide/large_language_model/langchain_models.rst @@ -33,9 +33,9 @@ By default, the integration uses the same authentication method configured with llm = ChatOCIModelDeployment( model="odsc-llm", endpoint= f"https://modeldeployment.oci.customer-oci.com//predict", - # Optionally you can specify additional keyword arguments for the model, e.g. temperature and headers. + # Optionally you can specify additional keyword arguments for the model, e.g. temperature and default_headers. temperature=0.1, - headers={"route": "v1/chat/completions"}, # default header for chat models + default_headers={"route": "v1/chat/completions"}, # default route for chat models ) Alternatively, you may use specific authentication for the model: @@ -50,9 +50,9 @@ Alternatively, you may use specific authentication for the model: endpoint= f"https://modeldeployment.oci.customer-oci.com//predict", # Use security token authentication for the model auth=ads.auth.security_token(profile="my_profile"), - # Optionally you can specify additional keyword arguments for the model, e.g. temperature and headers. + # Optionally you can specify additional keyword arguments for the model, e.g. temperature and default_headers. temperature=0.1, - headers={"route": "v1/chat/completions"}, # default header for chat models + default_headers={"route": "v1/chat/completions"}, # default route for chat models ) Completion Models @@ -69,7 +69,7 @@ Completion models takes a text string and input and returns a string with comple endpoint= f"https://modeldeployment.oci.customer-oci.com//predict", # Optionally you can specify additional keyword arguments for the model. max_tokens=32, - headers={"route": "v1/completions"}, # default header for completion models + default_headers={"route": "v1/completions"}, # default route for completion models ) # Invoke the LLM. The completion will be a string. @@ -102,7 +102,7 @@ Chat models takes `chat messages /predict", # Optionally you can specify additional keyword arguments for the model. max_tokens=32, - headers={"route": "v1/chat/completions"}, # default header for chat models + default_headers={"route": "v1/chat/completions"}, # default route for chat models ) messages = [ diff --git a/docs/source/user_guide/model_registration/large_language_model.rst b/docs/source/user_guide/model_registration/large_language_model.rst index 592d753e5..2d3d37513 100644 --- a/docs/source/user_guide/model_registration/large_language_model.rst +++ b/docs/source/user_guide/model_registration/large_language_model.rst @@ -2,6 +2,11 @@ Large Language Model ==================== +.. admonition:: AI Quick Actions + :class: note + + Oracle Data Science now has launched `AI Quick Actions `_, which makes it easy for you to browse foundation models, and deploy, fine-tune, and evaluate them inside Data Science notebooks. + Oracle ADS (Accelerated Data Science) opens the gateway to harnessing the full potential of the Large Language models within Oracle Cloud Infrastructure (OCI). `Meta `_'s latest offering, `Llama 2 `_, introduces a collection of pre-trained and From 5d0dff74f03a3e15ab3497ab0f3faf2c00a39d69 Mon Sep 17 00:00:00 2001 From: Lu Peng Date: Tue, 10 Dec 2024 21:15:49 -0500 Subject: [PATCH 3/4] Updated pr. --- .../user_guide/model_registration/large_language_model.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/source/user_guide/model_registration/large_language_model.rst b/docs/source/user_guide/model_registration/large_language_model.rst index 2d3d37513..23c7cb8f3 100644 --- a/docs/source/user_guide/model_registration/large_language_model.rst +++ b/docs/source/user_guide/model_registration/large_language_model.rst @@ -2,11 +2,16 @@ Large Language Model ==================== -.. admonition:: AI Quick Actions +.. admonition:: Introducing AI Quick Actions :class: note Oracle Data Science now has launched `AI Quick Actions `_, which makes it easy for you to browse foundation models, and deploy, fine-tune, and evaluate them inside Data Science notebooks. +.. admonition:: Use AI Quick Actions + :class: note + + The following page is obsolete and please use `AI Quick Actions `_ instead. + Oracle ADS (Accelerated Data Science) opens the gateway to harnessing the full potential of the Large Language models within Oracle Cloud Infrastructure (OCI). `Meta `_'s latest offering, `Llama 2 `_, introduces a collection of pre-trained and From ebf56ac3f9612cccc8fb88e91b5defda5fc4d9c1 Mon Sep 17 00:00:00 2001 From: Lu Peng Date: Tue, 10 Dec 2024 21:47:43 -0500 Subject: [PATCH 4/4] Updated pr. --- .../large_language_model/langchain_models.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/source/user_guide/large_language_model/langchain_models.rst b/docs/source/user_guide/large_language_model/langchain_models.rst index a3018f6e6..a8163b8dc 100644 --- a/docs/source/user_guide/large_language_model/langchain_models.rst +++ b/docs/source/user_guide/large_language_model/langchain_models.rst @@ -31,7 +31,7 @@ By default, the integration uses the same authentication method configured with ads.set_auth(auth="resource_principal") llm = ChatOCIModelDeployment( - model="odsc-llm", + model="odsc-llm", # default model name if deployed on AQUA endpoint= f"https://modeldeployment.oci.customer-oci.com//predict", # Optionally you can specify additional keyword arguments for the model, e.g. temperature and default_headers. temperature=0.1, @@ -46,7 +46,7 @@ Alternatively, you may use specific authentication for the model: from ads.llm import ChatOCIModelDeployment llm = ChatOCIModelDeployment( - model="odsc-llm", + model="odsc-llm", # default model name if deployed on AQUA endpoint= f"https://modeldeployment.oci.customer-oci.com//predict", # Use security token authentication for the model auth=ads.auth.security_token(profile="my_profile"), @@ -65,7 +65,7 @@ Completion models takes a text string and input and returns a string with comple from ads.llm import OCIModelDeploymentLLM llm = OCIModelDeploymentLLM( - model="odsc-llm", + model="odsc-llm", # default model name if deployed on AQUA endpoint= f"https://modeldeployment.oci.customer-oci.com//predict", # Optionally you can specify additional keyword arguments for the model. max_tokens=32, @@ -98,7 +98,7 @@ Chat models takes `chat messages /predict", # Optionally you can specify additional keyword arguments for the model. max_tokens=32, @@ -137,7 +137,7 @@ The vLLM container support `tool/function calling /predict", # Set tool_choice to "auto" to enable tool/function calling. tool_choice="auto",