Skip to content

Commit 3043c3b

Browse files
committed
Updated doc.
1 parent 3d8f148 commit 3043c3b

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

docs/source/user_guide/large_language_model/langchain_models.rst

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,47 +26,50 @@ By default, the integration uses the same authentication method configured with
2626
.. code-block:: python3
2727
2828
import ads
29-
from ads.llm import ChatOCIModelDeploymentVLLM
29+
from ads.llm import ChatOCIModelDeployment
3030
3131
ads.set_auth(auth="resource_principal")
3232
33-
llm = ChatOCIModelDeploymentVLLM(
33+
llm = ChatOCIModelDeployment(
3434
model="odsc-llm",
3535
endpoint= f"https://modeldeployment.oci.customer-oci.com/<OCID>/predict",
36-
# Optionally you can specify additional keyword arguments for the model, e.g. temperature.
36+
# Optionally you can specify additional keyword arguments for the model, e.g. temperature and headers.
3737
temperature=0.1,
38+
headers={"route": "v1/chat/completions"}, # default header for chat models
3839
)
3940
4041
Alternatively, you may use specific authentication for the model:
4142

4243
.. code-block:: python3
4344
4445
import ads
45-
from ads.llm import ChatOCIModelDeploymentVLLM
46+
from ads.llm import ChatOCIModelDeployment
4647
47-
llm = ChatOCIModelDeploymentVLLM(
48+
llm = ChatOCIModelDeployment(
4849
model="odsc-llm",
4950
endpoint= f"https://modeldeployment.oci.customer-oci.com/<OCID>/predict",
5051
# Use security token authentication for the model
5152
auth=ads.auth.security_token(profile="my_profile"),
52-
# Optionally you can specify additional keyword arguments for the model, e.g. temperature.
53+
# Optionally you can specify additional keyword arguments for the model, e.g. temperature and headers.
5354
temperature=0.1,
55+
headers={"route": "v1/chat/completions"}, # default header for chat models
5456
)
5557
5658
Completion Models
5759
=================
5860

59-
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.
61+
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``).
6062

6163
.. code-block:: python3
6264
63-
from ads.llm import OCIModelDeploymentVLLM
65+
from ads.llm import OCIModelDeploymentLLM
6466
65-
llm = OCIModelDeploymentVLLM(
67+
llm = OCIModelDeploymentLLM(
6668
model="odsc-llm",
6769
endpoint= f"https://modeldeployment.oci.customer-oci.com/<OCID>/predict",
6870
# Optionally you can specify additional keyword arguments for the model.
6971
max_tokens=32,
72+
headers={"route": "v1/completions"}, # default header for completion models
7073
)
7174
7275
# 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
8790
Chat Models
8891
===========
8992

90-
Chat models takes `chat messages <https://python.langchain.com/docs/concepts/#messages>`_ as inputs and returns additional chat message (usually `AIMessage <https://python.langchain.com/docs/concepts/#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.
93+
Chat models takes `chat messages <https://python.langchain.com/docs/concepts/#messages>`_ as inputs and returns additional chat message (usually `AIMessage <https://python.langchain.com/docs/concepts/#aimessage>`_) as output. To use chat models, your models must be deployed with chat completion endpoint (``/v1/chat/completions``).
9194

9295
.. code-block:: python3
9396
9497
from langchain_core.messages import HumanMessage, SystemMessage
95-
from ads.llm import ChatOCIModelDeploymentVLLM
98+
from ads.llm import ChatOCIModelDeployment
9699
97-
llm = ChatOCIModelDeploymentVLLM(
100+
llm = ChatOCIModelDeployment(
98101
model="odsc-llm",
99-
endpoint=f"<oci_model_deployment_url>>/predict",
102+
endpoint=f"<oci_model_deployment_url>/predict",
100103
# Optionally you can specify additional keyword arguments for the model.
101104
max_tokens=32,
105+
headers={"route": "v1/chat/completions"}, # default header for chat models
102106
)
103107
104108
messages = [

0 commit comments

Comments
 (0)