mirror of
https://github.com/hwchase17/langchain.git
synced 2026-02-04 08:10:25 +00:00
Compare commits
62 Commits
eugene/lan
...
langchain-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
202d7f6c4a | ||
|
|
a38e903360 | ||
|
|
fdb7f951c8 | ||
|
|
88d71f6986 | ||
|
|
a4392b070d | ||
|
|
31e7664afd | ||
|
|
3165415369 | ||
|
|
591a3db4fb | ||
|
|
b8bfebd382 | ||
|
|
15c1ddaf99 | ||
|
|
8e66822100 | ||
|
|
3f74dfc3d8 | ||
|
|
edf6d0a0fb | ||
|
|
d2cd43601b | ||
|
|
12fea5b868 | ||
|
|
fead4749b9 | ||
|
|
f3925d71b9 | ||
|
|
92ae61bcc8 | ||
|
|
0a3e089827 | ||
|
|
c6533616b6 | ||
|
|
3fa5ce3e5f | ||
|
|
443b37403d | ||
|
|
57fbc6bdf1 | ||
|
|
fc14f675f1 | ||
|
|
8fea07f92e | ||
|
|
8dc4bec947 | ||
|
|
de62d02102 | ||
|
|
59bbda9ba3 | ||
|
|
2197958366 | ||
|
|
5647276998 | ||
|
|
2a1029c53c | ||
|
|
5b9b8fe80f | ||
|
|
7da2efd9d3 | ||
|
|
ff925d2ddc | ||
|
|
4553573acb | ||
|
|
d05fdd97dd | ||
|
|
84c05b031d | ||
|
|
a7c1ce2b3f | ||
|
|
481bd25d29 | ||
|
|
cedf4d9462 | ||
|
|
6c33124c72 | ||
|
|
7264fb254c | ||
|
|
ce33c4fa40 | ||
|
|
b298d0337e | ||
|
|
73ad7f2e7a | ||
|
|
e3e9ee8398 | ||
|
|
e3920f2320 | ||
|
|
c3cb56a9e8 | ||
|
|
b716d808ba | ||
|
|
feb4be82aa | ||
|
|
c10e1f70fe | ||
|
|
b84e00283f | ||
|
|
9b7bdf1a26 | ||
|
|
0b36ed09cf | ||
|
|
0ec74fbc14 | ||
|
|
ea9a59bcf5 | ||
|
|
8d27325dbc | ||
|
|
16f5fdb38b | ||
|
|
5c826faece | ||
|
|
d31ec8810a | ||
|
|
37ca468d03 | ||
|
|
8454a742d7 |
8
.github/workflows/api_doc_build.yml
vendored
8
.github/workflows/api_doc_build.yml
vendored
@@ -73,6 +73,10 @@ jobs:
|
||||
with:
|
||||
repository: langchain-ai/langchain-unstructured
|
||||
path: langchain-unstructured
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: langchain-ai/langchain-databricks
|
||||
path: langchain-databricks
|
||||
|
||||
|
||||
- name: Set Git config
|
||||
@@ -97,7 +101,8 @@ jobs:
|
||||
langchain/libs/standard-tests \
|
||||
langchain/libs/experimental \
|
||||
langchain/libs/partners/milvus \
|
||||
langchain/libs/partners/unstructured
|
||||
langchain/libs/partners/unstructured \
|
||||
langchain/libs/databricks
|
||||
mv langchain-google/libs/genai langchain/libs/partners/google-genai
|
||||
mv langchain-google/libs/vertexai langchain/libs/partners/google-vertexai
|
||||
mv langchain-google/libs/community langchain/libs/partners/google-community
|
||||
@@ -113,6 +118,7 @@ jobs:
|
||||
mv langchain-experimental/libs/experimental langchain/libs/experimental
|
||||
mv langchain-milvus/libs/milvus langchain/libs/partners/milvus
|
||||
mv langchain-unstructured/libs/unstructured langchain/libs/partners/unstructured
|
||||
mv langchain-databricks/libs/databricks langchain/libs/partners/databricks
|
||||
|
||||
- name: Rm old html
|
||||
run:
|
||||
|
||||
14
.github/workflows/run_notebooks.yml
vendored
14
.github/workflows/run_notebooks.yml
vendored
@@ -35,23 +35,15 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install -e libs/core
|
||||
pip install -e libs/langchain
|
||||
pip install -e libs/community
|
||||
pip install --upgrade langchain-experimental
|
||||
pip install -e libs//partners/anthropic
|
||||
pip install -e libs//partners/chroma
|
||||
pip install -e libs//partners/openai
|
||||
pip install -e libs//partners/mistralai
|
||||
pip install jupyter langgraph click pypdf vcrpy
|
||||
poetry install --with dev,test
|
||||
|
||||
- name: Pre-download tiktoken files
|
||||
run: |
|
||||
python docs/scripts/download_tiktoken.py
|
||||
poetry run python docs/scripts/download_tiktoken.py
|
||||
|
||||
- name: Prepare notebooks
|
||||
run: |
|
||||
python docs/scripts/prepare_notebooks_for_ci.py --comment-install-cells
|
||||
poetry run python docs/scripts/prepare_notebooks_for_ci.py --comment-install-cells --working-directory ${{ github.event.inputs.working-directory || 'all' }}
|
||||
|
||||
- name: Run notebooks
|
||||
env:
|
||||
|
||||
@@ -38,7 +38,7 @@ conda install langchain -c conda-forge
|
||||
|
||||
For these applications, LangChain simplifies the entire application lifecycle:
|
||||
|
||||
- **Open-source libraries**: Build your applications using LangChain's open-source [building blocks](https://python.langchain.com/docs/concepts/#langchain-expression-language-lcel), [components](https://python.langchain.com/docs/concepts/), and [third-party integrations](https://python.langchain.com/docs/integrations/platforms/).
|
||||
- **Open-source libraries**: Build your applications using LangChain's open-source [building blocks](https://python.langchain.com/docs/concepts/#langchain-expression-language-lcel), [components](https://python.langchain.com/docs/concepts/), and [third-party integrations](https://python.langchain.com/docs/integrations/providers/).
|
||||
Use [LangGraph](https://langchain-ai.github.io/langgraph/) to build stateful agents with first-class streaming and human-in-the-loop support.
|
||||
- **Productionization**: Inspect, monitor, and evaluate your apps with [LangSmith](https://docs.smith.langchain.com/) so that you can constantly optimize and deploy with confidence.
|
||||
- **Deployment**: Turn your LangGraph applications into production-ready APIs and Assistants with [LangGraph Cloud](https://langchain-ai.github.io/langgraph/cloud/).
|
||||
@@ -119,7 +119,7 @@ Agents allow an LLM autonomy over how a task is accomplished. Agents make decisi
|
||||
Please see [here](https://python.langchain.com) for full documentation, which includes:
|
||||
|
||||
- [Introduction](https://python.langchain.com/docs/introduction/): Overview of the framework and the structure of the docs.
|
||||
- [Tutorials](https://python.langchain.com/docs/use_cases/): If you're looking to build something specific or are more of a hands-on learner, check out our tutorials. This is the best place to get started.
|
||||
- [Tutorials](https://python.langchain.com/docs/tutorials/): If you're looking to build something specific or are more of a hands-on learner, check out our tutorials. This is the best place to get started.
|
||||
- [How-to guides](https://python.langchain.com/docs/how_to/): Answers to “How do I….?” type questions. These guides are goal-oriented and concrete; they're meant to help you complete a specific task.
|
||||
- [Conceptual guide](https://python.langchain.com/docs/concepts/): Conceptual explanations of the key parts of the framework.
|
||||
- [API Reference](https://api.python.langchain.com): Thorough documentation of every class and method.
|
||||
|
||||
@@ -18,7 +18,7 @@ for dir; do \
|
||||
if find "$$dir" -maxdepth 1 -type f \( -name "pyproject.toml" -o -name "setup.py" \) | grep -q .; then \
|
||||
echo "$$dir"; \
|
||||
fi \
|
||||
done' sh {} + | grep -vE "airbyte|ibm|couchbase|databricks" | tr '\n' ' ')
|
||||
done' sh {} + | grep -vE "airbyte|ibm|databricks" | tr '\n' ' ')
|
||||
|
||||
PORT ?= 3001
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
docs/cassettes/agent_executor_114ba50d.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_114ba50d.msgpack.zlib
Normal file
@@ -0,0 +1 @@
|
||||
eNrlV09z28YVb6c3nXLpfY3JKUNAAAiRoDSaDkUptqJItCXFlpzRcJaLBQETwMK7C4qkR4e4/QK49dZpLZMdjeokY0+bpnXPPfQLKId+iH6CvgUhi4o8k8zklJEO0P5577fv/3t8Ph1QLkKW/PI8TCTlmEjYiPz5lNOnGRXyd5OYyoB5p/fbe/svMh5efBRImYrlxUWchgZLaYJDg7B4cWAtkgDLRVinES1gTrvMG333qz8802IqBO5RoS2jz59phMFbiYSNdsgyhDlFGAU0Sv0sQliIUEgM1xWkcRZRRSZGQtJYO6mga9xBeGeeKhOUaydHcBIzj0bqqJdK3VE0Cews+C8kpziGjeQZhT3ApqC3zLiCMI26OmMsKkWVo7SA9rOkMI2CerdeBmkSHBcEEg/CaNQRFHMSdDgVWSRF54mYsXhUEB6mJZfWRDM6RJNemFDE4CYOx9RDPuNIWZDTgCYiHICImJAMBFSrxFNigyk8VL5goM8EVWZTjMfAg0Zg0YQChWTAII4pR4UnlUMQ7rJMIsDjYEFEB/AFiM0khVMRsCzyUFc5oxQPG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DvfXqcBO8+BWHYsvrlJUAKcWo1YnA8v6fXQyy8+hE0HV52GT2zXIth3rTqpOtitNahXX6Jmo+Hjv6vqSABHuTJlHFxNoRGGcpRfVGI8VCVntWotVWug6QrUWBJlHt3LuutM6SBWEDTliGHvy9bHeguTgOp7RTjm0/XDneb2ZuuvB/p8XOntdDZMTRMmktD3J3uUg1vyMxKxzIPayekEsHabh/kb16tafrVuYRfbrk/r+lp7b4ojEHJA8tdBdVVbdpyqtoJivOrWHNMsZqsvJrOS/93C7z0sseodIVR8TQ1iBMYwvbnZS+7SsajbGzsu6UdbVnjYfFLbsb1d09Mql21gxmFcjW5GEd1AQCAbpOoi7xK3VrmcrmbDlW7WrCpQzka0jg/iUJ6CVACbZFEEGAELiWpyME+FiUeH2rJZgSYXSawtPyunN21u7rsa8TTYcJhvBI5maCcVLWI9CPuuuISHF0OhRi6shq0Z1dHJwsLP1yJX6t+jUcS0W6b0ndumMLrHjm+dzgQnt07nzVun8ayq3zq14UfgrdNZMg+PbpvWv7kVCv+wjpqQLNXmtPx8vb2zcbSw8H/cixps
|
||||
1
docs/cassettes/agent_executor_1f5932b6.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_1f5932b6.msgpack.zlib
Normal file
@@ -0,0 +1 @@
|
||||
eNrlV01v48YZbtHb9tJL7rNEgQCFSJMSJZE2jECWnazi2Nq1HK+9gSGMyKHIiORwZ4b68MKHbnvshT+hXa8UGO4mwS7aNO323EP/gHPoj+gv6DsUFcvxAi2QUyEfaA7nnWfej+f90PPZkDAe0PinV0EsCMOOgAXPns8YeZoSLn47jYjwqXvxsN05fJGy4PpXvhAJX19bw0mg0YTEONAcGq0NjTXHx2IN3pOQ5DAXPepOvvvZ7JkSEc5xn3BlHX32THEo3BULWCgnNEWYEYSRT8LES0OEOQ+4wLBdQgqjIZFifMIFiZTzErp12g/uo9b7EerR3rJ0yglTzk/hS0RdEspP/USoppSJYWXAfy4YwREsBEsJrAE+AftFyiSErtXlN0rDQmUxSXJoL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5vvZP9byX4IrbQH2pNKxgnlRC3UzK6O1YN5o1Vb26/nqaZS1sdxcJanQvY2T4PR2XjkOqnr+sNRpNtnZiXokdTx3hRHoITIa0AhNeLZi0pFf1XsLIh4CcbrqqGruvHtWJV9JIRWAw7On0W359lFFbz/zV0BQQfQh7KXeXj+vrzPSAT8lTffgJi2bf/t3UILoLpt18vf3pYBPy+BGOWIf3NXoAC4KBsRvxov5NXAza5/CYuua5sWqTvEs4jtVO1K3XZdXLUNy6qVDbvi/EVWRwdwZCgTyiDUBBphICbZdSnCY1lyNitGtVIDSzegxjph6pJO2tum0ga+gaAphxS7XzY/VJvY8YnayemYzbZP9ht7reafjtVlXqntZD5UzWLK48Dzph3CICzZpRPS1IXaycgUsA4aJ9kby60YnqnbGNc8yyN1davdmeEQlBw62Wu/sqmsm2ZF2UAR3rRqpq7nM9avp/OS/93Pf+digWXvCKDiK3Igc2AcUxutPrSzo11Bjf090TiIY7dZjmh7d3TYGSqlRRuYn9BuRjgtZzcIOJANQnaRReLaRmkxXc2HK1WvGRWQnI9qXQ/UISwBrQA2TsMQMHwaOLLJwTwVxC4ZK+t6CZpcKLCy/qyY3pSl+e9m1FNgwWC+4Tico52XlJD2gfY9voCHGwMuRy4sh6251On5vXv/vx65Mf8BCUOqrJjRaAvG+hWz+f7KBfkBHa2czQ6OV87m1spZPO9kK2c2/PBdOZsFdfFk1az+YCUM/u82KlzQRFmy8rPt9v7O6b17/wHa8ni8
|
||||
1
docs/cassettes/agent_executor_3fa4780a.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_3fa4780a.msgpack.zlib
Normal file
File diff suppressed because one or more lines are too long
1
docs/cassettes/agent_executor_550e0c6e.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_550e0c6e.msgpack.zlib
Normal file
@@ -0,0 +1 @@
|
||||
eNrlV09v28gVb4GeAhTopfcJUaDAQqRJkZIpG0Ygy95E67WVxN7EzsIQRuRQ5Irk0DNDSXTgw2b7BfgR2nWkwnCzu0j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qX4QfhsvmsLV2S4Qf/0vns4HjpfG4vncezgWXp3M5ounQ+eykTPlm6SezeUjj84z4qXNBEWfDy063O3vbxnTv/BYvRO3Y=
|
||||
1
docs/cassettes/agent_executor_688b465d.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_688b465d.msgpack.zlib
Normal file
@@ -0,0 +1 @@
|
||||
eNqlVmtsFNcVXnDaEJSGNK2gUisyWaEWAbOemR3vw64T1muTGD/W9hq/iLXMztzdHe/szHge+zBxG9y0/EgbaeKa0KSlSbC9yDg2yA5QwECV4lRqUx5JaOwAjRQUFzUVAlKXJKXpmdk12IE/VfbH7Nx7z/nuud/5zrnTk00iReUlcdEwL2pIYVgNBqrRk1VQp45U7ZnBBNJiEtdfFwg27tYVfmpNTNNktbiwkJF5hyQjkeEdrJQoTJKFbIzRCuFdFpAF0x+WuMx0QXqrPYFUlYki1V6Mbd5qZyXYS9RgYG8Glx+omBZDWAox8KdgvIgFNzxmX4fZFUlAppGuIsXe3Q4zCYlDgjkVlTWcNm1EGJHwr2oKYhIwiDCCimBCQwkZDqTpiolBONzmnCQJ+Ri0jGxhR3TROrOJdeu9GNtqF5mEZaAxSV7IhFTEKGwspCBVFzQ11KHmXDiksgov573sPixnhyExyosIk2AlwXchDotICmZSo6AYElU+CSEyLKtDgOabyGGaoqsaGOZ3cGCbVBTRBcsxBT5YRtIxEYGFJoGDmgKqrBSZTGNMWNI1DPAUIBZDSXgCRKUow6wak3SBw8IIY+bCA0cl4zAPIDMKHBRSr1qnlhVIqaLxKDe07Ky3Lx10Po4ZkCBJcUyXTcQ5ZiEjvBi1d3ebmQQ18QriTO7zoO3zTKVwB2I1MAXb/yM1AiNG1QSvxfLZuUtCgrk4TRJ5EZ4JxlzJ01UN/kHT34FtAANGzNzB6C2TdRb/CcgRBnIEwfKgWpDTI1+BxC+zZ0pfQUAb5E/5ylS2d2djiOEgqIu2B/tjkqoZIwtrdhQUiKCQkMhKHGxgvBbt4uV1GIciAuhyCOpURBbtxlAc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Xm0G6prt9stFlGgNiTrDEWc5baQcFOewmWYEo9LpogrG+nbYO5zn9y0dsPP7vEZv0KhIYaaXr9gxOfN//8o+o1Jxb1SMYS+wuzp5+cfqi1919bdoxEL1zQ2565caXvG+/Vblm2992j3Vfe+usji9f/hlm858C3G+tfPPLmzJPLx3cWXr8qf0btenT53hv/uMR/unL02n0PdPys+/39S1ecW4GePSufbqrdp1Rvi797Rvjhw89Fxvjztp++9d4740fvT/079cbl1Y86DzStnd15YnSJ7YPT53Xx+auPVW/xHCpfOrtLmey/ec/Tf3mxuOfSxOy2VR+8XNDXd6Ihu7aPLMVa4g0Vk9pkVv37xJGvG+Tl8is/Gv7+qVVTb1R980+nPu0N/XLZJ6/NpJ6/+EJN2UsbG9/fufLiZG8gYlvdSJ9ff2X64+CpS++49I/Xfuupw9ebO2xPOEaX7qhr7tn+um34auCkeHzynnN71sy0LP4PWro5+fLXjvWeOGus/mdf+4dtz93wffKdC13HZ6dn0sEMNXNs14dvJusmPxoYk/4b/Fvn7orPD6+8VnPzJlm+4uDkvXuX9U6enXr1fn7f8daOqfqnftxwUiwo0b73299vKfjVyjj13fOnq5wP9L+0KXYwYEwr5+q314/+If725oey1OuXmtecab3v5sV7HWd/sePX7Ze1I0NnyM+W2WxffFFge3p2+/VXCmy2/wE4OX83
|
||||
1
docs/cassettes/agent_executor_77c2f769.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_77c2f769.msgpack.zlib
Normal file
@@ -0,0 +1 @@
|
||||
eNrtHctu3Na1QYEuDBRoFwW6vB20UBKIHL7mJcMoRiPZUWRZtiVLfsggOOTlDD18mZechwwBbfrYD7rptrUsFYbrJEiQpmndRVdd9AecRRf9hK676LmXpIZja2Ln0TYeMnDk4X2ce97n8pzj0TvHfRwQy3Nfe2S5IQ40PYQH8qt3jgN8N8Ik/PmRg8OuZxxe3tzavh8F1tM3u2Hok6VyWfMt3vOxq1m87jnlvljWu1pYhs++jRmYw7ZnjD795of3Sg4mROtgUlpCt+6VdA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/w2cBJ6/mm/B/w/5izgpg==
|
||||
1
docs/cassettes/agent_executor_9c9ce713.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_9c9ce713.msgpack.zlib
Normal file
File diff suppressed because one or more lines are too long
1
docs/cassettes/agent_executor_ae627966.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_ae627966.msgpack.zlib
Normal file
@@ -0,0 +1 @@
|
||||
eNrlV91u28gV7gK9CrBAb3o/YQssUIg0KVF/NoxAlp1E69hKIm9ie2EII3IoMiI5zMxQf4EvmvYF+AjddaSF4WZ3kaDdbpte96Iv4L3oQ/QJeoak1nIcoAX2qpAvaA7nnG/OzzfnHL2cDwnjHg0/uvBCQRi2BCx48nLOyPOYcPH7WUCES+2zh+3OwZcx8y5/4woR8fW1NRx5Go1IiD3NosHa0FizXCzW4D3ySQpz1qP25Ief/+qFEhDOcZ9wZR19/kKxKJwVClgoRzRGmBGEkUv8yIl9hDn3uMCwXUAKoz6RYnzCBQmU0wK6pu16t1HrkwD1aG9ZOuaE3ZC9T3yfoi3au43u0xGycIha+WFoAlYIauPJnWWYK0vexxqBo59wFExQiANy5+bZJ/AloDbx5ad+JFRTyoSwMuA/F4zgABaCxQTW4FoEsRcxkxC6VpXfKPXzcIlJlEI7cZimR0L9+L4OlkkjpIDAQ8+fdDnBzHK7jPDYF7z7jGcqNuEW86JcS2mgTA6RsO+FBFHYCbwpsZFDGZJZZMQlIfeGYCK2rBgMlG+hLc2GdNgoP0FDn3EiUycVR6CTxjMkICEoKPARYShlkyQFwj0aCwR4DKKJyBCeANEKI/jKXRr7NupJQuTmgSKbaNKBCDNwFFjKU68jBuxjwiPZMpVL395zdBlHGuRTOkBxJBEXkYWEeGFfOT2ViQTie4zYMvY56MmSKO09IxYw4jTlxP+cGh+HfR54ws2z84GEdDI7ZRC9EJ4Bljt5uB6Afkfqa+guCOBwciOiP4oU0vgHkCMEbETC9TiSdLr9E4L4fvTAREg/hA3yx35yKE9O5y7BNhj1r5/94sylXCSvr5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ZDim7pi9olFzSFXdanfm2Acjh1byxi1tKuumWVI2UIA3axVT19MB77ezrOb/8HFsY4Fl8/Cg5CtyGrRgFlQbrT50pgejfmsUNw8ePbsXuXeP2fE03u47baWw6AOZhnY1P2opu0HAgtsgZBtZ3Nx6sbAYr7LpStUrRgkkszmx64A5hEVgFcCGse8Dhks9S3Y5GKi80CZjZV0vQJfzBVbWX+Tj29LIV7ia9xRYMBhwOPYztNOC4tM+0L7HF/BwosflzIXltJVJnZzeuvX/G5Er92FGl+P0SvmcDvYr57THV85l+EG4aj5rK5dk+MG/cj5bOFw5n1sr53E2sKyc2xMar5zPTsyES1ZuEruzEg7/dx8VLmikLHn5+XZ7f+fk1q3/ABRjSX4=
|
||||
1
docs/cassettes/agent_executor_af83d3e3.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_af83d3e3.msgpack.zlib
Normal file
@@ -0,0 +1 @@
|
||||
eNrtVs1u20YQRoA+CLHoqRAlkvpnkYNhBAnQGg4Qt0ARBIsVOSS3JneZ3aVlxdAhbq49sE/Q1oYVGEnbQ9FLG7THHvoC7r3v0VlKyo+jIkZ6CloBgqSdnZlvZr75qOPFASjNpbj2hAsDikUGf+ivjhcK7legzaOzAkwm45ObN/ZOKsUv3s+MKXXY6bCSt3XBTdbOmUijjHHRjmTR4SKRpxMZz35bZMBiDP/o/BMNyt1KQZj6R3u78XPLWcdr+20/GH2/FUVQGveGiGTMRVo/TR/wsuXEkOTMwNnSXP/AyjLnEbMYO59rKc63pRDQYK7P9wFKl+X8AB4r0CWWAV+cacNMpY9PMS788fuiAK1ZCt/ufrQG9+VpjBnqZ3sVtBy/7+xGxgm8oOf4o7AXhL2uc3Nn70kksTvCuGZWwuswnkYsysC1l5TM68dCus3JLxa31u720uBu5bmcujtNQ3X9zQcXzsYL2wpiTMZZrutToyr46dK1HXZou1mfDDzv540hdhVPuai/Xmzlxr1zENUX7ax7nYS9Xpd86BTsetAfB57ntbKuG4w3GM5wYkiNelEd8EgqsbmUW8seYinfba869DGI1GT1SW/UP/mUs/ocB+ykUqY5PLsU48ZhKTW8FKShzUOcmUIO/HntryOyYicJidcetgceaRHsPOBoKRyWXDUzoIYXQEJR5XmLTJiJMor+SF6KE0l4SsIjUqFHUeWGl0wZCiIuJRKehLa9LaIjlgOtSnpf8wdAMX+agiKhb1v0wipMphCspjlHAqN5sDbGciqogKI0sxfePbTacOvbTaznB3QyM6BJGHjjod8PvHmLcIF0FRFQZH2qLWxcGVxKA5RxivuoZgidTXKI18ilSmmEoJo+xFyvjAlyx9aVySk1JqcVXzsY3HGskIOicbXqX8xmTbZcitTuDwboNWAzqczqwO8hQA1MYXcvYZhKta9LG1ZHsgRqMXFxwJvy1ki6VBupcPde9Z7P/1lqdt8kNfjGU93JpnimwR92ML1g3E0qsRQyl1nR6VgR0eZ/Vfqvq9KpH/j/Vpbe+/WILIlHkXQZShPzB/0+DmfiDVgyicf92B/2euMk8Lv+IBj74A2DQeJ34yhhyXjsRZEX+yNvNGTxYDRmfRS1ggmeIEXtFnJcjbvkOdPRWiqJyqLxG54Y/NjGj9vN4R5qjiUjuYfKGOGa4oYjGxAVzh0RVxFuHXrsT5laSsqKbPj97pVy3ZlpA8XO0uttky6jvqm61a0Weds0Zu0Rks9k5TAFDnMyyMukyh2mNbf6ahNwUVaGHjDFrRbZXmCOtTdNpCqw9pAk7nLoFhs+N5D7L/scze2rdaUurvqnb+eok5nMkVpXL0uWdqlZvhbcNQYqWNH4YQ6acSuwM3JVRLcqJN07N9ajZnLzjSNcHpF3Y5Kr5+LlUTbPK3yOKvs3pmQxjvPexlpfu9h6lQatdTewLgKHDBuy5Pn8b285bDI=
|
||||
1
docs/cassettes/agent_executor_b6a7e925.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_b6a7e925.msgpack.zlib
Normal file
@@ -0,0 +1 @@
|
||||
eNqlVn1sG+UZd+mQAE0VTAy0Tduu3oeq4jvf2Wf7nCxDjuPSNM13SJNAcM93r+2r7yv3vufYCZEgoEpogurKKv6YQ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/j+Lb/oTk2fvXT7f6gfLKXGNh+vfPzcm45IT9/k+/bZ5Q+7b8xu3fpo15dnDn209/U//+3Ca4vnNv1O3/TO6YnIT2qn/r4c/PVvJp69sDv8zRNb2Bd2vLK7773/vn45cOb6uTMX750988jKckvgtw+9ER+u7n83uCQ9NXsnIHn58kbfzsdeOXD/dT7f/wBEhTET
|
||||
1
docs/cassettes/agent_executor_c4073e35.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_c4073e35.msgpack.zlib
Normal file
@@ -0,0 +1 @@
|
||||
eNrlV89u28gZb9Fb0EMvvU+IngqRJiVKomwYhSw7G8drK7G8iZ2FIYyGQ5ErksPMDCXRgQ/N7gvwEdo4cmG43l0kaLfbpuce+gLeQx+iT9BvKGktrwO0wJ4K+UBzON//7/f90avzIeUiYPFPL4NYUo6JhIPIX51z+iKlQn4xiaj0mXv2uN05eJ3y4PrXvpSJWF1ZwUlgsITGODAIi1aG1grxsVyB9ySkhZizHnOz73529VKLqBC4T4W2ij59qREGumIJB+2IpQhzijDyaZh4aYiwEIGQGK5LSOMspIpMZELSSDstoVvcfnAfRRmKcURRIFCP9RaZUkG5dnoMXyLm0lB96idStxVNDCcL/gvJKY7gIHlK4QxaEgiDTLkSYRp19Y2xcGa5zJJCtJfGRaSUqO/fV8E4ZYoikHgYhFlXUMyJ3+VUpKEU3c/ElMWlgvAgmXFpTTSlQzTuBzFFDG6i4IS6yGMcqYBy6tNYBEMwEROSgoHqLXaV2RAZF800GOgTQVUUFeMIeFAGAY4pUEgGDGJEOSoSq/KDcI+lEoE8DgFFdAhPELEdJ/BV+CwNXdRTuZmZB4w8M5QDCebgKABGFF4nHIDAZUCnx4KuePuBo4tylEEhYwOUJkriPLKQkCDua6enKpGAwYBTV8V+JvR4gZT1PqNEAmkBi/85NSGO+yIKpD/LzgcS0pnaqYIYxPCMsLqZhetj4O8ofgM9AAIcZ3ci+j1JqYh/BDlCgEYkfUCpgtP9HxHEH0YPTIT0Q9ggf/xHh/L49N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Ev+QUJWepC8+R0ArL2m0f5O8etWF7FIybBZcejdX2j3TnHIRg5JPlbv7Kurdp2RVtDEV53arZpFrvWbyfTnv/dz09dLLEaHgG0fE0tZgTWMr253Y/dTpDWB2lWblqPnAdmNjraq+PDo/G+VprPgSmHcbPKGQW8gYBAOUg1RuaV6zRK8/Vqul3pZs2qAOV0Zet6YA7lCVgFYuM0DEGGzwKiphwsVEHs0rG2apZgyoUSa6svZ+ubtrAH3qx8Ghw4LDgCh1NppyUtZH3AfU/MxYPGQKidC6tta0p1fHrv3v9vRG7cf0jDkGlL5nRp2RxGG/BDZsl8vr90SX7IRkvnM8Hx0vm8vXQeT0f30rkNP/WXzmfJXJwtm9e/WQqH/7uPmpAs0Ra8/HSzvbd1fO/efwCXssYa
|
||||
1
docs/cassettes/agent_executor_c96c960b.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_c96c960b.msgpack.zlib
Normal file
@@ -0,0 +1 @@
|
||||
eNqdVX1sE2UY7xhEE40fASVGEroqRHDX3l2v7XWjIVtXYIytbN1Xx5bmeve2PXpfu4+uHYIyvmKQmDMgGKM4V9plzvGxReZgfIhDRI1GEBiGjwTRSDTGv4yo4HtdJ1vgL/tH7573ed7n6/f8nuvKJoCssKJQ0M8KKpApWoWCondlZdCuAUXdnOGBGhOZ9Gp/oL5Hk9nxxTFVlZQSm42SWKsoAYFirbTI2xKYjY5Rqg2+SxzIuUmHRSY13r7OwgNFoaJAsZSY16yz0CIMJahQsMTYIkux2SKLHDBETQGyZX0bPOFFBnDGUVRSEcKwEaCEwaeiyoDioRChOAXAAxXwEsxc1WTDB2p1rc/GAMXAul5Px0RF1QemZ7qfomkAvQKBFhlWiOofRjtZqdjMgAhHqaAPpieAXB/0vjgAEkJxbAJkJm7pByhJ4liaMvS2tYoo9OfLQdSUBO5X9xk1IbB4QdWH/DCJskrb6hRsqWDGrARpRQ8kEUWlWIGDPUI4CuaTkXL6I1MVEkXHoRMkD5eembg8MNVGVPR91RTtD0xzScl0TN9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bP5tydiFn9JddzZvrdpye3fr7RkNW+YNvjL7hu9Sb3fD1dFD3UUN8u/U6WvJxD+zTehbgzP39A4/pfX8+PPIeXbDtaXrjz/9te3IWMnV0eO/Vh/d9T0B7Mu/iWz/5E7txa5by7p3pR9aM3QGGTn/wrHg1tp5tnLx/M4euXn80p9XlrRWHH6uVp8Ta54xv8B04vWlba53bry74Hpq//nYozZ9wWdVpv4FN+ec3qGflvlxDp/Fbr98sa27Tp314u0ZJx39lOm97GPFN4++vGTWmuKSU23UlUWOW9vo2T5w7tvTr92ptaXfzJxt+WHr0Lrvmtfu6Xi84ER27/Bfrpnxlr5n3w5e7k5s/KJoR/UHnj+KgwML3Z172s6clYdaFyuHbAuHe9G9Z1DymV/+/rzqyVNS3e7oopN7Pl0lFl8IFmmv8udW3i3coG+7Ptdkunu30DT2iPBScobJ9C/lF2Dr
|
||||
1
docs/cassettes/agent_executor_dae53ec6.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_dae53ec6.msgpack.zlib
Normal file
File diff suppressed because one or more lines are too long
1
docs/cassettes/agent_executor_e593bbf6.msgpack.zlib
Normal file
1
docs/cassettes/agent_executor_e593bbf6.msgpack.zlib
Normal file
@@ -0,0 +1 @@
|
||||
eNqFVktv20YQRi75HQtd1KYSxZeeQREocpwUsaU0UmAUQUFsyJG0Fblkdpd6xPCh6eOuv9C4dhGkrU+95eJTD/0F+TWdJUVZzqMFJIj77ezszPfNDPXyfA5CspjfeMO4AkF9hQu5fnku4HkKUv14FoGaxsHpo8Fw9CoV7O1UqUR2ajWaMEPROQtXhh9HNQlU+NPTZ3Gwenfj5nEJt70ZrEodUlLzcFVVo716szt8PLsHd9Png29ay6D+8KGC5dA1D2f9ZqlCSnijyE4splQRJomaAlkAxR9BGCfDfW0V0aUnQKahkmhrI5Lf7QWQqKk+ToM55T4E2ppxP0wD8II4oozrE0+/RRiWH4ULa8rlAgSiYxpK2NkQdOH5MVLF1Ud2WUQnIIuNk/Mp0AD5/fn1Ewmi2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Ntnt5cXQvhDkidaRxrAzS7xooxeXFvoEyXV70DGIY+Egj8mhvlA1wCyXJWrCRXIG2mYPEIPubhMkeJpFK/QcC0W6Qx4yMPQYZp8IHmfv+FJO3r09TcpeuSFcArZBe9zaxLXIf/5EAeRAnCR7qzvEVM1RxQuq3yaHmTMBKm5K203adar1u4kYvjiKkUN4hXxcz/8517c1Gu2F9TPt8+GcvRE8Pt1IHOayf/AtKkges
|
||||
1
docs/cassettes/assign_5.msgpack.zlib
Normal file
1
docs/cassettes/assign_5.msgpack.zlib
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
eNqdVntQFPcdB8HKxNqQZDo2sY/NNTEJsMfu3cLdQa6KhzyFAw5Pnr38bvd3dwt3u+s+7gFzfSCxKcmksybRpo5xgsAhIhLxhUE6dbQx0bGx1WRwEhxjoq1NGlPb2s4kob9dDoXR/tOdm9vd3+/zfX++3992JcJQlFieSx1mORmKgJbRi6R2JUS4UYGS3D0QgnKAZ/pqnK76XYrITmUFZFmQCnJzgcAaeQFygDXSfCg3TObSASDnomchCHU1fV6eiV1ctKzTEIKSBPxQMhRgzZ0Gmke2OBm9GDYgkSckTA5ALAIBuokYy2GukhysutGBAY7B1hWtMuRgBpEPQk1AkaBoiLeilRDPwKC25BdknOLxEMuxGpJDayS6S7IIQQi9+EBQgmhBhiEBhSgroqaJMFq0NZ4PJr2SY4JuwadwehY0XbefC7BOAwdCOsAPZQ+tiCIKwZN0WsMyUKJFVkjCDaVQ1sNKIueHBzA/G4YcFuRpMGdJACJSj0og6bbmnOG9bZCWdYCIki3KLJwF3Jadj0Yhs5z/Hs7Ua46wckzPqCQDGeUDGv1GzAU4rEQEHM1KNJ+DOYoMcSStcKz8PxRDTtFy2mygYVBiFUnPEgigEAMQCbXGNXmNPKwIGR1421O0F2+NJwIQMCjMX/UFeElWRxbSaB+gaYjqCTmaZ5BJda+/gxVyMAb6gsjrIUQdDuolUYfaIRRwEESpHJiVUkeBIATZWXO5bRLPDS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/kbecOV5P3Pi9Q1/vdQu3Ax7RuEHqbPcxdGNBz9b/KTtvnC6Zs+vKn7YAs9v/fzT75xqPVR58h8/Hdm8o3D3hTHnkbbR4M2vtx0e+rlyPUG9f63iRvi9j9TtShIdm/+jNLI9/X4/1uTmzXVlWx46CxbvKiv7LxN30us=
|
||||
File diff suppressed because it is too large
Load Diff
@@ -713,7 +713,7 @@ Callback handlers can either be `sync` or `async`:
|
||||
* Sync callback handlers implement the [BaseCallbackHandler](https://python.langchain.com/api_reference/core/callbacks/langchain_core.callbacks.base.BaseCallbackHandler.html) interface.
|
||||
* Async callback handlers implement the [AsyncCallbackHandler](https://python.langchain.com/api_reference/core/callbacks/langchain_core.callbacks.base.AsyncCallbackHandler.html) interface.
|
||||
|
||||
During run-time LangChain configures an appropriate callback manager (e.g., [CallbackManager](https://python.langchain.com/api_reference/core/callbacks/langchain_core.callbacks.manager.CallbackManager.html) or [AsyncCallbackManager](https://python.langchain.com/api_reference/core/callbacks/langchain_core.callbacks.manager.AsyncCallbackManager.html) which will be responsible for calling the appropriate method on each "registered" callback handler when the event is triggered.
|
||||
During run-time LangChain configures an appropriate callback manager (e.g., [CallbackManager](https://python.langchain.com/api_reference/core/callbacks/langchain_core.callbacks.manager.CallbackManager.html) or [AsyncCallbackManager](https://python.langchain.com/api_reference/core/callbacks/langchain_core.callbacks.manager.AsyncCallbackManager.html)) which will be responsible for calling the appropriate method on each "registered" callback handler when the event is triggered.
|
||||
|
||||
#### Passing callbacks
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"\n",
|
||||
"## Dependencies\n",
|
||||
"\n",
|
||||
"**Note**: this guide requires `langchain-core` >= 0.2.13. We will also use [OpenAI](/docs/integrations/platforms/openai/) for embeddings, but any LangChain embeddings should suffice. We will use a simple [LangGraph](https://langchain-ai.github.io/langgraph/) agent for demonstration purposes."
|
||||
"**Note**: this guide requires `langchain-core` >= 0.2.13. We will also use [OpenAI](/docs/integrations/providers/openai/) for embeddings, but any LangChain embeddings should suffice. We will use a simple [LangGraph](https://langchain-ai.github.io/langgraph/) agent for demonstration purposes."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"2. LangChain [Runnables](/docs/concepts#runnable-interface);\n",
|
||||
"3. By sub-classing from [BaseTool](https://python.langchain.com/api_reference/core/tools/langchain_core.tools.BaseTool.html) -- This is the most flexible method, it provides the largest degree of control, at the expense of more effort and code.\n",
|
||||
"\n",
|
||||
"Creating tools from functions may be sufficient for most use cases, and can be done via a simple [@tool decorator](https://python.langchain.com/api_reference/core/tools/langchain_core.tools.tool.html#langchain_core.tools.tool). If more configuration is needed-- e.g., specification of both sync and async implementations-- one can also use the [StructuredTool.from_function](https://python.langchain.com/api_reference/core/tools/langchain_core.tools.StructuredTool.html#langchain_core.tools.StructuredTool.from_function) class method.\n",
|
||||
"Creating tools from functions may be sufficient for most use cases, and can be done via a simple [@tool decorator](https://python.langchain.com/api_reference/core/tools/langchain_core.tools.tool.html#langchain_core.tools.tool). If more configuration is needed-- e.g., specification of both sync and async implementations-- one can also use the [StructuredTool.from_function](https://python.langchain.com/api_reference/core/tools/langchain_core.tools.structured.StructuredTool.html#langchain_core.tools.structured.StructuredTool.from_function) class method.\n",
|
||||
"\n",
|
||||
"In this guide we provide an overview of these methods.\n",
|
||||
"\n",
|
||||
|
||||
@@ -50,7 +50,7 @@ pip install langchain-core
|
||||
### Integration packages
|
||||
|
||||
Certain integrations like OpenAI and Anthropic have their own packages.
|
||||
Any integrations that require their own package will be documented as such in the [Integration docs](/docs/integrations/platforms/).
|
||||
Any integrations that require their own package will be documented as such in the [Integration docs](/docs/integrations/providers/).
|
||||
You can see a list of all integration packages in the [API reference](https://api.python.langchain.com) under the "Partner libs" dropdown.
|
||||
To install one of these run:
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@
|
||||
"### Integration details\n",
|
||||
"| Class | Package | Local | Serializable | [JS support](https://js.langchain.com/docs/integrations/chat/openai) | Package downloads | Package latest |\n",
|
||||
"| :--- | :--- | :---: | :---: | :---: | :---: | :---: |\n",
|
||||
"| ChatWatsonx | ❌ | ❌ | ❌ |  |  |\n",
|
||||
"| ChatWatsonx | ❌ | ❌ | ❌ | ❌ |  |  |\n",
|
||||
"\n",
|
||||
"### Model features\n",
|
||||
"| [Tool calling](/docs/how_to/tool_calling/) | [Structured output](/docs/how_to/structured_output/) | JSON mode | Image input | Audio input | Video input | [Token-level streaming](/docs/how_to/chat_streaming/) | Native async | [Token usage](/docs/how_to/chat_token_usage_tracking/) | [Logprobs](/docs/how_to/logprobs/) |\n",
|
||||
"| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |\n",
|
||||
"| ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ | "
|
||||
"| ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ❌ | ✅ | ✅ | "
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -126,21 +126,19 @@
|
||||
"source": [
|
||||
"## Instantiation\n",
|
||||
"\n",
|
||||
"You might need to adjust model `parameters` for different models or tasks. For details, refer to [Available MetaNames](https://ibm.github.io/watsonx-ai-python-sdk/fm_model.html#metanames.GenTextParamsMetaNames)."
|
||||
"You might need to adjust model `parameters` for different models or tasks. For details, refer to [Available TextChatParameters](https://ibm.github.io/watsonx-ai-python-sdk/fm_schema.html#ibm_watsonx_ai.foundation_models.schema.TextChatParameters)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 5,
|
||||
"id": "407cd500",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"parameters = {\n",
|
||||
" \"decoding_method\": \"sample\",\n",
|
||||
" \"max_new_tokens\": 100,\n",
|
||||
" \"min_new_tokens\": 1,\n",
|
||||
" \"stop_sequences\": [\".\"],\n",
|
||||
" \"temperature\": 0.9,\n",
|
||||
" \"max_tokens\": 200,\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
@@ -160,20 +158,20 @@
|
||||
"In this example, we’ll use the `project_id` and Dallas URL.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"You need to specify the `model_id` that will be used for inferencing. You can find the list of all the available models in [Supported foundation models](https://ibm.github.io/watsonx-ai-python-sdk/fm_model.html#ibm_watsonx_ai.foundation_models.utils.enums.ModelTypes)."
|
||||
"You need to specify the `model_id` that will be used for inferencing. You can find the list of all the available models in [Supported chat models](https://ibm.github.io/watsonx-ai-python-sdk/fm_helpers.html#ibm_watsonx_ai.foundation_models_manager.FoundationModelsManager.get_chat_model_specs)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "98371396",
|
||||
"id": "e3568e91",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain_ibm import ChatWatsonx\n",
|
||||
"\n",
|
||||
"chat = ChatWatsonx(\n",
|
||||
" model_id=\"ibm/granite-13b-chat-v2\",\n",
|
||||
" model_id=\"ibm/granite-34b-code-instruct\",\n",
|
||||
" url=\"https://us-south.ml.cloud.ibm.com\",\n",
|
||||
" project_id=\"PASTE YOUR PROJECT_ID HERE\",\n",
|
||||
" params=parameters,\n",
|
||||
@@ -196,7 +194,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"chat = ChatWatsonx(\n",
|
||||
" model_id=\"ibm/granite-13b-chat-v2\",\n",
|
||||
" model_id=\"ibm/granite-34b-code-instruct\",\n",
|
||||
" url=\"PASTE YOUR URL HERE\",\n",
|
||||
" username=\"PASTE YOUR USERNAME HERE\",\n",
|
||||
" password=\"PASTE YOUR PASSWORD HERE\",\n",
|
||||
@@ -242,17 +240,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": 8,
|
||||
"id": "beea2b5b",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"AIMessage(content=\"Je t'aime pour écouter la Rock.\", response_metadata={'token_usage': {'generated_token_count': 12, 'input_token_count': 28}, 'model_name': 'ibm/granite-13b-chat-v2', 'system_fingerprint': '', 'finish_reason': 'stop_sequence'}, id='run-05b305ce-5401-4a10-b557-41a4b15c7f6f-0')"
|
||||
"AIMessage(content=\"J'adore que tu escois de écouter de la rock ! \", additional_kwargs={}, response_metadata={'token_usage': {'completion_tokens': 19, 'prompt_tokens': 34, 'total_tokens': 53}, 'model_name': 'ibm/granite-34b-code-instruct', 'system_fingerprint': '', 'finish_reason': 'stop'}, id='chat-ef888fc41f0d4b37903b622250ff7528', usage_metadata={'input_tokens': 34, 'output_tokens': 19, 'total_tokens': 53})"
|
||||
]
|
||||
},
|
||||
"execution_count": 22,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -273,17 +271,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 41,
|
||||
"execution_count": 9,
|
||||
"id": "8ab1a25a",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"AIMessage(content='Sure, I can help you with that! Horses are large, powerful mammals that belong to the family Equidae.', response_metadata={'token_usage': {'generated_token_count': 24, 'input_token_count': 24}, 'model_name': 'ibm/granite-13b-chat-v2', 'system_fingerprint': '', 'finish_reason': 'stop_sequence'}, id='run-391776ff-3b38-4768-91e8-ff64177149e5-0')"
|
||||
"AIMessage(content='horses are quadrupedal mammals that are members of the family Equidae. They are typically farm animals, competing in horse racing and other forms of equine competition. With over 200 breeds, horses are diverse in their physical appearance and behavior. They are intelligent, social animals that are often used for transportation, food, and entertainment.', additional_kwargs={}, response_metadata={'token_usage': {'completion_tokens': 89, 'prompt_tokens': 29, 'total_tokens': 118}, 'model_name': 'ibm/granite-34b-code-instruct', 'system_fingerprint': '', 'finish_reason': 'stop'}, id='chat-9a6e28abb3d448aaa4f83b677a9fd653', usage_metadata={'input_tokens': 29, 'output_tokens': 89, 'total_tokens': 118})"
|
||||
]
|
||||
},
|
||||
"execution_count": 41,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -314,7 +312,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"execution_count": 10,
|
||||
"id": "dd919925",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -338,17 +336,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"execution_count": 11,
|
||||
"id": "68160377",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"AIMessage(content='Ich liebe Python.', response_metadata={'token_usage': {'generated_token_count': 5, 'input_token_count': 23}, 'model_name': 'ibm/granite-13b-chat-v2', 'system_fingerprint': '', 'finish_reason': 'stop_sequence'}, id='run-1b1ccf5d-0e33-46f2-a087-e2a136ba1fb7-0')"
|
||||
"AIMessage(content='Ich liebe Python.', additional_kwargs={}, response_metadata={'token_usage': {'completion_tokens': 7, 'prompt_tokens': 28, 'total_tokens': 35}, 'model_name': 'ibm/granite-34b-code-instruct', 'system_fingerprint': '', 'finish_reason': 'stop'}, id='chat-fef871190b6047a7a3e68c58b3810c33', usage_metadata={'input_tokens': 28, 'output_tokens': 7, 'total_tokens': 35})"
|
||||
]
|
||||
},
|
||||
"execution_count": 18,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -376,7 +374,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 12,
|
||||
"id": "3f63166a",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -384,7 +382,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"The moon is a natural satellite of the Earth, and it has been a source of fascination for humans for centuries."
|
||||
"The Moon is the fifth largest moon in the solar system and the largest relative to its host planet. It is the fifth brightest object in Earth's night sky after the Sun, the stars, the Milky Way, and the Moon itself. It orbits around the Earth at an average distance of 238,855 miles (384,400 kilometers). The Moon's gravity is about one-sixthth of Earth's and thus allows for the formation of tides on Earth. The Moon is thought to have formed around 4.5 billion years ago from debris from a collision between Earth and a Mars-sized body named Theia. The Moon is effectively immutable, with its current characteristics remaining from formation. Aside from Earth, the Moon is the only other natural satellite of Earth. The most widely accepted theory is that it formed from the debris of a collision"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -410,18 +408,18 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 32,
|
||||
"execution_count": 13,
|
||||
"id": "9e948729",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[AIMessage(content='Cats are domestic animals that belong to the Felidae family.', response_metadata={'token_usage': {'generated_token_count': 13, 'input_token_count': 24}, 'model_name': 'ibm/granite-13b-chat-v2', 'system_fingerprint': '', 'finish_reason': 'stop_sequence'}, id='run-71a8bd7a-a1aa-497b-9bdd-a4d6fe1d471a-0'),\n",
|
||||
" AIMessage(content='Dogs are domesticated mammals of the family Canidae, characterized by their adaptability to various environments and social structures.', response_metadata={'token_usage': {'generated_token_count': 24, 'input_token_count': 24}, 'model_name': 'ibm/granite-13b-chat-v2', 'system_fingerprint': '', 'finish_reason': 'stop_sequence'}, id='run-22b7a0cb-e44a-4b68-9921-872f82dcd82b-0')]"
|
||||
"[AIMessage(content='The cat is a popular domesticated carnivorous mammal that belongs to the family Felidae. Cats arefriendly, intelligent, and independent animals that are well-known for their playful behavior, agility, and ability to hunt prey. cats come in a wide range of breeds, each with their own unique physical and behavioral characteristics. They are kept as pets worldwide due to their affectionate nature and companionship. Cats are important members of the household and are often involved in everything from childcare to entertainment.', additional_kwargs={}, response_metadata={'token_usage': {'completion_tokens': 127, 'prompt_tokens': 28, 'total_tokens': 155}, 'model_name': 'ibm/granite-34b-code-instruct', 'system_fingerprint': '', 'finish_reason': 'stop'}, id='chat-fa452af0a0fa4a668b6a704aecd7d718', usage_metadata={'input_tokens': 28, 'output_tokens': 127, 'total_tokens': 155}),\n",
|
||||
" AIMessage(content='Dogs are domesticated animals that belong to the Canidae family, also known as wolves. They are one of the most popular pets worldwide, known for their loyalty and affection towards their owners. Dogs come in various breeds, each with unique characteristics, and are trained for different purposes such as hunting, herding, or guarding. They require a lot of exercise and mental stimulation to stay healthy and happy, and they need proper training and socialization to be well-behaved. Dogs are also known for their playful and energetic nature, making them great companions for people of all ages.', additional_kwargs={}, response_metadata={'token_usage': {'completion_tokens': 144, 'prompt_tokens': 28, 'total_tokens': 172}, 'model_name': 'ibm/granite-34b-code-instruct', 'system_fingerprint': '', 'finish_reason': 'stop'}, id='chat-cae7663c50cf4f3499726821cc2f0ec7', usage_metadata={'input_tokens': 28, 'output_tokens': 144, 'total_tokens': 172})]"
|
||||
]
|
||||
},
|
||||
"execution_count": 32,
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -452,9 +450,7 @@
|
||||
"\n",
|
||||
"### ChatWatsonx.bind_tools()\n",
|
||||
"\n",
|
||||
"Please note that `ChatWatsonx.bind_tools` is on beta state, so right now we only support `mistralai/mixtral-8x7b-instruct-v01` model.\n",
|
||||
"\n",
|
||||
"You should also redefine `max_new_tokens` parameter to get the entire model response. By default `max_new_tokens` is set to 20."
|
||||
"Please note that `ChatWatsonx.bind_tools` is on beta state, so we recommend using `mistralai/mistral-large` model."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -466,10 +462,8 @@
|
||||
"source": [
|
||||
"from langchain_ibm import ChatWatsonx\n",
|
||||
"\n",
|
||||
"parameters = {\"max_new_tokens\": 200}\n",
|
||||
"\n",
|
||||
"chat = ChatWatsonx(\n",
|
||||
" model_id=\"mistralai/mixtral-8x7b-instruct-v01\",\n",
|
||||
" model_id=\"mistralai/mistral-large\",\n",
|
||||
" url=\"https://us-south.ml.cloud.ibm.com\",\n",
|
||||
" project_id=\"PASTE YOUR PROJECT_ID HERE\",\n",
|
||||
" params=parameters,\n",
|
||||
@@ -478,7 +472,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 2,
|
||||
"id": "e1633a73",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -497,17 +491,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 3,
|
||||
"id": "3bf9b8ab",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"AIMessage(content='', additional_kwargs={'function_call': {'type': 'function'}, 'tool_calls': [{'type': 'function', 'function': {'name': 'GetWeather', 'arguments': '{\"location\": \"Los Angeles\"}'}, 'id': None}, {'type': 'function', 'function': {'name': 'GetWeather', 'arguments': '{\"location\": \"New York\"}'}, 'id': None}]}, response_metadata={'token_usage': {'generated_token_count': 99, 'input_token_count': 320}, 'model_name': 'mistralai/mixtral-8x7b-instruct-v01', 'system_fingerprint': '', 'finish_reason': 'eos_token'}, id='run-38627104-f2ac-4edb-8390-d5425fb65979-0', tool_calls=[{'name': 'GetWeather', 'args': {'location': 'Los Angeles'}, 'id': None}, {'name': 'GetWeather', 'args': {'location': 'New York'}, 'id': None}])"
|
||||
"AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'chatcmpl-tool-6c06a19bbe824d78a322eb193dbde12d', 'type': 'function', 'function': {'name': 'GetWeather', 'arguments': '{\"location\": \"Los Angeles, CA\"}'}}, {'id': 'chatcmpl-tool-493542e46f1141bfbfeb5deae6c9e086', 'type': 'function', 'function': {'name': 'GetWeather', 'arguments': '{\"location\": \"New York, NY\"}'}}]}, response_metadata={'token_usage': {'completion_tokens': 46, 'prompt_tokens': 95, 'total_tokens': 141}, 'model_name': 'mistralai/mistral-large', 'system_fingerprint': '', 'finish_reason': 'tool_calls'}, id='chat-027f2bdb217e4238909cb26d3e8a8fbf', tool_calls=[{'name': 'GetWeather', 'args': {'location': 'Los Angeles, CA'}, 'id': 'chatcmpl-tool-6c06a19bbe824d78a322eb193dbde12d', 'type': 'tool_call'}, {'name': 'GetWeather', 'args': {'location': 'New York, NY'}, 'id': 'chatcmpl-tool-493542e46f1141bfbfeb5deae6c9e086', 'type': 'tool_call'}], usage_metadata={'input_tokens': 95, 'output_tokens': 46, 'total_tokens': 141})"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -530,18 +524,24 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 4,
|
||||
"id": "38f10ba7",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[{'name': 'GetWeather', 'args': {'location': 'Los Angeles'}, 'id': None},\n",
|
||||
" {'name': 'GetWeather', 'args': {'location': 'New York'}, 'id': None}]"
|
||||
"[{'name': 'GetWeather',\n",
|
||||
" 'args': {'location': 'Los Angeles, CA'},\n",
|
||||
" 'id': 'chatcmpl-tool-6c06a19bbe824d78a322eb193dbde12d',\n",
|
||||
" 'type': 'tool_call'},\n",
|
||||
" {'name': 'GetWeather',\n",
|
||||
" 'args': {'location': 'New York, NY'},\n",
|
||||
" 'id': 'chatcmpl-tool-493542e46f1141bfbfeb5deae6c9e086',\n",
|
||||
" 'type': 'tool_call'}]"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -567,7 +567,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.9"
|
||||
"version": "3.10.14"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
460
docs/docs/integrations/chat/oci_data_science.ipynb
Normal file
460
docs/docs/integrations/chat/oci_data_science.ipynb
Normal file
@@ -0,0 +1,460 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "raw",
|
||||
"metadata": {
|
||||
"vscode": {
|
||||
"languageId": "raw"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"---\n",
|
||||
"sidebar_label: ChatOCIModelDeployment\n",
|
||||
"---"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# ChatOCIModelDeployment\n",
|
||||
"\n",
|
||||
"This will help you getting started with OCIModelDeployment [chat models](/docs/concepts/#chat-models). For detailed documentation of all ChatOCIModelDeployment features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/chat_models/langchain_community.chat_models.ChatOCIModelDeployment.html).\n",
|
||||
"\n",
|
||||
"[OCI Data Science](https://docs.oracle.com/en-us/iaas/data-science/using/home.htm) is a fully managed and serverless platform for data science teams to build, train, and manage machine learning models in the Oracle Cloud Infrastructure. You can use [AI Quick Actions](https://blogs.oracle.com/ai-and-datascience/post/ai-quick-actions-in-oci-data-science) to easily deploy LLMs on [OCI Data Science Model Deployment Service](https://docs.oracle.com/en-us/iaas/data-science/using/model-dep-about.htm). You may choose to deploy the model with popular inference frameworks such as vLLM or TGI. By default, the model deployment endpoint mimics the OpenAI API protocol.\n",
|
||||
"\n",
|
||||
"> For the latest updates, examples and experimental features, please see [ADS LangChain Integration](https://accelerated-data-science.readthedocs.io/en/latest/user_guide/large_language_model/langchain_models.html).\n",
|
||||
"\n",
|
||||
"## Overview\n",
|
||||
"### Integration details\n",
|
||||
"\n",
|
||||
"| Class | Package | Local | Serializable | JS support | Package downloads | Package latest |\n",
|
||||
"| :--- | :--- | :---: | :---: | :---: | :---: | :---: |\n",
|
||||
"| [ChatOCIModelDeployment](https://api.python.langchain.com/en/latest/chat_models/langchain_community.chat_models.ChatOCIModelDeployment.html) | [langchain-community](https://api.python.langchain.com/en/latest/community_api_reference.html) | ❌ | beta | ❌ |  |  |\n",
|
||||
"\n",
|
||||
"### Model features\n",
|
||||
"\n",
|
||||
"| [Tool calling](/docs/how_to/tool_calling) | [Structured output](/docs/how_to/structured_output/) | JSON mode | [Image input](/docs/how_to/multimodal_inputs/) | Audio input | Video input | [Token-level streaming](/docs/how_to/chat_streaming/) | Native async | [Token usage](/docs/how_to/chat_token_usage_tracking/) | [Logprobs](/docs/how_to/logprobs/) |\n",
|
||||
"| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |\n",
|
||||
"| depends | depends | depends | depends | depends | depends | ✅ | ✅ | ✅ | ✅ | \n",
|
||||
"\n",
|
||||
"Some model features, including tool calling, structured output, JSON mode and multi-modal inputs, are depending on deployed model.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## Setup\n",
|
||||
"\n",
|
||||
"To use ChatOCIModelDeployment you'll need to deploy a chat model with chat completion endpoint and install the `langchain-community`, `langchain-openai` and `oracle-ads` integration packages.\n",
|
||||
"\n",
|
||||
"You can easily deploy foundation models using the [AI Quick Actions](https://github.com/oracle-samples/oci-data-science-ai-samples/blob/main/ai-quick-actions/model-deployment-tips.md) on OCI Data Science Model deployment. For additional deployment examples, please visit the [Oracle GitHub samples repository](https://github.com/oracle-samples/oci-data-science-ai-samples/tree/main/ai-quick-actions).\n",
|
||||
"\n",
|
||||
"### Policies\n",
|
||||
"Make sure to have the required [policies](https://docs.oracle.com/en-us/iaas/data-science/using/model-dep-policies-auth.htm#model_dep_policies_auth__predict-endpoint) to access the OCI Data Science Model Deployment endpoint.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Credentials\n",
|
||||
"\n",
|
||||
"You can set authentication through Oracle ADS. When you are working in OCI Data Science Notebook Session, you can leverage resource principal to access other OCI resources."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import ads\n",
|
||||
"\n",
|
||||
"# Set authentication through ads\n",
|
||||
"# Use resource principal are operating within a\n",
|
||||
"# OCI service that has resource principal based\n",
|
||||
"# authentication configured\n",
|
||||
"ads.set_auth(\"resource_principal\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Alternatively, you can configure the credentials using the following environment variables. For example, to use API key with specific profile:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"\n",
|
||||
"# Set authentication through environment variables\n",
|
||||
"# Use API Key setup when you are working from a local\n",
|
||||
"# workstation or on platform which does not support\n",
|
||||
"# resource principals.\n",
|
||||
"os.environ[\"OCI_IAM_TYPE\"] = \"api_key\"\n",
|
||||
"os.environ[\"OCI_CONFIG_PROFILE\"] = \"default\"\n",
|
||||
"os.environ[\"OCI_CONFIG_LOCATION\"] = \"~/.oci\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Check out [Oracle ADS docs](https://accelerated-data-science.readthedocs.io/en/latest/user_guide/cli/authentication.html) to see more options."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Installation\n",
|
||||
"\n",
|
||||
"The LangChain OCIModelDeployment integration lives in the `langchain-community` package. The following command will install `langchain-community` and the required dependencies."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%pip install -qU langchain-community langchain-openai oracle-ads"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Instantiation\n",
|
||||
"\n",
|
||||
"You may instantiate the model with the generic `ChatOCIModelDeployment` or framework specific class like `ChatOCIModelDeploymentVLLM`.\n",
|
||||
"\n",
|
||||
"* Using `ChatOCIModelDeployment` when you need a generic entry point for deploying models. You can pass model parameters through `model_kwargs` during the instantiation of this class. This allows for flexibility and ease of configuration without needing to rely on framework-specific details."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain_community.chat_models import ChatOCIModelDeployment\n",
|
||||
"\n",
|
||||
"# Create an instance of OCI Model Deployment Endpoint\n",
|
||||
"# Replace the endpoint uri with your own\n",
|
||||
"# Using generic class as entry point, you will be able\n",
|
||||
"# to pass model parameters through model_kwargs during\n",
|
||||
"# instantiation.\n",
|
||||
"chat = ChatOCIModelDeployment(\n",
|
||||
" endpoint=\"https://modeldeployment.<region>.oci.customer-oci.com/<ocid>/predict\",\n",
|
||||
" streaming=True,\n",
|
||||
" max_retries=1,\n",
|
||||
" model_kwargs={\n",
|
||||
" \"temperature\": 0.2,\n",
|
||||
" \"max_tokens\": 512,\n",
|
||||
" }, # other model params...\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"* Using framework specific class like `ChatOCIModelDeploymentVLLM`: This is suitable when you are working with a specific framework (e.g. `vLLM`) and need to pass model parameters directly through the constructor, streamlining the setup process."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain_community.chat_models import ChatOCIModelDeploymentVLLM\n",
|
||||
"\n",
|
||||
"# Create an instance of OCI Model Deployment Endpoint\n",
|
||||
"# Replace the endpoint uri with your own\n",
|
||||
"# Using framework specific class as entry point, you will\n",
|
||||
"# be able to pass model parameters in constructor.\n",
|
||||
"chat = ChatOCIModelDeploymentVLLM(\n",
|
||||
" endpoint=\"https://modeldeployment.<region>.oci.customer-oci.com/<md_ocid>/predict\",\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Invocation"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"AIMessage(content=\"J'adore programmer.\", response_metadata={'token_usage': {'prompt_tokens': 44, 'total_tokens': 52, 'completion_tokens': 8}, 'model_name': 'odsc-llm', 'system_fingerprint': '', 'finish_reason': 'stop'}, id='run-ca145168-efa9-414c-9dd1-21d10766fdd3-0')"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"messages = [\n",
|
||||
" (\n",
|
||||
" \"system\",\n",
|
||||
" \"You are a helpful assistant that translates English to French. Translate the user sentence.\",\n",
|
||||
" ),\n",
|
||||
" (\"human\", \"I love programming.\"),\n",
|
||||
"]\n",
|
||||
"\n",
|
||||
"ai_msg = chat.invoke(messages)\n",
|
||||
"ai_msg"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\n",
|
||||
"J'adore programmer.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(ai_msg.content)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Chaining"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"AIMessage(content='Ich liebe Programmierung.', response_metadata={'token_usage': {'prompt_tokens': 38, 'total_tokens': 48, 'completion_tokens': 10}, 'model_name': 'odsc-llm', 'system_fingerprint': '', 'finish_reason': 'stop'}, id='run-5dd936b0-b97e-490e-9869-2ad3dd524234-0')"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from langchain_core.prompts import ChatPromptTemplate\n",
|
||||
"\n",
|
||||
"prompt = ChatPromptTemplate.from_messages(\n",
|
||||
" [\n",
|
||||
" (\n",
|
||||
" \"system\",\n",
|
||||
" \"You are a helpful assistant that translates {input_language} to {output_language}.\",\n",
|
||||
" ),\n",
|
||||
" (\"human\", \"{input}\"),\n",
|
||||
" ]\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"chain = prompt | chat\n",
|
||||
"chain.invoke(\n",
|
||||
" {\n",
|
||||
" \"input_language\": \"English\",\n",
|
||||
" \"output_language\": \"German\",\n",
|
||||
" \"input\": \"I love programming.\",\n",
|
||||
" }\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Asynchronous calls"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"AIMessage(content='我喜欢编程', response_metadata={'token_usage': {'prompt_tokens': 37, 'total_tokens': 50, 'completion_tokens': 13}, 'model_name': 'odsc-llm', 'system_fingerprint': '', 'finish_reason': 'stop'}, id='run-a2dc9393-f269-41a4-b908-b1d8a92cf827-0')"
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from langchain_community.chat_models import ChatOCIModelDeployment\n",
|
||||
"\n",
|
||||
"system = \"You are a helpful translator that translates {input_language} to {output_language}.\"\n",
|
||||
"human = \"{text}\"\n",
|
||||
"prompt = ChatPromptTemplate.from_messages([(\"system\", system), (\"human\", human)])\n",
|
||||
"\n",
|
||||
"chat = ChatOCIModelDeployment(\n",
|
||||
" endpoint=\"https://modeldeployment.us-ashburn-1.oci.customer-oci.com/<ocid>/predict\"\n",
|
||||
")\n",
|
||||
"chain = prompt | chat\n",
|
||||
"\n",
|
||||
"await chain.ainvoke(\n",
|
||||
" {\n",
|
||||
" \"input_language\": \"English\",\n",
|
||||
" \"output_language\": \"Chinese\",\n",
|
||||
" \"text\": \"I love programming\",\n",
|
||||
" }\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Streaming calls"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\n",
|
||||
"\n",
|
||||
"1. California\n",
|
||||
"2. Texas\n",
|
||||
"3. Florida\n",
|
||||
"4. New York\n",
|
||||
"5. Illinois"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"from langchain_community.chat_models import ChatOCIModelDeployment\n",
|
||||
"from langchain_core.prompts import ChatPromptTemplate\n",
|
||||
"\n",
|
||||
"prompt = ChatPromptTemplate.from_messages(\n",
|
||||
" [(\"human\", \"List out the 5 states in the United State.\")]\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"chat = ChatOCIModelDeployment(\n",
|
||||
" endpoint=\"https://modeldeployment.us-ashburn-1.oci.customer-oci.com/<ocid>/predict\"\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"chain = prompt | chat\n",
|
||||
"\n",
|
||||
"for chunk in chain.stream({}):\n",
|
||||
" sys.stdout.write(chunk.content)\n",
|
||||
" sys.stdout.flush()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Structured output"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'setup': 'Why did the cat get stuck in the tree?',\n",
|
||||
" 'punchline': 'Because it was chasing its tail!'}"
|
||||
]
|
||||
},
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from langchain_community.chat_models import ChatOCIModelDeployment\n",
|
||||
"from pydantic import BaseModel\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class Joke(BaseModel):\n",
|
||||
" \"\"\"A setup to a joke and the punchline.\"\"\"\n",
|
||||
"\n",
|
||||
" setup: str\n",
|
||||
" punchline: str\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"chat = ChatOCIModelDeployment(\n",
|
||||
" endpoint=\"https://modeldeployment.us-ashburn-1.oci.customer-oci.com/<ocid>/predict\",\n",
|
||||
")\n",
|
||||
"structured_llm = chat.with_structured_output(Joke, method=\"json_mode\")\n",
|
||||
"output = structured_llm.invoke(\n",
|
||||
" \"Tell me a joke about cats, respond in JSON with `setup` and `punchline` keys\"\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"output.dict()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## API reference\n",
|
||||
"\n",
|
||||
"For comprehensive details on all features and configurations, please refer to the API reference documentation for each class:\n",
|
||||
"\n",
|
||||
"* [ChatOCIModelDeployment](https://api.python.langchain.com/en/latest/chat_models/langchain_community.chat_models.oci_data_science.ChatOCIModelDeployment.html)\n",
|
||||
"* [ChatOCIModelDeploymentVLLM](https://api.python.langchain.com/en/latest/chat_models/langchain_community.chat_models.oci_data_science.ChatOCIModelDeploymentVLLM.html)\n",
|
||||
"* [ChatOCIModelDeploymentTGI](https://api.python.langchain.com/en/latest/chat_models/langchain_community.chat_models.oci_data_science.ChatOCIModelDeploymentTGI.html)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "langchain",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.18"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
"source": [
|
||||
"# ChatSambaStudio\n",
|
||||
"\n",
|
||||
"This will help you getting started with SambaNovaCloud [chat models](/docs/concepts/#chat-models). For detailed documentation of all ChatStudio features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/chat_models/langchain_community.chat_models.sambanova.ChatSambaStudio.html).\n",
|
||||
"This will help you getting started with SambaStudio [chat models](/docs/concepts/#chat-models). For detailed documentation of all ChatStudio features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/chat_models/langchain_community.chat_models.sambanova.ChatSambaStudio.html).\n",
|
||||
"\n",
|
||||
"**[SambaNova](https://sambanova.ai/)'s** [SambaStudio](https://docs.sambanova.ai/sambastudio/latest/sambastudio-intro.html) SambaStudio is a rich, GUI-based platform that provides the functionality to train, deploy, and manage models in SambaNova [DataScale](https://sambanova.ai/products/datascale) systems.\n",
|
||||
"\n",
|
||||
|
||||
@@ -26,33 +26,32 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Setup\n",
|
||||
"\n",
|
||||
"### Credentials \n",
|
||||
"\n",
|
||||
"You will need to get your own API key. Go to [this page](https://firecrawl.dev) to learn more."
|
||||
"## Setup"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"scrolled": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import getpass\n",
|
||||
"import os\n",
|
||||
"\n",
|
||||
"if \"FIRECRAWL_API_KEY\" not in os.environ:\n",
|
||||
" os.environ[\"FIRECRAWL_API_KEY\"] = getpass.getpass(\"Enter your Firecrawl API key: \")"
|
||||
"pip install firecrawl-py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Installation\n",
|
||||
"\n",
|
||||
"You will need to install both the `langchain_community` and `firecrawl-py` pacakges:"
|
||||
"## Usage"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"You will need to get your own API key. See https://firecrawl.dev"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -61,42 +60,12 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%pip install -qU firecrawl-py==0.0.20 langchain_community"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Initialization\n",
|
||||
"\n",
|
||||
"### Modes\n",
|
||||
"\n",
|
||||
"- `scrape`: Scrape single url and return the markdown.\n",
|
||||
"- `crawl`: Crawl the url and all accessible sub pages and return the markdown for each one."
|
||||
"from langchain_community.document_loaders.firecrawl import FireCrawlLoader"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain_community.document_loaders import FireCrawlLoader\n",
|
||||
"\n",
|
||||
"loader = FireCrawlLoader(url=\"https://firecrawl.dev\", mode=\"crawl\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Load"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -111,40 +80,14 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"docs = loader.load()\n",
|
||||
"\n",
|
||||
"docs[0]"
|
||||
"loader = FireCrawlLoader(\n",
|
||||
" api_key=\"YOUR_API_KEY\", url=\"https://firecrawl.dev\", mode=\"scrape\"\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{'ogUrl': 'https://www.firecrawl.dev/', 'title': 'Home - Firecrawl', 'robots': 'follow, index', 'ogImage': 'https://www.firecrawl.dev/og.png?123', 'ogTitle': 'Firecrawl', 'sitemap': {'lastmod': '2024-08-12T00:28:16.681Z', 'changefreq': 'weekly'}, 'keywords': 'Firecrawl,Markdown,Data,Mendable,Langchain', 'sourceURL': 'https://www.firecrawl.dev/', 'ogSiteName': 'Firecrawl', 'description': 'Firecrawl crawls and converts any website into clean markdown.', 'ogDescription': 'Turn any website into LLM-ready data.', 'pageStatusCode': 200, 'ogLocaleAlternate': []}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(docs[0].metadata)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Lazy Load\n",
|
||||
"\n",
|
||||
"You can use lazy loading to minimize memory requirements."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -160,39 +103,61 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"8"
|
||||
]
|
||||
},
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"len(pages)"
|
||||
"pages"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Modes\n",
|
||||
"\n",
|
||||
"- `scrape`: Scrape single url and return the markdown.\n",
|
||||
"- `crawl`: Crawl the url and all accessible sub pages and return the markdown for each one.\n",
|
||||
"- `map`: Maps the URL and returns a list of semantically related pages."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Crawl\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Introducing [Smart Crawl!](https://www.firecrawl.dev/smart-crawl)\n",
|
||||
" Join the waitlist to turn any web\n",
|
||||
"{'ogUrl': 'https://www.firecrawl.dev/blog/introducing-fire-engine-for-firecrawl', 'title': 'Introducing Fire Engine for Firecrawl', 'robots': 'follow, index', 'ogImage': 'https://www.firecrawl.dev/images/blog/fire-engine-launch.png', 'ogTitle': 'Introducing Fire Engine for Firecrawl', 'sitemap': {'lastmod': '2024-08-06T00:00:00.000Z', 'changefreq': 'weekly'}, 'keywords': 'firecrawl,fireengine,web crawling,dashboard,web scraping,LLM,data extraction', 'sourceURL': 'https://www.firecrawl.dev/blog/introducing-fire-engine-for-firecrawl', 'ogSiteName': 'Firecrawl', 'description': 'The most scalable, reliable, and fast way to get web data for Firecrawl.', 'ogDescription': 'The most scalable, reliable, and fast way to get web data for Firecrawl.', 'pageStatusCode': 200, 'ogLocaleAlternate': []}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"loader = FireCrawlLoader(\n",
|
||||
" api_key=\"YOUR_API_KEY\",\n",
|
||||
" url=\"https://firecrawl.dev\",\n",
|
||||
" mode=\"crawl\",\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"scrolled": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data = loader.load()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"print(pages[0].page_content[:100])\n",
|
||||
"print(pages[0].metadata)"
|
||||
@@ -202,10 +167,54 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Crawler Options\n",
|
||||
"#### Crawl Options\n",
|
||||
"\n",
|
||||
"You can also pass `params` to the loader. This is a dictionary of options to pass to the crawler. See the [FireCrawl API documentation](https://github.com/mendableai/firecrawl-py) for more information.\n",
|
||||
"\n"
|
||||
"You can also pass `params` to the loader. This is a dictionary of options to pass to the crawler. See the [FireCrawl API documentation](https://github.com/mendableai/firecrawl-py) for more information."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
"### Map"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"loader = FireCrawlLoader(api_key=\"YOUR_API_KEY\", url=\"firecrawl.dev\", mode=\"map\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"docs = loader.load()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"docs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Map Options\n",
|
||||
"\n",
|
||||
"You can also pass `params` to the loader. This is a dictionary of options to pass to the loader. See the [FireCrawl API documentation](https://github.com/mendableai/firecrawl-py) for more information."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -220,7 +229,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "langchain",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
"\n",
|
||||
"[OCI Data Science](https://docs.oracle.com/en-us/iaas/data-science/using/home.htm) is a fully managed and serverless platform for data science teams to build, train, and manage machine learning models in the Oracle Cloud Infrastructure.\n",
|
||||
"\n",
|
||||
"> For the latest updates, examples and experimental features, please see [ADS LangChain Integration](https://accelerated-data-science.readthedocs.io/en/latest/user_guide/large_language_model/langchain_models.html).\n",
|
||||
"\n",
|
||||
"This notebooks goes over how to use an LLM hosted on a [OCI Data Science Model Deployment](https://docs.oracle.com/en-us/iaas/data-science/using/model-dep-about.htm).\n",
|
||||
"\n",
|
||||
"To authenticate, [oracle-ads](https://accelerated-data-science.readthedocs.io/en/latest/user_guide/cli/authentication.html) has been used to automatically load credentials for invoking endpoint."
|
||||
"For authentication, the [oracle-ads](https://accelerated-data-science.readthedocs.io/en/latest/user_guide/cli/authentication.html) library is used to automatically load credentials required for invoking the endpoint."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -29,29 +31,52 @@
|
||||
"## Prerequisite\n",
|
||||
"\n",
|
||||
"### Deploy model\n",
|
||||
"Check [Oracle GitHub samples repository](https://github.com/oracle-samples/oci-data-science-ai-samples/tree/main/model-deployment/containers/llama2) on how to deploy your llm on OCI Data Science Model deployment.\n",
|
||||
"You can easily deploy, fine-tune, and evaluate foundation models using the [AI Quick Actions](https://docs.oracle.com/en-us/iaas/data-science/using/ai-quick-actions.htm) on OCI Data Science Model deployment. For additional deployment examples, please visit the [Oracle GitHub samples repository](https://github.com/oracle-samples/oci-data-science-ai-samples/blob/main/ai-quick-actions/llama3-with-smc.md). \n",
|
||||
"\n",
|
||||
"### Policies\n",
|
||||
"Make sure to have the required [policies](https://docs.oracle.com/en-us/iaas/data-science/using/model-dep-policies-auth.htm#model_dep_policies_auth__predict-endpoint) to access the OCI Data Science Model Deployment endpoint.\n",
|
||||
"\n",
|
||||
"## Set up\n",
|
||||
"\n",
|
||||
"### vLLM\n",
|
||||
"After having deployed model, you have to set up following required parameters of the `OCIModelDeploymentVLLM` call:\n",
|
||||
"After having deployed model, you have to set up following required parameters of the call:\n",
|
||||
"\n",
|
||||
"- **`endpoint`**: The model HTTP endpoint from the deployed model, e.g. `https://<MD_OCID>/predict`. \n",
|
||||
"- **`model`**: The location of the model.\n",
|
||||
"- **`endpoint`**: The model HTTP endpoint from the deployed model, e.g. `https://modeldeployment.<region>.oci.customer-oci.com/<md_ocid>/predict`. \n",
|
||||
"\n",
|
||||
"### Text generation inference (TGI)\n",
|
||||
"You have to set up following required parameters of the `OCIModelDeploymentTGI` call:\n",
|
||||
"\n",
|
||||
"- **`endpoint`**: The model HTTP endpoint from the deployed model, e.g. `https://<MD_OCID>/predict`. \n",
|
||||
"\n",
|
||||
"### Authentication\n",
|
||||
"\n",
|
||||
"You can set authentication through either ads or environment variables. When you are working in OCI Data Science Notebook Session, you can leverage resource principal to access other OCI resources. Check out [here](https://accelerated-data-science.readthedocs.io/en/latest/user_guide/cli/authentication.html) to see more options. \n",
|
||||
"\n",
|
||||
"## Example"
|
||||
"## Examples"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import ads\n",
|
||||
"from langchain_community.llms import OCIModelDeploymentLLM\n",
|
||||
"\n",
|
||||
"# Set authentication through ads\n",
|
||||
"# Use resource principal are operating within a\n",
|
||||
"# OCI service that has resource principal based\n",
|
||||
"# authentication configured\n",
|
||||
"ads.set_auth(\"resource_principal\")\n",
|
||||
"\n",
|
||||
"# Create an instance of OCI Model Deployment Endpoint\n",
|
||||
"# Replace the endpoint uri and model name with your own\n",
|
||||
"# Using generic class as entry point, you will be able\n",
|
||||
"# to pass model parameters through model_kwargs during\n",
|
||||
"# instantiation.\n",
|
||||
"llm = OCIModelDeploymentLLM(\n",
|
||||
" endpoint=\"https://modeldeployment.<region>.oci.customer-oci.com/<md_ocid>/predict\",\n",
|
||||
" model=\"odsc-llm\",\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# Run the LLM\n",
|
||||
"llm.invoke(\"Who is the first president of United States?\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -71,7 +96,11 @@
|
||||
"\n",
|
||||
"# Create an instance of OCI Model Deployment Endpoint\n",
|
||||
"# Replace the endpoint uri and model name with your own\n",
|
||||
"llm = OCIModelDeploymentVLLM(endpoint=\"https://<MD_OCID>/predict\", model=\"model_name\")\n",
|
||||
"# Using framework specific class as entry point, you will\n",
|
||||
"# be able to pass model parameters in constructor.\n",
|
||||
"llm = OCIModelDeploymentVLLM(\n",
|
||||
" endpoint=\"https://modeldeployment.<region>.oci.customer-oci.com/<md_ocid>/predict\",\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# Run the LLM\n",
|
||||
"llm.invoke(\"Who is the first president of United States?\")"
|
||||
@@ -97,14 +126,64 @@
|
||||
"\n",
|
||||
"# Set endpoint through environment variables\n",
|
||||
"# Replace the endpoint uri with your own\n",
|
||||
"os.environ[\"OCI_LLM_ENDPOINT\"] = \"https://<MD_OCID>/predict\"\n",
|
||||
"os.environ[\"OCI_LLM_ENDPOINT\"] = (\n",
|
||||
" \"https://modeldeployment.<region>.oci.customer-oci.com/<md_ocid>/predict\"\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# Create an instance of OCI Model Deployment Endpoint\n",
|
||||
"# Using framework specific class as entry point, you will\n",
|
||||
"# be able to pass model parameters in constructor.\n",
|
||||
"llm = OCIModelDeploymentTGI()\n",
|
||||
"\n",
|
||||
"# Run the LLM\n",
|
||||
"llm.invoke(\"Who is the first president of United States?\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Asynchronous calls"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"await llm.ainvoke(\"Tell me a joke.\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Streaming calls"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for chunk in llm.stream(\"Tell me a joke.\"):\n",
|
||||
" print(chunk, end=\"\", flush=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## API reference\n",
|
||||
"\n",
|
||||
"For comprehensive details on all features and configurations, please refer to the API reference documentation for each class:\n",
|
||||
"\n",
|
||||
"* [OCIModelDeploymentLLM](https://api.python.langchain.com/en/latest/llms/langchain_community.llms.oci_data_science_model_deployment_endpoint.OCIModelDeploymentLLM.html)\n",
|
||||
"* [OCIModelDeploymentVLLM](https://api.python.langchain.com/en/latest/llms/langchain_community.llms.oci_data_science_model_deployment_endpoint.OCIModelDeploymentVLLM.html)\n",
|
||||
"* [OCIModelDeploymentTGI](https://api.python.langchain.com/en/latest/llms/langchain_community.llms.oci_data_science_model_deployment_endpoint.OCIModelDeploymentTGI.html)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
44
docs/docs/integrations/providers/baai.mdx
Normal file
44
docs/docs/integrations/providers/baai.mdx
Normal file
@@ -0,0 +1,44 @@
|
||||
# BAAI
|
||||
|
||||
>[Beijing Academy of Artificial Intelligence (BAAI) (Wikipedia)](https://en.wikipedia.org/wiki/Beijing_Academy_of_Artificial_Intelligence),
|
||||
> also known as `Zhiyuan Institute`, is a Chinese non-profit artificial
|
||||
> intelligence (AI) research laboratory. `BAAI` conducts AI research
|
||||
> and is dedicated to promoting collaboration among academia and industry,
|
||||
> as well as fostering top talent and a focus on long-term research on
|
||||
> the fundamentals of AI technology. As a collaborative hub, BAAI's founding
|
||||
> members include leading AI companies, universities, and research institutes.
|
||||
|
||||
|
||||
## Embedding Models
|
||||
|
||||
### HuggingFaceBgeEmbeddings
|
||||
|
||||
>[BGE models on the HuggingFace](https://huggingface.co/BAAI/bge-large-en-v1.5)
|
||||
> are one of [the best open-source embedding models](https://huggingface.co/spaces/mteb/leaderboard).
|
||||
|
||||
See a [usage example](/docs/integrations/text_embedding/bge_huggingface).
|
||||
|
||||
```python
|
||||
from langchain_community.embeddings import HuggingFaceBgeEmbeddings
|
||||
```
|
||||
|
||||
### IpexLLMBgeEmbeddings
|
||||
|
||||
>[IPEX-LLM](https://github.com/intel-analytics/ipex-llm) is a PyTorch
|
||||
> library for running LLM on Intel CPU and GPU (e.g., local PC with iGPU,
|
||||
> discrete GPU such as Arc, Flex and Max) with very low latency.
|
||||
|
||||
See a [usage example running model on Intel CPU](/docs/integrations/text_embedding/ipex_llm).
|
||||
See a [usage example running model on Intel GPU](/docs/integrations/text_embedding/ipex_llm_gpu).
|
||||
|
||||
```python
|
||||
from langchain_community.embeddings import IpexLLMBgeEmbeddings
|
||||
```
|
||||
|
||||
### QuantizedBgeEmbeddings
|
||||
|
||||
See a [usage example](/docs/integrations/text_embedding/itrex).
|
||||
|
||||
```python
|
||||
from langchain_community.embeddings import QuantizedBgeEmbeddings
|
||||
```
|
||||
@@ -8,15 +8,23 @@ Get the access token.
|
||||
You can find the access instructions [here](https://open.larksuite.com/document)
|
||||
|
||||
|
||||
## Document Loader
|
||||
|
||||
### Lark Suite
|
||||
## Document Loaders
|
||||
|
||||
>[Lark Suite](https://www.larksuite.com/) is an enterprise collaboration platform
|
||||
> developed by `ByteDance`.
|
||||
|
||||
See a [usage example](/docs/integrations/document_loaders/larksuite).
|
||||
### Lark Suite for Document
|
||||
|
||||
See a [usage example](/docs/integrations/document_loaders/larksuite/#load-from-document).
|
||||
|
||||
```python
|
||||
from langchain_community.document_loaders.larksuite import LarkSuiteDocLoader
|
||||
```
|
||||
|
||||
### Lark Suite for Wiki
|
||||
|
||||
See a [usage example](/docs/integrations/document_loaders/larksuite/#load-from-wiki).
|
||||
|
||||
```python
|
||||
from langchain_community.document_loaders.larksuite import LarkSuiteWikiLoader
|
||||
```
|
||||
|
||||
@@ -113,7 +113,7 @@ See [Databricks SQL Agent](https://docs.databricks.com/en/large-language-models/
|
||||
Open Models
|
||||
-----------
|
||||
|
||||
To directly integrate Databricks's open models hosted on HuggingFace, you can use the [HuggingFace Integration](/docs/integrations/platforms/huggingface) of LangChain.
|
||||
To directly integrate Databricks's open models hosted on HuggingFace, you can use the [HuggingFace Integration](/docs/integrations/providers/huggingface) of LangChain.
|
||||
|
||||
```
|
||||
from langchain_huggingface import HuggingFaceEndpoint
|
||||
|
||||
@@ -72,7 +72,7 @@ See a [usage example](/docs/integrations/chat/google_vertex_ai_palm).
|
||||
from langchain_google_vertexai import ChatVertexAI
|
||||
```
|
||||
|
||||
### Chat Anthropic on Vertex AI Model Garden
|
||||
### Anthropic on Vertex AI Model Garden
|
||||
|
||||
See a [usage example](/docs/integrations/llms/google_vertex_ai_palm).
|
||||
|
||||
@@ -80,19 +80,19 @@ See a [usage example](/docs/integrations/llms/google_vertex_ai_palm).
|
||||
from langchain_google_vertexai.model_garden import ChatAnthropicVertex
|
||||
```
|
||||
|
||||
### Chat Llama on Vertex AI Model Garden
|
||||
### Llama on Vertex AI Model Garden
|
||||
|
||||
```python
|
||||
from langchain_google_vertexai.model_garden_maas.llama import VertexModelGardenLlama
|
||||
```
|
||||
|
||||
### Chat Mistral on Vertex AI Model Garden
|
||||
### Mistral on Vertex AI Model Garden
|
||||
|
||||
```python
|
||||
from langchain_google_vertexai.model_garden_maas.mistral import VertexModelGardenMistral
|
||||
```
|
||||
|
||||
### Chat Gemma local from Hugging Face
|
||||
### Gemma local from Hugging Face
|
||||
|
||||
>Local `Gemma` model loaded from `HuggingFace`.
|
||||
|
||||
@@ -106,7 +106,7 @@ pip install langchain-google-vertexai
|
||||
from langchain_google_vertexai.gemma import GemmaChatLocalHF
|
||||
```
|
||||
|
||||
### Chat Gemma local from Kaggle
|
||||
### Gemma local from Kaggle
|
||||
|
||||
>Local `Gemma` model loaded from `Kaggle`.
|
||||
|
||||
@@ -120,7 +120,7 @@ pip install langchain-google-vertexai
|
||||
from langchain_google_vertexai.gemma import GemmaChatLocalKaggle
|
||||
```
|
||||
|
||||
### Chat Gemma on Vertex AI Model Garden
|
||||
### Gemma on Vertex AI Model Garden
|
||||
|
||||
We need to install `langchain-google-vertexai` python package.
|
||||
|
||||
@@ -132,7 +132,7 @@ pip install langchain-google-vertexai
|
||||
from langchain_google_vertexai.gemma import GemmaChatVertexAIModelGarden
|
||||
```
|
||||
|
||||
### Vertex AI image captioning chat
|
||||
### Vertex AI image captioning
|
||||
|
||||
>Implementation of the `Image Captioning model` as a chat.
|
||||
|
||||
@@ -146,7 +146,7 @@ pip install langchain-google-vertexai
|
||||
from langchain_google_vertexai.vision_models import VertexAIImageCaptioningChat
|
||||
```
|
||||
|
||||
### Vertex AI image editor chat
|
||||
### Vertex AI image editor
|
||||
|
||||
>Given an image and a prompt, edit the image. Currently only supports mask-free editing.
|
||||
|
||||
@@ -160,7 +160,7 @@ pip install langchain-google-vertexai
|
||||
from langchain_google_vertexai.vision_models import VertexAIImageEditorChat
|
||||
```
|
||||
|
||||
### Vertex AI image generator chat
|
||||
### Vertex AI image generator
|
||||
|
||||
>Generates an image from a prompt.
|
||||
|
||||
@@ -174,7 +174,7 @@ pip install langchain-google-vertexai
|
||||
from langchain_google_vertexai.vision_models import VertexAIImageGeneratorChat
|
||||
```
|
||||
|
||||
### Vertex AI visual QnA chat
|
||||
### Vertex AI visual QnA
|
||||
|
||||
>Chat implementation of a visual QnA model
|
||||
|
||||
@@ -1,20 +1,35 @@
|
||||
# Jina
|
||||
# Jina AI
|
||||
|
||||
This page covers how to use the Jina Embeddings within LangChain.
|
||||
It is broken into two parts: installation and setup, and then references to specific Jina wrappers.
|
||||
>[Jina AI](https://jina.ai/about-us) is a search AI company. `Jina` helps businesses and developers unlock multimodal data with a better search.
|
||||
|
||||
## Installation and Setup
|
||||
- Get a Jina AI API token from [here](https://jina.ai/embeddings/) and set it as an environment variable (`JINA_API_TOKEN`)
|
||||
|
||||
There exists a Jina Embeddings wrapper, which you can access with
|
||||
## Chat Models
|
||||
|
||||
```python
|
||||
from langchain_community.embeddings import JinaEmbeddings
|
||||
|
||||
# you can pas jina_api_key, if none is passed it will be taken from `JINA_API_TOKEN` environment variable
|
||||
embeddings = JinaEmbeddings(jina_api_key='jina_**', model_name='jina-embeddings-v2-base-en')
|
||||
from langchain_community.chat_models import JinaChat
|
||||
```
|
||||
|
||||
See a [usage examples](/docs/integrations/chat/jinachat).
|
||||
|
||||
## Embedding Models
|
||||
|
||||
You can check the list of available models from [here](https://jina.ai/embeddings/)
|
||||
|
||||
For a more detailed walkthrough of this, see [this notebook](/docs/integrations/text_embedding/jina)
|
||||
```python
|
||||
from langchain_community.embeddings import JinaEmbeddings
|
||||
```
|
||||
|
||||
See a [usage examples](/docs/integrations/text_embedding/jina).
|
||||
|
||||
## Document Transformers
|
||||
|
||||
### Jina Rerank
|
||||
|
||||
```python
|
||||
from langchain_community.document_compressors import JinaRerank
|
||||
```
|
||||
|
||||
See a [usage examples](/docs/integrations/document_transformers/jina_rerank).
|
||||
|
||||
|
||||
20
docs/docs/integrations/providers/koboldai.mdx
Normal file
20
docs/docs/integrations/providers/koboldai.mdx
Normal file
@@ -0,0 +1,20 @@
|
||||
# KoboldAI
|
||||
|
||||
>[KoboldAI](https://koboldai.com/) is a free, open-source project that allows users to run AI models locally
|
||||
> on their own computer.
|
||||
> It's a browser-based front-end that can be used for writing or role playing with an AI.
|
||||
>[KoboldAI](https://github.com/KoboldAI/KoboldAI-Client) is a "a browser-based front-end for
|
||||
> AI-assisted writing with multiple local & remote AI models...".
|
||||
> It has a public and local API that can be used in LangChain.
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
Check out the [installation guide](https://github.com/KoboldAI/KoboldAI-Client).
|
||||
|
||||
## LLMs
|
||||
|
||||
See a [usage example](/docs/integrations/llms/koboldai).
|
||||
|
||||
```python
|
||||
from langchain_community.llms import KoboldApiLLM
|
||||
```
|
||||
21
docs/docs/integrations/providers/konlpy.mdx
Normal file
21
docs/docs/integrations/providers/konlpy.mdx
Normal file
@@ -0,0 +1,21 @@
|
||||
# KoNLPY
|
||||
|
||||
>[KoNLPy](https://konlpy.org/) is a Python package for natural language processing (NLP)
|
||||
> of the Korean language.
|
||||
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
You need to install the `konlpy` python package.
|
||||
|
||||
```bash
|
||||
pip install konlpy
|
||||
```
|
||||
|
||||
## Text splitter
|
||||
|
||||
See a [usage example](/docs/how_to/split_by_token/#konlpy).
|
||||
|
||||
```python
|
||||
from langchain_text_splitters import KonlpyTextSplitter
|
||||
```
|
||||
32
docs/docs/integrations/providers/kuzu.mdx
Normal file
32
docs/docs/integrations/providers/kuzu.mdx
Normal file
@@ -0,0 +1,32 @@
|
||||
# Kùzu
|
||||
|
||||
>[Kùzu](https://kuzudb.com/) is a company based in Waterloo, Ontario, Canada.
|
||||
> It provides a highly scalable, extremely fast, easy-to-use [embeddable graph database](https://github.com/kuzudb/kuzu).
|
||||
|
||||
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
You need to install the `kuzu` python package.
|
||||
|
||||
```bash
|
||||
pip install kuzu
|
||||
```
|
||||
|
||||
## Graph database
|
||||
|
||||
See a [usage example](/docs/integrations/graphs/kuzu_db).
|
||||
|
||||
```python
|
||||
from langchain_community.graphs import KuzuGraph
|
||||
```
|
||||
|
||||
## Chain
|
||||
|
||||
See a [usage example](/docs/integrations/graphs/kuzu_db/#creating-kuzuqachain).
|
||||
|
||||
```python
|
||||
from langchain.chains import KuzuQAChain
|
||||
```
|
||||
|
||||
|
||||
32
docs/docs/integrations/providers/llama_index.mdx
Normal file
32
docs/docs/integrations/providers/llama_index.mdx
Normal file
@@ -0,0 +1,32 @@
|
||||
# LlamaIndex
|
||||
|
||||
>[LlamaIndex](https://www.llamaindex.ai/) is the leading data framework for building LLM applications
|
||||
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
You need to install the `llama-index` python package.
|
||||
|
||||
```bash
|
||||
pip install llama-index
|
||||
```
|
||||
|
||||
See the [installation instructions](https://docs.llamaindex.ai/en/stable/getting_started/installation/).
|
||||
|
||||
## Retrievers
|
||||
|
||||
### LlamaIndexRetriever
|
||||
|
||||
>It is used for the question-answering with sources over an LlamaIndex data structure.
|
||||
|
||||
```python
|
||||
from langchain_community.retrievers.llama_index import LlamaIndexRetriever
|
||||
```
|
||||
|
||||
### LlamaIndexGraphRetriever
|
||||
|
||||
>It is used for question-answering with sources over an LlamaIndex graph data structure.
|
||||
|
||||
```python
|
||||
from langchain_community.retrievers.llama_index import LlamaIndexGraphRetriever
|
||||
```
|
||||
24
docs/docs/integrations/providers/llamaedge.mdx
Normal file
24
docs/docs/integrations/providers/llamaedge.mdx
Normal file
@@ -0,0 +1,24 @@
|
||||
# LlamaEdge
|
||||
|
||||
>[LlamaEdge](https://llamaedge.com/docs/intro/) is the easiest & fastest way to run customized
|
||||
> and fine-tuned LLMs locally or on the edge.
|
||||
>
|
||||
>* Lightweight inference apps. `LlamaEdge` is in MBs instead of GBs
|
||||
>* Native and GPU accelerated performance
|
||||
>* Supports many GPU and hardware accelerators
|
||||
>* Supports many optimized inference libraries
|
||||
>* Wide selection of AI / LLM models
|
||||
|
||||
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
See the [installation instructions](https://llamaedge.com/docs/user-guide/quick-start-command).
|
||||
|
||||
## Chat models
|
||||
|
||||
See a [usage example](/docs/integrations/chat/llama_edge).
|
||||
|
||||
```python
|
||||
from langchain_community.chat_models.llama_edge import LlamaEdgeChatService
|
||||
```
|
||||
31
docs/docs/integrations/providers/llamafile.mdx
Normal file
31
docs/docs/integrations/providers/llamafile.mdx
Normal file
@@ -0,0 +1,31 @@
|
||||
# llamafile
|
||||
|
||||
>[llamafile](https://github.com/Mozilla-Ocho/llamafile) lets you distribute and run LLMs
|
||||
> with a single file.
|
||||
|
||||
>`llamafile` makes open LLMs much more accessible to both developers and end users.
|
||||
> `llamafile` is doing that by combining [llama.cpp](https://github.com/ggerganov/llama.cpp) with
|
||||
> [Cosmopolitan Libc](https://github.com/jart/cosmopolitan) into one framework that collapses
|
||||
> all the complexity of LLMs down to a single-file executable (called a "llamafile")
|
||||
> that runs locally on most computers, with no installation.
|
||||
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
See the [installation instructions](https://github.com/Mozilla-Ocho/llamafile?tab=readme-ov-file#quickstart).
|
||||
|
||||
## LLMs
|
||||
|
||||
See a [usage example](/docs/integrations/llms/llamafile).
|
||||
|
||||
```python
|
||||
from langchain_community.llms.llamafile import Llamafile
|
||||
```
|
||||
|
||||
## Embedding models
|
||||
|
||||
See a [usage example](/docs/integrations/text_embedding/llamafile).
|
||||
|
||||
```python
|
||||
from langchain_community.embeddings import LlamafileEmbeddings
|
||||
```
|
||||
24
docs/docs/integrations/providers/localai.mdx
Normal file
24
docs/docs/integrations/providers/localai.mdx
Normal file
@@ -0,0 +1,24 @@
|
||||
# LocalAI
|
||||
|
||||
>[LocalAI](https://localai.io/) is the free, Open Source OpenAI alternative.
|
||||
> `LocalAI` act as a drop-in replacement REST API that’s compatible with OpenAI API
|
||||
> specifications for local inferencing. It allows you to run LLMs, generate images,
|
||||
> audio (and not only) locally or on-prem with consumer grade hardware,
|
||||
> supporting multiple model families and architectures.
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
We have to install several python packages:
|
||||
|
||||
```bash
|
||||
pip install tenacity openai
|
||||
```
|
||||
|
||||
|
||||
## Embedding models
|
||||
|
||||
See a [usage example](/docs/integrations/text_embedding/localai).
|
||||
|
||||
```python
|
||||
from langchain_community.embeddings import LocalAIEmbeddings
|
||||
```
|
||||
@@ -264,22 +264,20 @@ See a [usage example](/docs/integrations/document_loaders/url/#playwright-url-lo
|
||||
from langchain_community.document_loaders.onenote import OneNoteLoader
|
||||
```
|
||||
|
||||
## AI Agent Memory System
|
||||
|
||||
[AI agent](https://learn.microsoft.com/en-us/azure/cosmos-db/ai-agents) needs robust memory systems that support multi-modality, offer strong operational performance, and enable agent memory sharing as well as separation.
|
||||
## Vector Stores
|
||||
|
||||
### Azure Cosmos DB
|
||||
AI agents can rely on Azure Cosmos DB as a unified [memory system](https://learn.microsoft.com/en-us/azure/cosmos-db/ai-agents#memory-can-make-or-break-agents) solution, enjoying speed, scale, and simplicity. This service successfully [enabled OpenAI's ChatGPT service](https://www.youtube.com/watch?v=6IIUtEFKJec&t) to scale dynamically with high reliability and low maintenance. Powered by an atom-record-sequence engine, it is the world's first globally distributed [NoSQL](https://learn.microsoft.com/en-us/azure/cosmos-db/distributed-nosql), [relational](https://learn.microsoft.com/en-us/azure/cosmos-db/distributed-relational), and [vector database](https://learn.microsoft.com/en-us/azure/cosmos-db/vector-database) service that offers a serverless mode.
|
||||
|
||||
Below are two available Azure Cosmos DB APIs that can provide vector store functionalities.
|
||||
|
||||
### Azure Cosmos DB for MongoDB (vCore)
|
||||
#### Azure Cosmos DB for MongoDB (vCore)
|
||||
|
||||
>[Azure Cosmos DB for MongoDB vCore](https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/vcore/) makes it easy to create a database with full native MongoDB support.
|
||||
> You can apply your MongoDB experience and continue to use your favorite MongoDB drivers, SDKs, and tools by pointing your application to the API for MongoDB vCore account's connection string.
|
||||
> Use vector search in Azure Cosmos DB for MongoDB vCore to seamlessly integrate your AI-based applications with your data that's stored in Azure Cosmos DB.
|
||||
|
||||
#### Installation and Setup
|
||||
##### Installation and Setup
|
||||
|
||||
See [detail configuration instructions](/docs/integrations/vectorstores/azure_cosmos_db).
|
||||
|
||||
@@ -289,7 +287,7 @@ We need to install `pymongo` python package.
|
||||
pip install pymongo
|
||||
```
|
||||
|
||||
#### Deploy Azure Cosmos DB on Microsoft Azure
|
||||
##### Deploy Azure Cosmos DB on Microsoft Azure
|
||||
|
||||
Azure Cosmos DB for MongoDB vCore provides developers with a fully managed MongoDB-compatible database service for building modern applications with a familiar architecture.
|
||||
|
||||
@@ -303,7 +301,7 @@ See a [usage example](/docs/integrations/vectorstores/azure_cosmos_db).
|
||||
from langchain_community.vectorstores import AzureCosmosDBVectorSearch
|
||||
```
|
||||
|
||||
### Azure Cosmos DB NoSQL
|
||||
#### Azure Cosmos DB NoSQL
|
||||
|
||||
>[Azure Cosmos DB for NoSQL](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/vector-search) now offers vector indexing and search in preview.
|
||||
This feature is designed to handle high-dimensional vectors, enabling efficient and accurate vector search at any scale. You can now store vectors
|
||||
@@ -312,7 +310,7 @@ but also high-dimensional vectors as other properties of the documents. This col
|
||||
as the vectors are stored in the same logical unit as the data they represent. This simplifies data management, AI application architectures, and the
|
||||
efficiency of vector-based operations.
|
||||
|
||||
#### Installation and Setup
|
||||
##### Installation and Setup
|
||||
|
||||
See [detail configuration instructions](/docs/integrations/vectorstores/azure_cosmos_db_no_sql).
|
||||
|
||||
@@ -322,7 +320,7 @@ We need to install `azure-cosmos` python package.
|
||||
pip install azure-cosmos
|
||||
```
|
||||
|
||||
#### Deploy Azure Cosmos DB on Microsoft Azure
|
||||
##### Deploy Azure Cosmos DB on Microsoft Azure
|
||||
|
||||
Azure Cosmos DB offers a solution for modern apps and intelligent workloads by being very responsive with dynamic and elastic autoscale. It is available
|
||||
in every Azure region and can automatically replicate data closer to users. It has SLA guaranteed low-latency and high availability.
|
||||
@@ -336,6 +334,7 @@ from langchain_community.vectorstores import AzureCosmosDBNoSQLVectorSearch
|
||||
```
|
||||
|
||||
### Azure Database for PostgreSQL
|
||||
|
||||
>[Azure Database for PostgreSQL - Flexible Server](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/service-overview) is a relational database service based on the open-source Postgres database engine. It's a fully managed database-as-a-service that can handle mission-critical workloads with predictable performance, security, high availability, and dynamic scalability.
|
||||
|
||||
See [set up instructions](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/quickstart-create-server-portal) for Azure Database for PostgreSQL.
|
||||
@@ -446,6 +445,38 @@ The `azure_ai_services` toolkit includes the following tools:
|
||||
- Text to Speech: [AzureAiServicesTextToSpeechTool](https://python.langchain.com/api_reference/community/tools/langchain_community.tools.azure_ai_services.text_to_speech.AzureAiServicesTextToSpeechTool.html)
|
||||
- Text Analytics for Health: [AzureAiServicesTextAnalyticsForHealthTool](https://python.langchain.com/api_reference/community/tools/langchain_community.tools.azure_ai_services.text_analytics_for_health.AzureAiServicesTextAnalyticsForHealthTool.html)
|
||||
|
||||
### Azure Cognitive Services
|
||||
|
||||
We need to install several python packages.
|
||||
|
||||
```bash
|
||||
pip install azure-ai-formrecognizer azure-cognitiveservices-speech azure-ai-vision-imageanalysis
|
||||
```
|
||||
|
||||
See a [usage example](/docs/integrations/tools/azure_cognitive_services).
|
||||
|
||||
```python
|
||||
from langchain_community.agent_toolkits import AzureCognitiveServicesToolkit
|
||||
```
|
||||
|
||||
#### Azure AI Services individual tools
|
||||
|
||||
The `azure_ai_services` toolkit includes the tools that queries the `Azure Cognitive Services`:
|
||||
- `AzureCogsFormRecognizerTool`: Form Recognizer API
|
||||
- `AzureCogsImageAnalysisTool`: Image Analysis API
|
||||
- `AzureCogsSpeech2TextTool`: Speech2Text API
|
||||
- `AzureCogsText2SpeechTool`: Text2Speech API
|
||||
- `AzureCogsTextAnalyticsHealthTool`: Text Analytics for Health API
|
||||
|
||||
```python
|
||||
from langchain_community.tools.azure_cognitive_services import (
|
||||
AzureCogsFormRecognizerTool,
|
||||
AzureCogsImageAnalysisTool,
|
||||
AzureCogsSpeech2TextTool,
|
||||
AzureCogsText2SpeechTool,
|
||||
AzureCogsTextAnalyticsHealthTool,
|
||||
)
|
||||
```
|
||||
|
||||
### Microsoft Office 365 email and calendar
|
||||
|
||||
@@ -465,11 +496,11 @@ from langchain_community.agent_toolkits import O365Toolkit
|
||||
#### Office 365 individual tools
|
||||
|
||||
You can use individual tools from the Office 365 Toolkit:
|
||||
- `O365CreateDraftMessage`: tool for creating a draft email in Office 365
|
||||
- `O365SearchEmails`: tool for searching email messages in Office 365
|
||||
- `O365SearchEvents`: tool for searching calendar events in Office 365
|
||||
- `O365SendEvent`: tool for sending calendar events in Office 365
|
||||
- `O365SendMessage`: tool for sending an email in Office 365
|
||||
- `O365CreateDraftMessage`: creating a draft email in Office 365
|
||||
- `O365SearchEmails`: searching email messages in Office 365
|
||||
- `O365SearchEvents`: searching calendar events in Office 365
|
||||
- `O365SendEvent`: sending calendar events in Office 365
|
||||
- `O365SendMessage`: sending an email in Office 365
|
||||
|
||||
```python
|
||||
from langchain_community.tools.office365 import O365CreateDraftMessage
|
||||
@@ -497,9 +528,9 @@ from langchain_community.utilities.powerbi import PowerBIDataset
|
||||
#### PowerBI individual tools
|
||||
|
||||
You can use individual tools from the Azure PowerBI Toolkit:
|
||||
- `InfoPowerBITool`: tool for getting metadata about a PowerBI Dataset
|
||||
- `ListPowerBITool`: tool for getting tables names
|
||||
- `QueryPowerBITool`: tool for querying a PowerBI Dataset
|
||||
- `InfoPowerBITool`: getting metadata about a PowerBI Dataset
|
||||
- `ListPowerBITool`: getting tables names
|
||||
- `QueryPowerBITool`: querying a PowerBI Dataset
|
||||
|
||||
```python
|
||||
from langchain_community.tools.powerbi.tool import InfoPowerBITool
|
||||
@@ -9,17 +9,25 @@
|
||||
Install the Python SDK:
|
||||
|
||||
```bash
|
||||
pip install pymilvus
|
||||
pip install langchain-milvus
|
||||
```
|
||||
|
||||
## Vector Store
|
||||
|
||||
There exists a wrapper around `Milvus` indexes, allowing you to use it as a vectorstore,
|
||||
whether for semantic search or example selection.
|
||||
See a [usage example](/docs/integrations/vectorstores/milvus).
|
||||
|
||||
To import this vectorstore:
|
||||
```python
|
||||
from langchain_community.vectorstores import Milvus
|
||||
from langchain_milvus import Milvus
|
||||
```
|
||||
|
||||
## Retrievers
|
||||
|
||||
See a [usage example](/docs/integrations/retrievers/milvus_hybrid_search).
|
||||
|
||||
To import this vectorstore:
|
||||
```python
|
||||
from langchain_milvus.retrievers import MilvusCollectionHybridSearchRetriever
|
||||
from langchain_milvus.utils.sparse import BM25SparseEmbedding
|
||||
```
|
||||
|
||||
For a more detailed walkthrough of the `Miluvs` wrapper, see [this notebook](/docs/integrations/vectorstores/milvus)
|
||||
|
||||
24
docs/docs/integrations/providers/mongodb.mdx
Normal file
24
docs/docs/integrations/providers/mongodb.mdx
Normal file
@@ -0,0 +1,24 @@
|
||||
# MongoDB
|
||||
|
||||
>[MongoDB](https://www.mongodb.com/) is a NoSQL, document-oriented
|
||||
> database that supports JSON-like documents with a dynamic schema.
|
||||
|
||||
**NOTE:**
|
||||
- See other `MongoDB` integrations on the [MongoDB Atlas page](/docs/integrations/providers/mongodb_atlas).
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
Install the Python package:
|
||||
|
||||
```bash
|
||||
pip install langchain-mongodb
|
||||
```
|
||||
|
||||
## Message Histories
|
||||
|
||||
See a [usage example](/docs/integrations/memory/mongodb_chat_message_history).
|
||||
|
||||
To import this vectorstore:
|
||||
```python
|
||||
from langchain_mongodb.chat_message_histories import MongoDBChatMessageHistory
|
||||
```
|
||||
@@ -22,10 +22,30 @@ See a [usage example](/docs/integrations/vectorstores/mongodb_atlas).
|
||||
from langchain_mongodb import MongoDBAtlasVectorSearch
|
||||
```
|
||||
|
||||
## Retrievers
|
||||
|
||||
## LLM Caches
|
||||
### Full Text Search Retriever
|
||||
|
||||
>`Hybrid Search Retriever` performs full-text searches using
|
||||
> Lucene’s standard (`BM25`) analyzer.
|
||||
|
||||
```python
|
||||
from langchain_mongodb.retrievers import MongoDBAtlasFullTextSearchRetriever
|
||||
```
|
||||
|
||||
### Hybrid Search Retriever
|
||||
|
||||
>`Hybrid Search Retriever` combines vector and full-text searches weighting
|
||||
> them the via `Reciprocal Rank Fusion` (`RRF`) algorithm.
|
||||
|
||||
```python
|
||||
from langchain_mongodb.retrievers import MongoDBAtlasHybridSearchRetriever
|
||||
```
|
||||
|
||||
## Model Caches
|
||||
|
||||
### MongoDBCache
|
||||
|
||||
An abstraction to store a simple cache in MongoDB. This does not use Semantic Caching, nor does it require an index to be made on the collection before generation.
|
||||
|
||||
To import this cache:
|
||||
|
||||
@@ -32,20 +32,18 @@ from langchain_community.embeddings import OCIGenAIEmbeddings
|
||||
> as an OCI Model Deployment Endpoint using the
|
||||
> [OCI Data Science Model Deployment Service](https://docs.oracle.com/en-us/iaas/data-science/using/model-dep-about.htm).
|
||||
|
||||
If you deployed a LLM with the VLLM or TGI framework, you can use the
|
||||
`OCIModelDeploymentVLLM` or `OCIModelDeploymentTGI` classes to interact with it.
|
||||
|
||||
To use, you should have the latest `oracle-ads` python SDK installed.
|
||||
|
||||
```bash
|
||||
pip install -U oracle-ads
|
||||
```
|
||||
|
||||
See [usage examples](/docs/integrations/llms/oci_model_deployment_endpoint).
|
||||
See [chat](/docs/integrations/chat/oci_data_science) and [complete](/docs/integrations/llms/oci_model_deployment_endpoint) usage examples.
|
||||
|
||||
|
||||
```python
|
||||
from langchain_community.llms import OCIModelDeploymentVLLM
|
||||
from langchain_community.chat_models import ChatOCIModelDeployment
|
||||
|
||||
from langchain_community.llms import OCIModelDeploymentTGI
|
||||
from langchain_community.llms import OCIModelDeploymentLLM
|
||||
```
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"\n",
|
||||
"| Provider | Package |\n",
|
||||
"|:--------:|:-------:|\n",
|
||||
"| [Google](https://python.langchain.com/docs/integrations/platforms/google/) | [langchain-google-vertexai](https://python.langchain.com/api_reference/google_vertexai/embeddings/langchain_google_vertexai.embeddings.VertexAIEmbeddings.html) |\n",
|
||||
"| [Google](https://python.langchain.com/docs/integrations/providers/google/) | [langchain-google-vertexai](https://python.langchain.com/api_reference/google_vertexai/embeddings/langchain_google_vertexai.embeddings.VertexAIEmbeddings.html) |\n",
|
||||
"\n",
|
||||
"## Setup\n",
|
||||
"\n",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Local BGE Embeddings with IPEX-LLM on Intel CPU\n",
|
||||
"# IPEX-LLM: Local BGE Embeddings on Intel CPU\n",
|
||||
"\n",
|
||||
"> [IPEX-LLM](https://github.com/intel-analytics/ipex-llm) is a PyTorch library for running LLM on Intel CPU and GPU (e.g., local PC with iGPU, discrete GPU such as Arc, Flex and Max) with very low latency.\n",
|
||||
"\n",
|
||||
@@ -92,10 +92,24 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"name": "python"
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Local BGE Embeddings with IPEX-LLM on Intel GPU\n",
|
||||
"# IPEX-LLM: Local BGE Embeddings on Intel GPU\n",
|
||||
"\n",
|
||||
"> [IPEX-LLM](https://github.com/intel-analytics/ipex-llm) is a PyTorch library for running LLM on Intel CPU and GPU (e.g., local PC with iGPU, discrete GPU such as Arc, Flex and Max) with very low latency.\n",
|
||||
"\n",
|
||||
@@ -155,10 +155,24 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"name": "python"
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
||||
@@ -5,7 +5,11 @@
|
||||
"id": "1c0cf975",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Jina"
|
||||
"# Jina\n",
|
||||
"\n",
|
||||
"You can check the list of available models from [here](https://jina.ai/embeddings/).\n",
|
||||
"\n",
|
||||
"## Installation and setup"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -231,7 +235,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.13"
|
||||
"version": "3.10.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
@@ -74,6 +74,24 @@
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"(Optional) To increase the retry time for getting a function execution response, set environment variable UC_TOOL_CLIENT_EXECUTION_TIMEOUT. Default retry time value is 120s."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"\n",
|
||||
"os.environ[\"UC_TOOL_CLIENT_EXECUTION_TIMEOUT\"] = \"200\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
"\n",
|
||||
"The `Jira` toolkit allows agents to interact with a given Jira instance, performing actions such as searching for issues and creating issues, the tool wraps the atlassian-python-api library, for more see: https://atlassian-python-api.readthedocs.io/jira.html\n",
|
||||
"\n",
|
||||
"## Installation and setup\n",
|
||||
"\n",
|
||||
"To use this tool, you must first set as environment variables:\n",
|
||||
" JIRA_API_TOKEN\n",
|
||||
" JIRA_USERNAME\n",
|
||||
@@ -47,7 +49,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%pip install -qU langchain-community"
|
||||
"%pip install -qU langchain-community langchain_openai"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -58,6 +60,13 @@
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-04-17T10:21:23.730922Z",
|
||||
"start_time": "2023-04-17T10:21:22.911233Z"
|
||||
},
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-10-02T17:40:07.356954Z",
|
||||
"iopub.status.busy": "2024-10-02T17:40:07.356792Z",
|
||||
"iopub.status.idle": "2024-10-02T17:40:07.359943Z",
|
||||
"shell.execute_reply": "2024-10-02T17:40:07.359476Z",
|
||||
"shell.execute_reply.started": "2024-10-02T17:40:07.356942Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
@@ -72,7 +81,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 3,
|
||||
"id": "b3050b55",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
@@ -80,6 +89,13 @@
|
||||
"start_time": "2023-04-17T10:22:42.499447Z"
|
||||
},
|
||||
"collapsed": false,
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-10-02T17:40:16.201684Z",
|
||||
"iopub.status.busy": "2024-10-02T17:40:16.200922Z",
|
||||
"iopub.status.idle": "2024-10-02T17:40:16.208035Z",
|
||||
"shell.execute_reply": "2024-10-02T17:40:16.207564Z",
|
||||
"shell.execute_reply.started": "2024-10-02T17:40:16.201634Z"
|
||||
},
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
@@ -93,6 +109,74 @@
|
||||
"os.environ[\"JIRA_CLOUD\"] = \"True\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "c0768000-227b-4aa1-a838-4befbdefadb1",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-10-02T17:42:00.792867Z",
|
||||
"iopub.status.busy": "2024-10-02T17:42:00.792365Z",
|
||||
"iopub.status.idle": "2024-10-02T17:42:00.816979Z",
|
||||
"shell.execute_reply": "2024-10-02T17:42:00.816419Z",
|
||||
"shell.execute_reply.started": "2024-10-02T17:42:00.792827Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"llm = OpenAI(temperature=0)\n",
|
||||
"jira = JiraAPIWrapper()\n",
|
||||
"toolkit = JiraToolkit.from_jira_api_wrapper(jira)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "961b3187-daf0-4907-9cc0-a69796fba4aa",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Tool usage\n",
|
||||
"\n",
|
||||
"Let's see what individual tools are in the Jira toolkit:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "eb5cf521-9a91-44bc-b68e-bc4067d05a76",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-10-02T17:42:27.232022Z",
|
||||
"iopub.status.busy": "2024-10-02T17:42:27.231140Z",
|
||||
"iopub.status.idle": "2024-10-02T17:42:27.240169Z",
|
||||
"shell.execute_reply": "2024-10-02T17:42:27.239693Z",
|
||||
"shell.execute_reply.started": "2024-10-02T17:42:27.231949Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[('JQL Query',\n",
|
||||
" '\\n This tool is a wrapper around atlassian-python-api\\'s Jira jql API, useful when you need to search for Jira issues.\\n The input to this tool is a JQL query string, and will be passed into atlassian-python-api\\'s Jira `jql` function,\\n For example, to find all the issues in project \"Test\" assigned to the me, you would pass in the following string:\\n project = Test AND assignee = currentUser()\\n or to find issues with summaries that contain the word \"test\", you would pass in the following string:\\n summary ~ \\'test\\'\\n '),\n",
|
||||
" ('Get Projects',\n",
|
||||
" \"\\n This tool is a wrapper around atlassian-python-api's Jira project API, \\n useful when you need to fetch all the projects the user has access to, find out how many projects there are, or as an intermediary step that involv searching by projects. \\n there is no input to this tool.\\n \"),\n",
|
||||
" ('Create Issue',\n",
|
||||
" '\\n This tool is a wrapper around atlassian-python-api\\'s Jira issue_create API, useful when you need to create a Jira issue. \\n The input to this tool is a dictionary specifying the fields of the Jira issue, and will be passed into atlassian-python-api\\'s Jira `issue_create` function.\\n For example, to create a low priority task called \"test issue\" with description \"test description\", you would pass in the following dictionary: \\n {{\"summary\": \"test issue\", \"description\": \"test description\", \"issuetype\": {{\"name\": \"Task\"}}, \"priority\": {{\"name\": \"Low\"}}}}\\n '),\n",
|
||||
" ('Catch all Jira API call',\n",
|
||||
" '\\n This tool is a wrapper around atlassian-python-api\\'s Jira API.\\n There are other dedicated tools for fetching all projects, and creating and searching for issues, \\n use this tool if you need to perform any other actions allowed by the atlassian-python-api Jira API.\\n The input to this tool is a dictionary specifying a function from atlassian-python-api\\'s Jira API, \\n as well as a list of arguments and dictionary of keyword arguments to pass into the function.\\n For example, to get all the users in a group, while increasing the max number of results to 100, you would\\n pass in the following dictionary: {{\"function\": \"get_all_users_from_group\", \"args\": [\"group\"], \"kwargs\": {{\"limit\":100}} }}\\n or to find out how many projects are in the Jira instance, you would pass in the following string:\\n {{\"function\": \"projects\"}}\\n For more information on the Jira API, refer to https://atlassian-python-api.readthedocs.io/jira.html\\n '),\n",
|
||||
" ('Create confluence page',\n",
|
||||
" 'This tool is a wrapper around atlassian-python-api\\'s Confluence \\natlassian-python-api API, useful when you need to create a Confluence page. The input to this tool is a dictionary \\nspecifying the fields of the Confluence page, and will be passed into atlassian-python-api\\'s Confluence `create_page` \\nfunction. For example, to create a page in the DEMO space titled \"This is the title\" with body \"This is the body. You can use \\n<strong>HTML tags</strong>!\", you would pass in the following dictionary: {{\"space\": \"DEMO\", \"title\":\"This is the \\ntitle\",\"body\":\"This is the body. You can use <strong>HTML tags</strong>!\"}} ')]"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"[(tool.name, tool.description) for tool in toolkit.get_tools()]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
@@ -105,9 +189,6 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"llm = OpenAI(temperature=0)\n",
|
||||
"jira = JiraAPIWrapper()\n",
|
||||
"toolkit = JiraToolkit.from_jira_api_wrapper(jira)\n",
|
||||
"agent = initialize_agent(\n",
|
||||
" toolkit.get_tools(), llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True\n",
|
||||
")"
|
||||
|
||||
@@ -35,9 +35,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 2,
|
||||
"id": "ff988466-c389-4ec6-b6ac-14364a537fd5",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-10-02T17:52:40.107644Z",
|
||||
"iopub.status.busy": "2024-10-02T17:52:40.107485Z",
|
||||
"iopub.status.idle": "2024-10-02T17:52:40.110169Z",
|
||||
"shell.execute_reply": "2024-10-02T17:52:40.109841Z",
|
||||
"shell.execute_reply.started": "2024-10-02T17:52:40.107633Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
@@ -50,16 +57,23 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 4,
|
||||
"id": "9ecd1ba0-3937-4359-a41e-68605f0596a1",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-10-02T17:59:54.134295Z",
|
||||
"iopub.status.busy": "2024-10-02T17:59:54.134138Z",
|
||||
"iopub.status.idle": "2024-10-02T17:59:54.137250Z",
|
||||
"shell.execute_reply": "2024-10-02T17:59:54.136636Z",
|
||||
"shell.execute_reply.started": "2024-10-02T17:59:54.134283Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with open(\"openai_openapi.yml\") as f:\n",
|
||||
" data = yaml.load(f, Loader=yaml.FullLoader)\n",
|
||||
"json_spec = JsonSpec(dict_=data, max_value_length=4000)\n",
|
||||
"json_spec = JsonSpec(dict_={}, max_value_length=4000)\n",
|
||||
"json_toolkit = JsonToolkit(spec=json_spec)\n",
|
||||
"\n",
|
||||
"json_agent_executor = create_json_agent(\n",
|
||||
@@ -67,6 +81,48 @@
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "910eccbc-9d42-49b6-a4ca-1fbc418fcee7",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Individual tools\n",
|
||||
"\n",
|
||||
"Let's see what individual tools are inside the Jira toolkit."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "b16a3ee5-ca16-452e-993f-c27228b945ac",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-10-02T18:00:30.527665Z",
|
||||
"iopub.status.busy": "2024-10-02T18:00:30.527053Z",
|
||||
"iopub.status.idle": "2024-10-02T18:00:30.538483Z",
|
||||
"shell.execute_reply": "2024-10-02T18:00:30.537672Z",
|
||||
"shell.execute_reply.started": "2024-10-02T18:00:30.527626Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[('json_spec_list_keys',\n",
|
||||
" '\\n Can be used to list all keys at a given path. \\n Before calling this you should be SURE that the path to this exists.\\n The input is a text representation of the path to the dict in Python syntax (e.g. data[\"key1\"][0][\"key2\"]).\\n '),\n",
|
||||
" ('json_spec_get_value',\n",
|
||||
" '\\n Can be used to see value in string format at a given path.\\n Before calling this you should be SURE that the path to this exists.\\n The input is a text representation of the path to the dict in Python syntax (e.g. data[\"key1\"][0][\"key2\"]).\\n ')]"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"[(el.name, el.description) for el in json_toolkit.get_tools()]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "05cfcb24-4389-4b8f-ad9e-466e3fca8db0",
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
"id": "f8014c9d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now, we can initalize the agent with the LLM, the prompt, and the tools. The agent is responsible for taking in input and deciding what actions to take. Crucially, the Agent does not execute those actions - that is done by the AgentExecutor (next step). For more information about how to think about these components, see our [conceptual guide](/docs/concepts#agents)"
|
||||
"Now, we can initialize the agent with the LLM, the prompt, and the tools. The agent is responsible for taking in input and deciding what actions to take. Crucially, the Agent does not execute those actions - that is done by the AgentExecutor (next step). For more information about how to think about these components, see our [conceptual guide](/docs/concepts#agents)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -209,15 +209,25 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "5f5751e3-2e98-485f-8164-db8094039c25",
|
||||
"id": "4e3fd064-aa86-448d-8db3-3c55eaa5bc15",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"API references:\n",
|
||||
"\n",
|
||||
"- [QuerySQLDataBaseTool](https://python.langchain.com/api_reference/community/tools/langchain_community.tools.sql_database.tool.QuerySQLDataBaseTool.html)\n",
|
||||
"- [InfoSQLDatabaseTool](https://python.langchain.com/api_reference/community/tools/langchain_community.tools.sql_database.tool.InfoSQLDatabaseTool.html)\n",
|
||||
"- [ListSQLDatabaseTool](https://python.langchain.com/api_reference/community/tools/langchain_community.tools.sql_database.tool.ListSQLDatabaseTool.html)\n",
|
||||
"- [QuerySQLCheckerTool](https://python.langchain.com/api_reference/community/tools/langchain_community.tools.sql_database.tool.QuerySQLCheckerTool.html)"
|
||||
"You can use the individual tools directly:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "7fa8d00c-750c-4803-9b66-057d12b26b06",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain_community.tools.sql_database.tool import (\n",
|
||||
" InfoSQLDatabaseTool,\n",
|
||||
" ListSQLDatabaseTool,\n",
|
||||
" QuerySQLCheckerTool,\n",
|
||||
" QuerySQLDataBaseTool,\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -604,7 +614,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.4"
|
||||
"version": "3.10.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
@@ -8,7 +8,7 @@ sidebar_class_name: hidden
|
||||
**LangChain** is a framework for developing applications powered by large language models (LLMs).
|
||||
|
||||
LangChain simplifies every stage of the LLM application lifecycle:
|
||||
- **Development**: Build your applications using LangChain's open-source [building blocks](/docs/concepts#langchain-expression-language-lcel), [components](/docs/concepts), and [third-party integrations](/docs/integrations/platforms/).
|
||||
- **Development**: Build your applications using LangChain's open-source [building blocks](/docs/concepts#langchain-expression-language-lcel), [components](/docs/concepts), and [third-party integrations](/docs/integrations/providers/).
|
||||
Use [LangGraph](/docs/concepts/#langgraph) to build stateful agents with first-class streaming and human-in-the-loop support.
|
||||
- **Productionization**: Use [LangSmith](https://docs.smith.langchain.com/) to inspect, monitor and evaluate your chains, so that you can continuously optimize and deploy with confidence.
|
||||
- **Deployment**: Turn your LangGraph applications into production-ready APIs and Assistants with [LangGraph Cloud](https://langchain-ai.github.io/langgraph/cloud/).
|
||||
|
||||
@@ -6,7 +6,7 @@ LangChain has a large ecosystem of integrations with various external resources
|
||||
|
||||
When building such applications developers should remember to follow good security practices:
|
||||
|
||||
* [**Limit Permissions**](https://en.wikipedia.org/wiki/Principle_of_least_privilege): Scope permissions specifically to the application's need. Granting broad or excessive permissions can introduce significant security vulnerabilities. To avoid such vulnerabilities, consider using read-only credentials, disallowing access to sensitive resources, using sandboxing techniques (such as running inside a container), etc. as appropriate for your application.
|
||||
* [**Limit Permissions**](https://en.wikipedia.org/wiki/Principle_of_least_privilege): Scope permissions specifically to the application's need. Granting broad or excessive permissions can introduce significant security vulnerabilities. To avoid such vulnerabilities, consider using read-only credentials, disallowing access to sensitive resources, using sandboxing techniques (such as running inside a container), specifying proxy configurations to control external requests, etc. as appropriate for your application.
|
||||
* **Anticipate Potential Misuse**: Just as humans can err, so can Large Language Models (LLMs). Always assume that any system access or credentials may be used in any way allowed by the permissions they are assigned. For example, if a pair of database credentials allows deleting data, it’s safest to assume that any LLM able to use those credentials may in fact delete data.
|
||||
* [**Defense in Depth**](https://en.wikipedia.org/wiki/Defense_in_depth_(computing)): No security technique is perfect. Fine-tuning and good chain design can reduce, but not eliminate, the odds that a Large Language Model (LLM) may make a mistake. It’s best to combine multiple layered security approaches rather than relying on any single layer of defense to ensure security. For example: use both read-only permissions and sandboxing to ensure that LLMs are only able to access data that is explicitly meant for them to use.
|
||||
|
||||
|
||||
@@ -438,7 +438,7 @@
|
||||
"app = workflow.compile(checkpointer=MemorySaver())\n",
|
||||
"\n",
|
||||
"# Async invocation:\n",
|
||||
"output = await app.ainvoke({\"messages\": input_messages}, config):\n",
|
||||
"output = await app.ainvoke({\"messages\": input_messages}, config)\n",
|
||||
"output[\"messages\"][-1].pretty_print()\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
@@ -686,7 +686,7 @@
|
||||
"\n",
|
||||
"input_messages = [HumanMessage(query)]\n",
|
||||
"output = app.invoke(\n",
|
||||
" {\"messages\": input_messages, \"language\": language},\n",
|
||||
" {\"messages\": input_messages},\n",
|
||||
" config,\n",
|
||||
")\n",
|
||||
"output[\"messages\"][-1].pretty_print()"
|
||||
|
||||
@@ -497,15 +497,14 @@
|
||||
"# 4. Create chain\n",
|
||||
"chain = prompt_template | model | parser\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# 4. App definition\n",
|
||||
"# 5. App definition\n",
|
||||
"app = FastAPI(\n",
|
||||
" title=\"LangChain Server\",\n",
|
||||
" version=\"1.0\",\n",
|
||||
" description=\"A simple API server using LangChain's Runnable interfaces\",\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# 5. Adding chain route\n",
|
||||
"# 6. Adding chain route\n",
|
||||
"add_routes(\n",
|
||||
" app,\n",
|
||||
" chain,\n",
|
||||
|
||||
@@ -17,7 +17,7 @@ The following features have been added during the development of 0.1.x:
|
||||
- Include response metadata in `AIMessage` to make it easy to access raw output from the underlying models
|
||||
- Tooling to visualize [your runnables](https://python.langchain.com/docs/expression_language/how_to/inspect/) or [your langgraph app](https://github.com/langchain-ai/langgraph/blob/main/examples/visualization.ipynb)
|
||||
- Interoperability of chat message histories across most providers
|
||||
- [Over 20+ partner packages in python](https://python.langchain.com/docs/integrations/platforms/) for popular integrations
|
||||
- [Over 20+ partner packages in python](https://python.langchain.com/docs/integrations/providers/) for popular integrations
|
||||
|
||||
|
||||
## What’s coming to LangChain?
|
||||
|
||||
@@ -26,13 +26,14 @@
|
||||
"@docusaurus/preset-classic": "3.5.2",
|
||||
"@docusaurus/remark-plugin-npm2yarn": "^3.5.2",
|
||||
"@docusaurus/theme-mermaid": "3.5.2",
|
||||
"prism-react-renderer": "^2.1.0",
|
||||
"@giscus/react": "^3.0.0",
|
||||
"@mdx-js/react": "^3",
|
||||
"@supabase/supabase-js": "^2.39.7",
|
||||
"clsx": "^1.2.1",
|
||||
"cookie": "^0.6.0",
|
||||
"isomorphic-dompurify": "^2.7.0",
|
||||
"json-loader": "^0.5.7",
|
||||
"prism-react-renderer": "^2.1.0",
|
||||
"process": "^0.11.10",
|
||||
"react": "^18",
|
||||
"react-dom": "^18",
|
||||
|
||||
@@ -8,7 +8,7 @@ DOCS_DIR = Path(__file__).parents[1]
|
||||
PLATFORMS = {
|
||||
path.split("/")[-1][:-4]
|
||||
for path in glob.glob(
|
||||
str(DOCS_DIR) + "/docs/integrations/platforms/*.mdx", recursive=True
|
||||
str(DOCS_DIR) + "/docs/integrations/providers/*.mdx", recursive=True
|
||||
)
|
||||
}
|
||||
EXTERNAL_PACKAGES = {
|
||||
@@ -71,15 +71,15 @@ CUSTOM_NAME = {
|
||||
"airbyte": "Airbyte",
|
||||
}
|
||||
CUSTOM_PROVIDER_PAGES = {
|
||||
"azure-dynamic-sessions": "/docs/integrations/platforms/microsoft/",
|
||||
"google-community": "/docs/integrations/platforms/google/",
|
||||
"google-genai": "/docs/integrations/platforms/google/",
|
||||
"google-vertexai": "/docs/integrations/platforms/google/",
|
||||
"azure-dynamic-sessions": "/docs/integrations/providers/microsoft/",
|
||||
"google-community": "/docs/integrations/providers/google/",
|
||||
"google-genai": "/docs/integrations/providers/google/",
|
||||
"google-vertexai": "/docs/integrations/providers/google/",
|
||||
"nvidia-ai-endpoints": "/docs/integrations/providers/nvidia/",
|
||||
"exa": "/docs/integrations/providers/exa_search/",
|
||||
"mongodb": "/docs/integrations/providers/mongodb_atlas/",
|
||||
}
|
||||
PLATFORM_PAGES = {name: f"/docs/integrations/platforms/{name}/" for name in PLATFORMS}
|
||||
PLATFORM_PAGES = {name: f"/docs/integrations/providers/{name}/" for name in PLATFORMS}
|
||||
PROVIDER_PAGES = {
|
||||
name: f"/docs/integrations/providers/{name}/"
|
||||
for name in ALL_PACKAGES
|
||||
@@ -104,7 +104,7 @@ def package_row(name: str) -> str:
|
||||
|
||||
|
||||
def table() -> str:
|
||||
header = """| Provider | Package | Downloads | Latest | [JS](https://js.langchain.com/docs/integrations/platforms/) |
|
||||
header = """| Provider | Package | Downloads | Latest | [JS](https://js.langchain.com/docs/integrations/providers/) |
|
||||
| :--- | :---: | :---: | :---: | :---: |
|
||||
"""
|
||||
return header + "\n".join(package_row(name) for name in sorted(ALL_PACKAGES))
|
||||
@@ -136,12 +136,12 @@ These providers have standalone `langchain-{{provider}}` packages for improved v
|
||||
|
||||
## All Providers
|
||||
|
||||
Click [here](/docs/integrations/providers/) to see all providers.
|
||||
Click [here](/docs/integrations/providers/all) to see all providers.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
output_dir = Path(sys.argv[1]) / "integrations" / "platforms"
|
||||
output_dir = Path(sys.argv[1]) / "integrations" / "providers"
|
||||
with open(output_dir / "index.mdx", "w") as f:
|
||||
f.write(doc())
|
||||
|
||||
@@ -122,7 +122,10 @@ def add_vcr_to_notebook(
|
||||
return notebook
|
||||
|
||||
|
||||
def process_notebooks(should_comment_install_cells: bool) -> None:
|
||||
def process_notebooks(
|
||||
should_comment_install_cells: bool,
|
||||
working_directory: str,
|
||||
) -> None:
|
||||
for directory in NOTEBOOK_DIRS:
|
||||
for root, _, files in os.walk(directory):
|
||||
for file in files:
|
||||
@@ -130,6 +133,12 @@ def process_notebooks(should_comment_install_cells: bool) -> None:
|
||||
continue
|
||||
|
||||
notebook_path = os.path.join(root, file)
|
||||
# Filter notebooks based on the working_directory input
|
||||
if working_directory != "all" and not notebook_path.startswith(
|
||||
working_directory
|
||||
):
|
||||
continue
|
||||
|
||||
try:
|
||||
notebook = nbformat.read(notebook_path, as_version=4)
|
||||
|
||||
@@ -172,8 +181,16 @@ def process_notebooks(should_comment_install_cells: bool) -> None:
|
||||
default=False,
|
||||
help="Whether to comment out install cells",
|
||||
)
|
||||
def main(comment_install_cells):
|
||||
process_notebooks(should_comment_install_cells=comment_install_cells)
|
||||
@click.option(
|
||||
"--working-directory",
|
||||
default="all",
|
||||
help="Working directory or specific notebook to process",
|
||||
)
|
||||
def main(comment_install_cells, working_directory):
|
||||
process_notebooks(
|
||||
should_comment_install_cells=comment_install_cells,
|
||||
working_directory=working_directory,
|
||||
)
|
||||
logger.info("All notebooks processed successfully.")
|
||||
|
||||
|
||||
|
||||
33
docs/scripts/update_cassettes.sh
Executable file
33
docs/scripts/update_cassettes.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the working directory from the input argument, default to 'all' if not provided
|
||||
WORKING_DIRECTORY=${1:-all}
|
||||
|
||||
# Function to delete cassettes
|
||||
delete_cassettes() {
|
||||
local dir=$1
|
||||
if [ "$dir" == "all" ]; then
|
||||
echo "Deleting all cassettes..."
|
||||
rm -f docs/cassettes/*.msgpack.zlib
|
||||
else
|
||||
# Extract the filename from the directory path
|
||||
local filename=$(basename "$dir" .ipynb)
|
||||
echo "Deleting cassettes for $filename..."
|
||||
rm -f docs/cassettes/${filename}_*.msgpack.zlib
|
||||
fi
|
||||
}
|
||||
|
||||
# Delete existing cassettes
|
||||
delete_cassettes "$WORKING_DIRECTORY"
|
||||
|
||||
# Pre-download tiktoken files
|
||||
echo "Pre-downloading tiktoken files..."
|
||||
poetry run python docs/scripts/download_tiktoken.py
|
||||
|
||||
# Prepare notebooks
|
||||
echo "Preparing notebooks for CI..."
|
||||
poetry run python docs/scripts/prepare_notebooks_for_ci.py --comment-install-cells --working-directory "$WORKING_DIRECTORY"
|
||||
|
||||
# Run notebooks
|
||||
echo "Running notebooks..."
|
||||
./docs/scripts/execute_notebooks.sh "$WORKING_DIRECTORY"
|
||||
@@ -126,28 +126,49 @@ module.exports = {
|
||||
collapsible: false,
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
dirName: "integrations/platforms",
|
||||
type: "doc",
|
||||
id: "integrations/providers/anthropic",
|
||||
},
|
||||
{
|
||||
type: "doc",
|
||||
id: "integrations/providers/aws",
|
||||
},
|
||||
{
|
||||
type: "doc",
|
||||
id: "integrations/providers/google",
|
||||
},
|
||||
{
|
||||
type: "doc",
|
||||
id: "integrations/providers/huggingface",
|
||||
},
|
||||
{
|
||||
type: "doc",
|
||||
id: "integrations/providers/microsoft",
|
||||
},
|
||||
{
|
||||
type: "doc",
|
||||
id: "integrations/providers/openai",
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "More",
|
||||
collapsed: true,
|
||||
collapsible: false,
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
dirName: "integrations/providers",
|
||||
className: "hidden",
|
||||
},
|
||||
],
|
||||
link: {
|
||||
type: "generated-index",
|
||||
slug: "integrations/providers",
|
||||
slug: "integrations/providers/all",
|
||||
},
|
||||
},
|
||||
],
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "integrations/platforms/index",
|
||||
id: "integrations/providers/index",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,11 +1,25 @@
|
||||
import React from 'react';
|
||||
import Paginator from '@theme-original/DocItem/Paginator';
|
||||
import Feedback from "@theme/Feedback";
|
||||
import Giscus from "@giscus/react";
|
||||
|
||||
export default function PaginatorWrapper(props) {
|
||||
return (
|
||||
<>
|
||||
<Feedback />
|
||||
<Giscus
|
||||
repo="langchain-ai/langchain"
|
||||
repoId="R_kgDOIPDwlg"
|
||||
category="Docs Discussions"
|
||||
categoryId="DIC_kwDOIPDwls4CjJYb"
|
||||
mapping="pathname"
|
||||
strict="0"
|
||||
reactionsEnabled="0"
|
||||
emitMetadata="0"
|
||||
inputPosition="bottom"
|
||||
theme="preferred_color_scheme"
|
||||
lang="en"
|
||||
loading="lazy" />
|
||||
<Paginator {...props} />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -220,10 +220,6 @@ export default function Feedback() {
|
||||
onMouseUp: (e) => (e.currentTarget.style.backgroundColor = "#f0f0f0"),
|
||||
};
|
||||
|
||||
const newGithubIssueURL = pathname
|
||||
? `https://github.com/langchain-ai/langchain/issues/new?assignees=&labels=03+-+Documentation&projects=&template=documentation.yml&title=DOC%3A+%3CIssue+related+to+${pathname}%3E&url=https://python.langchain.com${pathname}`
|
||||
: "https://github.com/langchain-ai/langchain/issues/new?assignees=&labels=03+-+Documentation&projects=&template=documentation.yml&title=DOC%3A+%3CPlease+write+a+comprehensive+title+after+the+%27DOC%3A+%27+prefix%3E";
|
||||
|
||||
return (
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
<hr />
|
||||
@@ -296,14 +292,6 @@ export default function Feedback() {
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<br />
|
||||
<h4>
|
||||
You can also leave detailed feedback{" "}
|
||||
<a target="_blank" href={newGithubIssueURL}>
|
||||
on GitHub
|
||||
</a>
|
||||
.
|
||||
</h4>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2769,8 +2769,8 @@ const suggestedLinks = {
|
||||
"/docs/integrations/chat/hunyuan/": {"canonical": "/docs/integrations/chat/tencent_hunyuan/"},
|
||||
"/docs/integrations/document_loaders/excel/": {"canonical": "/docs/integrations/document_loaders/microsoft_excel/"},
|
||||
"/docs/integrations/document_loaders/onenote/": {"canonical": "/docs/integrations/document_loaders/microsoft_onenote/"},
|
||||
"/docs/integrations/providers/aws_dynamodb/": {"canonical": "/docs/integrations/platforms/aws/"},
|
||||
"/docs/integrations/providers/scann/": {"canonical": "/docs/integrations/platforms/google/"},
|
||||
"/docs/integrations/providers/aws_dynamodb/": {"canonical": "/docs/integrations/providers/aws/"},
|
||||
"/docs/integrations/providers/scann/": {"canonical": "/docs/integrations/providers/google/"},
|
||||
"/docs/integrations/toolkits/google_drive/": {"canonical": "/docs/integrations/tools/google_drive/"},
|
||||
"/docs/use_cases/question_answering/chat_vector_db/": {"canonical": "/docs/tutorials/rag/", "alternative": ["/v0.1/docs/use_cases/question_answering/"]},
|
||||
"/docs/use_cases/question_answering/in_memory_question_answering/": {"canonical": "/docs/tutorials/rag/", "alternative": ["/v0.1/docs/use_cases/question_answering/"]},
|
||||
@@ -2791,24 +2791,24 @@ const suggestedLinks = {
|
||||
"/docs/integrations/": {"canonical": "/docs/integrations/providers/"},
|
||||
"/docs/expression_language/cookbook/routing/": {"canonical": "/docs/how_to/routing/", "alternative": ["/v0.1/docs/expression_language/how_to/routing/"]},
|
||||
"/docs/guides/expression_language/": {"canonical": "/docs/how_to/#langchain-expression-language-lcel", "alternative": ["/v0.1/docs/expression_language/"]},
|
||||
"/docs/integrations/providers/amazon_api_gateway/": {"canonical": "/docs/integrations/platforms/aws/"},
|
||||
"/docs/integrations/providers/huggingface/": {"canonical": "/docs/integrations/platforms/huggingface/"},
|
||||
"/docs/integrations/providers/azure_blob_storage/": {"canonical": "/docs/integrations/platforms/microsoft/"},
|
||||
"/docs/integrations/providers/google_vertexai_matchingengine/": {"canonical": "/docs/integrations/platforms/google/"},
|
||||
"/docs/integrations/providers/aws_s3/": {"canonical": "/docs/integrations/platforms/aws/"},
|
||||
"/docs/integrations/providers/azure_openai/": {"canonical": "/docs/integrations/platforms/microsoft/"},
|
||||
"/docs/integrations/providers/azure_cognitive_search_/": {"canonical": "/docs/integrations/platforms/microsoft/"},
|
||||
"/docs/integrations/providers/bedrock/": {"canonical": "/docs/integrations/platforms/aws/"},
|
||||
"/docs/integrations/providers/google_bigquery/": {"canonical": "/docs/integrations/platforms/google/"},
|
||||
"/docs/integrations/providers/google_cloud_storage/": {"canonical": "/docs/integrations/platforms/google/"},
|
||||
"/docs/integrations/providers/google_drive/": {"canonical": "/docs/integrations/platforms/google/"},
|
||||
"/docs/integrations/providers/google_search/": {"canonical": "/docs/integrations/platforms/google/"},
|
||||
"/docs/integrations/providers/microsoft_onedrive/": {"canonical": "/docs/integrations/platforms/microsoft/"},
|
||||
"/docs/integrations/providers/microsoft_powerpoint/": {"canonical": "/docs/integrations/platforms/microsoft/"},
|
||||
"/docs/integrations/providers/microsoft_word/": {"canonical": "/docs/integrations/platforms/microsoft/"},
|
||||
"/docs/integrations/providers/sagemaker_endpoint/": {"canonical": "/docs/integrations/platforms/aws/"},
|
||||
"/docs/integrations/providers/amazon_api_gateway/": {"canonical": "/docs/integrations/providers/aws/"},
|
||||
"/docs/integrations/providers/huggingface/": {"canonical": "/docs/integrations/providers/huggingface/"},
|
||||
"/docs/integrations/providers/azure_blob_storage/": {"canonical": "/docs/integrations/providers/microsoft/"},
|
||||
"/docs/integrations/providers/google_vertexai_matchingengine/": {"canonical": "/docs/integrations/providers/google/"},
|
||||
"/docs/integrations/providers/aws_s3/": {"canonical": "/docs/integrations/providers/aws/"},
|
||||
"/docs/integrations/providers/azure_openai/": {"canonical": "/docs/integrations/providers/microsoft/"},
|
||||
"/docs/integrations/providers/azure_cognitive_search_/": {"canonical": "/docs/integrations/providers/microsoft/"},
|
||||
"/docs/integrations/providers/bedrock/": {"canonical": "/docs/integrations/providers/aws/"},
|
||||
"/docs/integrations/providers/google_bigquery/": {"canonical": "/docs/integrations/providers/google/"},
|
||||
"/docs/integrations/providers/google_cloud_storage/": {"canonical": "/docs/integrations/providers/google/"},
|
||||
"/docs/integrations/providers/google_drive/": {"canonical": "/docs/integrations/providers/google/"},
|
||||
"/docs/integrations/providers/google_search/": {"canonical": "/docs/integrations/providers/google/"},
|
||||
"/docs/integrations/providers/microsoft_onedrive/": {"canonical": "/docs/integrations/providers/microsoft/"},
|
||||
"/docs/integrations/providers/microsoft_powerpoint/": {"canonical": "/docs/integrations/providers/microsoft/"},
|
||||
"/docs/integrations/providers/microsoft_word/": {"canonical": "/docs/integrations/providers/microsoft/"},
|
||||
"/docs/integrations/providers/sagemaker_endpoint/": {"canonical": "/docs/integrations/providers/aws/"},
|
||||
"/docs/integrations/providers/sagemaker_tracking/": {"canonical": "/docs/integrations/callbacks/sagemaker_tracking/"},
|
||||
"/docs/integrations/providers/openai/": {"canonical": "/docs/integrations/platforms/openai/"},
|
||||
"/docs/integrations/providers/openai/": {"canonical": "/docs/integrations/providers/openai/"},
|
||||
"/docs/integrations/cassandra/": {"canonical": "/docs/integrations/providers/cassandra/"},
|
||||
"/docs/integrations/providers/providers/semadb/": {"canonical": "/docs/integrations/providers/semadb/"},
|
||||
"/docs/integrations/vectorstores/vectorstores/semadb/": {"canonical": "/docs/integrations/vectorstores/semadb/"},
|
||||
@@ -2819,7 +2819,7 @@ const suggestedLinks = {
|
||||
"/docs/integrations/document_loaders/Etherscan/": {"canonical": "/docs/integrations/document_loaders/etherscan/"},
|
||||
"/docs/integrations/document_loaders/merge_doc_loader/": {"canonical": "/docs/integrations/document_loaders/merge_doc/"},
|
||||
"/docs/integrations/document_loaders/recursive_url_loader/": {"canonical": "/docs/integrations/document_loaders/recursive_url/"},
|
||||
"/docs/integrations/providers/google_document_ai/": {"canonical": "/docs/integrations/platforms/google/"},
|
||||
"/docs/integrations/providers/google_document_ai/": {"canonical": "/docs/integrations/providers/google/"},
|
||||
"/docs/integrations/memory/motorhead_memory_managed/": {"canonical": "/docs/integrations/memory/motorhead_memory/"},
|
||||
"/docs/integrations/memory/dynamodb_chat_message_history/": {"canonical": "/docs/integrations/memory/aws_dynamodb/"},
|
||||
"/docs/integrations/memory/entity_memory_with_sqlite/": {"canonical": "/docs/integrations/memory/sqlite/"},
|
||||
|
||||
@@ -81,6 +81,10 @@
|
||||
{
|
||||
"source": "/docs/integrations/providers/mlflow_ai_gateway(/?)",
|
||||
"destination": "/docs/integrations/providers/mlflow/"
|
||||
},
|
||||
{
|
||||
"source": "/docs/integrations/platforms/:path((?:anthropic|aws|google|huggingface|microsoft|openai)?/?)*",
|
||||
"destination": "/docs/integrations/providers/:path*"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1709,6 +1709,13 @@
|
||||
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.1.tgz#de633db3ec2ef6a3c89e2f19038063e8a122e2c2"
|
||||
integrity sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==
|
||||
|
||||
"@giscus/react@^3.0.0":
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@giscus/react/-/react-3.0.0.tgz#fdadce2c7e4023eb4fdbcc219cdd97f6d7aa17f0"
|
||||
integrity sha512-hgCjLpg3Wgh8VbTF5p8ZLcIHI74wvDk1VIFv12+eKhenNVUDjgwNg2B1aq/3puyHOad47u/ZSyqiMtohjy/OOA==
|
||||
dependencies:
|
||||
giscus "^1.5.0"
|
||||
|
||||
"@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0":
|
||||
version "9.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb"
|
||||
@@ -1835,6 +1842,18 @@
|
||||
resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz#4fc56c15c580b9adb7dc3c333a134e540b44bfb1"
|
||||
integrity sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==
|
||||
|
||||
"@lit-labs/ssr-dom-shim@^1.2.0":
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.2.1.tgz#2f3a8f1d688935c704dbc89132394a41029acbb8"
|
||||
integrity sha512-wx4aBmgeGvFmOKucFKY+8VFJSYZxs9poN3SDNQFF6lT6NrQUnHiPB2PWz2sc4ieEcAaYYzN+1uWahEeTq2aRIQ==
|
||||
|
||||
"@lit/reactive-element@^2.0.4":
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-2.0.4.tgz#8f2ed950a848016383894a26180ff06c56ae001b"
|
||||
integrity sha512-GFn91inaUa2oHLak8awSIigYz0cU0Payr1rcFsrkf5OJ5eSPxElyZfKh0f2p9FsTiZWXQdWGJeXZICEfXXYSXQ==
|
||||
dependencies:
|
||||
"@lit-labs/ssr-dom-shim" "^1.2.0"
|
||||
|
||||
"@mdx-js/mdx@^3.0.0":
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@mdx-js/mdx/-/mdx-3.0.1.tgz#617bd2629ae561fdca1bb88e3badd947f5a82191"
|
||||
@@ -2569,7 +2588,7 @@
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/trusted-types@*":
|
||||
"@types/trusted-types@*", "@types/trusted-types@^2.0.2":
|
||||
version "2.0.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.7.tgz#baccb07a970b91707df3a3e8ba6896c57ead2d11"
|
||||
integrity sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==
|
||||
@@ -5549,6 +5568,13 @@ get-symbol-description@^1.0.2:
|
||||
es-errors "^1.3.0"
|
||||
get-intrinsic "^1.2.4"
|
||||
|
||||
giscus@^1.5.0:
|
||||
version "1.5.0"
|
||||
resolved "https://registry.yarnpkg.com/giscus/-/giscus-1.5.0.tgz#8299fa056b2ed31ec8b05d4645871e016982b4b2"
|
||||
integrity sha512-t3LL0qbSO3JXq3uyQeKpF5CegstGfKX/0gI6eDe1cmnI7D56R7j52yLdzw4pdKrg3VnufwCgCM3FDz7G1Qr6lg==
|
||||
dependencies:
|
||||
lit "^3.1.2"
|
||||
|
||||
github-slugger@^1.5.0:
|
||||
version "1.5.0"
|
||||
resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-1.5.0.tgz#17891bbc73232051474d68bd867a34625c955f7d"
|
||||
@@ -6882,6 +6908,31 @@ lines-and-columns@^1.1.6:
|
||||
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
|
||||
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
|
||||
|
||||
lit-element@^4.1.0:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-4.1.1.tgz#07905992815076e388cf6f1faffc7d6866c82007"
|
||||
integrity sha512-HO9Tkkh34QkTeUmEdNYhMT8hzLid7YlMlATSi1q4q17HE5d9mrrEHJ/o8O2D0cMi182zK1F3v7x0PWFjrhXFew==
|
||||
dependencies:
|
||||
"@lit-labs/ssr-dom-shim" "^1.2.0"
|
||||
"@lit/reactive-element" "^2.0.4"
|
||||
lit-html "^3.2.0"
|
||||
|
||||
lit-html@^3.2.0:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-3.2.1.tgz#8fc49e3531ee5947e4d93e8a5aa642ab1649833b"
|
||||
integrity sha512-qI/3lziaPMSKsrwlxH/xMgikhQ0EGOX2ICU73Bi/YHFvz2j/yMCIrw4+puF2IpQ4+upd3EWbvnHM9+PnJn48YA==
|
||||
dependencies:
|
||||
"@types/trusted-types" "^2.0.2"
|
||||
|
||||
lit@^3.1.2:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/lit/-/lit-3.2.1.tgz#d6dd15eac20db3a098e81e2c85f70a751ff55592"
|
||||
integrity sha512-1BBa1E/z0O9ye5fZprPtdqnc0BFzxIxTTOO/tQFmyC/hj1O3jL4TfmLBw0WEwjAokdLwpclkvGgDJwTIh0/22w==
|
||||
dependencies:
|
||||
"@lit/reactive-element" "^2.0.4"
|
||||
lit-element "^4.1.0"
|
||||
lit-html "^3.2.0"
|
||||
|
||||
loader-runner@^4.2.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1"
|
||||
|
||||
@@ -38,6 +38,7 @@ jinja2>=3,<4
|
||||
jq>=1.4.1,<2
|
||||
jsonschema>1
|
||||
keybert>=0.8.5
|
||||
langchain_openai>=0.2.1
|
||||
litellm>=1.30,<=1.39.5
|
||||
lxml>=4.9.3,<6.0
|
||||
markdownify>=0.11.6,<0.12
|
||||
|
||||
@@ -356,7 +356,7 @@ def _create_api_controller_tool(
|
||||
for endpoint_name in endpoint_names:
|
||||
found_match = False
|
||||
for name, _, docs in api_spec.endpoints:
|
||||
regex_name = re.compile(re.sub("\{.*?\}", ".*", name))
|
||||
regex_name = re.compile(re.sub("\\{.*?\\}", ".*", name))
|
||||
if regex_name.match(endpoint_name):
|
||||
found_match = True
|
||||
docs_str += f"== Docs for {endpoint_name} == \n{yaml.dump(docs)}\n"
|
||||
|
||||
@@ -125,6 +125,11 @@ if TYPE_CHECKING:
|
||||
from langchain_community.chat_models.moonshot import (
|
||||
MoonshotChat,
|
||||
)
|
||||
from langchain_community.chat_models.oci_data_science import (
|
||||
ChatOCIModelDeployment,
|
||||
ChatOCIModelDeploymentTGI,
|
||||
ChatOCIModelDeploymentVLLM,
|
||||
)
|
||||
from langchain_community.chat_models.oci_generative_ai import (
|
||||
ChatOCIGenAI, # noqa: F401
|
||||
)
|
||||
@@ -211,6 +216,9 @@ __all__ = [
|
||||
"ChatMlflow",
|
||||
"ChatNebula",
|
||||
"ChatOCIGenAI",
|
||||
"ChatOCIModelDeployment",
|
||||
"ChatOCIModelDeploymentVLLM",
|
||||
"ChatOCIModelDeploymentTGI",
|
||||
"ChatOllama",
|
||||
"ChatOpenAI",
|
||||
"ChatPerplexity",
|
||||
@@ -272,6 +280,9 @@ _module_lookup = {
|
||||
"ChatNebula": "langchain_community.chat_models.symblai_nebula",
|
||||
"ChatOctoAI": "langchain_community.chat_models.octoai",
|
||||
"ChatOCIGenAI": "langchain_community.chat_models.oci_generative_ai",
|
||||
"ChatOCIModelDeployment": "langchain_community.chat_models.oci_data_science",
|
||||
"ChatOCIModelDeploymentVLLM": "langchain_community.chat_models.oci_data_science",
|
||||
"ChatOCIModelDeploymentTGI": "langchain_community.chat_models.oci_data_science",
|
||||
"ChatOllama": "langchain_community.chat_models.ollama",
|
||||
"ChatOpenAI": "langchain_community.chat_models.openai",
|
||||
"ChatPerplexity": "langchain_community.chat_models.perplexity",
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
import logging
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from langchain_core._api import deprecated
|
||||
|
||||
from langchain_community.chat_models.mlflow import ChatMlflow
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@deprecated(
|
||||
since="0.3.3",
|
||||
removal="1.0",
|
||||
alternative_import="langchain_databricks.ChatDatabricks",
|
||||
)
|
||||
class ChatDatabricks(ChatMlflow):
|
||||
"""`Databricks` chat models API.
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ class ChatLlamaCpp(BaseChatModel):
|
||||
self,
|
||||
tools: Sequence[Union[Dict[str, Any], Type[BaseModel], Callable, BaseTool]],
|
||||
*,
|
||||
tool_choice: Optional[Union[Dict[str, Dict], bool, str]] = None,
|
||||
tool_choice: Optional[Union[dict, bool, str]] = None,
|
||||
**kwargs: Any,
|
||||
) -> Runnable[LanguageModelInput, BaseMessage]:
|
||||
"""Bind tool-like objects to this chat model
|
||||
@@ -538,7 +538,8 @@ class ChatLlamaCpp(BaseChatModel):
|
||||
"Received None."
|
||||
)
|
||||
tool_name = convert_to_openai_tool(schema)["function"]["name"]
|
||||
llm = self.bind_tools([schema], tool_choice=tool_name)
|
||||
tool_choice = {"type": "function", "function": {"name": tool_name}}
|
||||
llm = self.bind_tools([schema], tool_choice=tool_choice)
|
||||
if is_pydantic_schema:
|
||||
output_parser: OutputParserLike = PydanticToolsParser(
|
||||
tools=[cast(Type, schema)], first_tool_only=True
|
||||
|
||||
@@ -0,0 +1,998 @@
|
||||
# Copyright (c) 2024, Oracle and/or its affiliates.
|
||||
|
||||
"""Chat model for OCI data science model deployment endpoint."""
|
||||
|
||||
import importlib
|
||||
import json
|
||||
import logging
|
||||
from operator import itemgetter
|
||||
from typing import (
|
||||
Any,
|
||||
AsyncIterator,
|
||||
Callable,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Literal,
|
||||
Optional,
|
||||
Sequence,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
from langchain_core.callbacks import (
|
||||
AsyncCallbackManagerForLLMRun,
|
||||
CallbackManagerForLLMRun,
|
||||
)
|
||||
from langchain_core.language_models import LanguageModelInput
|
||||
from langchain_core.language_models.chat_models import (
|
||||
BaseChatModel,
|
||||
agenerate_from_stream,
|
||||
generate_from_stream,
|
||||
)
|
||||
from langchain_core.messages import AIMessageChunk, BaseMessage, BaseMessageChunk
|
||||
from langchain_core.output_parsers import (
|
||||
JsonOutputParser,
|
||||
PydanticOutputParser,
|
||||
)
|
||||
from langchain_core.outputs import ChatGeneration, ChatGenerationChunk, ChatResult
|
||||
from langchain_core.runnables import Runnable, RunnableMap, RunnablePassthrough
|
||||
from langchain_core.tools import BaseTool
|
||||
from langchain_core.utils.function_calling import convert_to_openai_tool
|
||||
from pydantic import BaseModel, Field, model_validator
|
||||
|
||||
from langchain_community.llms.oci_data_science_model_deployment_endpoint import (
|
||||
DEFAULT_MODEL_NAME,
|
||||
BaseOCIModelDeployment,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _is_pydantic_class(obj: Any) -> bool:
|
||||
return isinstance(obj, type) and issubclass(obj, BaseModel)
|
||||
|
||||
|
||||
class ChatOCIModelDeployment(BaseChatModel, BaseOCIModelDeployment):
|
||||
"""OCI Data Science Model Deployment chat model integration.
|
||||
|
||||
Setup:
|
||||
Install ``oracle-ads`` and ``langchain-openai``.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install -U oracle-ads langchain-openai
|
||||
|
||||
Use `ads.set_auth()` to configure authentication.
|
||||
For example, to use OCI resource_principal for authentication:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import ads
|
||||
ads.set_auth("resource_principal")
|
||||
|
||||
For more details on authentication, see:
|
||||
https://accelerated-data-science.readthedocs.io/en/latest/user_guide/cli/authentication.html
|
||||
|
||||
Make sure to have the required policies to access the OCI Data
|
||||
Science Model Deployment endpoint. See:
|
||||
https://docs.oracle.com/en-us/iaas/data-science/using/model-dep-policies-auth.htm
|
||||
|
||||
|
||||
Key init args - completion params:
|
||||
endpoint: str
|
||||
The OCI model deployment endpoint.
|
||||
temperature: float
|
||||
Sampling temperature.
|
||||
max_tokens: Optional[int]
|
||||
Max number of tokens to generate.
|
||||
|
||||
Key init args — client params:
|
||||
auth: dict
|
||||
ADS auth dictionary for OCI authentication.
|
||||
|
||||
Instantiate:
|
||||
.. code-block:: python
|
||||
|
||||
from langchain_community.chat_models import ChatOCIModelDeployment
|
||||
|
||||
chat = ChatOCIModelDeployment(
|
||||
endpoint="https://modeldeployment.<region>.oci.customer-oci.com/<ocid>/predict",
|
||||
model="odsc-llm",
|
||||
streaming=True,
|
||||
max_retries=3,
|
||||
model_kwargs={
|
||||
"max_token": 512,
|
||||
"temperature": 0.2,
|
||||
# other model parameters ...
|
||||
},
|
||||
)
|
||||
|
||||
Invocation:
|
||||
.. code-block:: python
|
||||
|
||||
messages = [
|
||||
("system", "Translate the user sentence to French."),
|
||||
("human", "Hello World!"),
|
||||
]
|
||||
chat.invoke(messages)
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
AIMessage(
|
||||
content='Bonjour le monde!',
|
||||
response_metadata={
|
||||
'token_usage': {
|
||||
'prompt_tokens': 40,
|
||||
'total_tokens': 50,
|
||||
'completion_tokens': 10
|
||||
},
|
||||
'model_name': 'odsc-llm',
|
||||
'system_fingerprint': '',
|
||||
'finish_reason': 'stop'
|
||||
},
|
||||
id='run-cbed62da-e1b3-4abd-9df3-ec89d69ca012-0'
|
||||
)
|
||||
|
||||
Streaming:
|
||||
.. code-block:: python
|
||||
|
||||
for chunk in chat.stream(messages):
|
||||
print(chunk)
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
content='' id='run-02c6-c43f-42de'
|
||||
content='\n' id='run-02c6-c43f-42de'
|
||||
content='B' id='run-02c6-c43f-42de'
|
||||
content='on' id='run-02c6-c43f-42de'
|
||||
content='j' id='run-02c6-c43f-42de'
|
||||
content='our' id='run-02c6-c43f-42de'
|
||||
content=' le' id='run-02c6-c43f-42de'
|
||||
content=' monde' id='run-02c6-c43f-42de'
|
||||
content='!' id='run-02c6-c43f-42de'
|
||||
content='' response_metadata={'finish_reason': 'stop'} id='run-02c6-c43f-42de'
|
||||
|
||||
Async:
|
||||
.. code-block:: python
|
||||
|
||||
await chat.ainvoke(messages)
|
||||
|
||||
# stream:
|
||||
# async for chunk in (await chat.astream(messages))
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
AIMessage(
|
||||
content='Bonjour le monde!',
|
||||
response_metadata={'finish_reason': 'stop'},
|
||||
id='run-8657a105-96b7-4bb6-b98e-b69ca420e5d1-0'
|
||||
)
|
||||
|
||||
Structured output:
|
||||
.. code-block:: python
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
class Joke(BaseModel):
|
||||
setup: str = Field(description="The setup of the joke")
|
||||
punchline: str = Field(description="The punchline to the joke")
|
||||
|
||||
structured_llm = chat.with_structured_output(Joke, method="json_mode")
|
||||
structured_llm.invoke(
|
||||
"Tell me a joke about cats, "
|
||||
"respond in JSON with `setup` and `punchline` keys"
|
||||
)
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
Joke(
|
||||
setup='Why did the cat get stuck in the tree?',
|
||||
punchline='Because it was chasing its tail!'
|
||||
)
|
||||
|
||||
See ``ChatOCIModelDeployment.with_structured_output()`` for more.
|
||||
|
||||
Customized Usage:
|
||||
You can inherit from base class and overwrite the `_process_response`,
|
||||
`_process_stream_response`, `_construct_json_body` for customized usage.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class MyChatModel(ChatOCIModelDeployment):
|
||||
def _process_stream_response(self, response_json: dict) -> ChatGenerationChunk:
|
||||
print("My customized streaming result handler.")
|
||||
return GenerationChunk(...)
|
||||
|
||||
def _process_response(self, response_json:dict) -> ChatResult:
|
||||
print("My customized output handler.")
|
||||
return ChatResult(...)
|
||||
|
||||
def _construct_json_body(self, messages: list, params: dict) -> dict:
|
||||
print("My customized payload handler.")
|
||||
return {
|
||||
"messages": messages,
|
||||
**params,
|
||||
}
|
||||
|
||||
chat = MyChatModel(
|
||||
endpoint=f"https://modeldeployment.<region>.oci.customer-oci.com/{ocid}/predict",
|
||||
model="odsc-llm",
|
||||
}
|
||||
|
||||
chat.invoke("tell me a joke")
|
||||
|
||||
Response metadata
|
||||
.. code-block:: python
|
||||
|
||||
ai_msg = chat.invoke(messages)
|
||||
ai_msg.response_metadata
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
{
|
||||
'token_usage': {
|
||||
'prompt_tokens': 40,
|
||||
'total_tokens': 50,
|
||||
'completion_tokens': 10
|
||||
},
|
||||
'model_name': 'odsc-llm',
|
||||
'system_fingerprint': '',
|
||||
'finish_reason': 'stop'
|
||||
}
|
||||
|
||||
""" # noqa: E501
|
||||
|
||||
model_kwargs: Dict[str, Any] = Field(default_factory=dict)
|
||||
"""Keyword arguments to pass to the model."""
|
||||
|
||||
model: str = DEFAULT_MODEL_NAME
|
||||
"""The name of the model."""
|
||||
|
||||
stop: Optional[List[str]] = None
|
||||
"""Stop words to use when generating. Model output is cut off
|
||||
at the first occurrence of any of these substrings."""
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def validate_openai(cls, values: Any) -> Any:
|
||||
"""Checks if langchain_openai is installed."""
|
||||
if not importlib.util.find_spec("langchain_openai"):
|
||||
raise ImportError(
|
||||
"Could not import langchain_openai package. "
|
||||
"Please install it with `pip install langchain_openai`."
|
||||
)
|
||||
return values
|
||||
|
||||
@property
|
||||
def _llm_type(self) -> str:
|
||||
"""Return type of llm."""
|
||||
return "oci_model_depolyment_chat_endpoint"
|
||||
|
||||
@property
|
||||
def _identifying_params(self) -> Dict[str, Any]:
|
||||
"""Get the identifying parameters."""
|
||||
_model_kwargs = self.model_kwargs or {}
|
||||
return {
|
||||
**{"endpoint": self.endpoint, "model_kwargs": _model_kwargs},
|
||||
**self._default_params,
|
||||
}
|
||||
|
||||
@property
|
||||
def _default_params(self) -> Dict[str, Any]:
|
||||
"""Get the default parameters."""
|
||||
return {
|
||||
"model": self.model,
|
||||
"stop": self.stop,
|
||||
"stream": self.streaming,
|
||||
}
|
||||
|
||||
def _generate(
|
||||
self,
|
||||
messages: List[BaseMessage],
|
||||
stop: Optional[List[str]] = None,
|
||||
run_manager: Optional[CallbackManagerForLLMRun] = None,
|
||||
**kwargs: Any,
|
||||
) -> ChatResult:
|
||||
"""Call out to an OCI Model Deployment Online endpoint.
|
||||
|
||||
Args:
|
||||
messages: The messages in the conversation with the chat model.
|
||||
stop: Optional list of stop words to use when generating.
|
||||
|
||||
Returns:
|
||||
LangChain ChatResult
|
||||
|
||||
Raises:
|
||||
RuntimeError:
|
||||
Raise when invoking endpoint fails.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
messages = [
|
||||
(
|
||||
"system",
|
||||
"You are a helpful assistant that translates English to French. Translate the user sentence.",
|
||||
),
|
||||
("human", "Hello World!"),
|
||||
]
|
||||
|
||||
response = chat.invoke(messages)
|
||||
""" # noqa: E501
|
||||
if self.streaming:
|
||||
stream_iter = self._stream(
|
||||
messages, stop=stop, run_manager=run_manager, **kwargs
|
||||
)
|
||||
return generate_from_stream(stream_iter)
|
||||
|
||||
requests_kwargs = kwargs.pop("requests_kwargs", {})
|
||||
params = self._invocation_params(stop, **kwargs)
|
||||
body = self._construct_json_body(messages, params)
|
||||
res = self.completion_with_retry(
|
||||
data=body, run_manager=run_manager, **requests_kwargs
|
||||
)
|
||||
return self._process_response(res.json())
|
||||
|
||||
def _stream(
|
||||
self,
|
||||
messages: List[BaseMessage],
|
||||
stop: Optional[List[str]] = None,
|
||||
run_manager: Optional[CallbackManagerForLLMRun] = None,
|
||||
**kwargs: Any,
|
||||
) -> Iterator[ChatGenerationChunk]:
|
||||
"""Stream OCI Data Science Model Deployment endpoint on given messages.
|
||||
|
||||
Args:
|
||||
messages (List[BaseMessage]):
|
||||
The messagaes to pass into the model.
|
||||
stop (List[str], Optional):
|
||||
List of stop words to use when generating.
|
||||
kwargs:
|
||||
requests_kwargs:
|
||||
Additional ``**kwargs`` to pass to requests.post
|
||||
|
||||
Returns:
|
||||
An iterator of ChatGenerationChunk.
|
||||
|
||||
Raises:
|
||||
RuntimeError:
|
||||
Raise when invoking endpoint fails.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
messages = [
|
||||
(
|
||||
"system",
|
||||
"You are a helpful assistant that translates English to French. Translate the user sentence.",
|
||||
),
|
||||
("human", "Hello World!"),
|
||||
]
|
||||
|
||||
chunk_iter = chat.stream(messages)
|
||||
|
||||
""" # noqa: E501
|
||||
requests_kwargs = kwargs.pop("requests_kwargs", {})
|
||||
self.streaming = True
|
||||
params = self._invocation_params(stop, **kwargs)
|
||||
body = self._construct_json_body(messages, params) # request json body
|
||||
|
||||
response = self.completion_with_retry(
|
||||
data=body, run_manager=run_manager, stream=True, **requests_kwargs
|
||||
)
|
||||
default_chunk_class = AIMessageChunk
|
||||
for line in self._parse_stream(response.iter_lines()):
|
||||
chunk = self._handle_sse_line(line, default_chunk_class)
|
||||
if run_manager:
|
||||
run_manager.on_llm_new_token(chunk.text, chunk=chunk)
|
||||
yield chunk
|
||||
|
||||
async def _agenerate(
|
||||
self,
|
||||
messages: List[BaseMessage],
|
||||
stop: Optional[List[str]] = None,
|
||||
run_manager: Optional[AsyncCallbackManagerForLLMRun] = None,
|
||||
**kwargs: Any,
|
||||
) -> ChatResult:
|
||||
"""Asynchronously call out to OCI Data Science Model Deployment
|
||||
endpoint on given messages.
|
||||
|
||||
Args:
|
||||
messages (List[BaseMessage]):
|
||||
The messagaes to pass into the model.
|
||||
stop (List[str], Optional):
|
||||
List of stop words to use when generating.
|
||||
kwargs:
|
||||
requests_kwargs:
|
||||
Additional ``**kwargs`` to pass to requests.post
|
||||
|
||||
Returns:
|
||||
LangChain ChatResult.
|
||||
|
||||
Raises:
|
||||
ValueError:
|
||||
Raise when invoking endpoint fails.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
messages = [
|
||||
(
|
||||
"system",
|
||||
"You are a helpful assistant that translates English to French. Translate the user sentence.",
|
||||
),
|
||||
("human", "I love programming."),
|
||||
]
|
||||
|
||||
resp = await chat.ainvoke(messages)
|
||||
|
||||
""" # noqa: E501
|
||||
if self.streaming:
|
||||
stream_iter = self._astream(
|
||||
messages, stop=stop, run_manager=run_manager, **kwargs
|
||||
)
|
||||
return await agenerate_from_stream(stream_iter)
|
||||
|
||||
requests_kwargs = kwargs.pop("requests_kwargs", {})
|
||||
params = self._invocation_params(stop, **kwargs)
|
||||
body = self._construct_json_body(messages, params)
|
||||
response = await self.acompletion_with_retry(
|
||||
data=body,
|
||||
run_manager=run_manager,
|
||||
**requests_kwargs,
|
||||
)
|
||||
return self._process_response(response)
|
||||
|
||||
async def _astream(
|
||||
self,
|
||||
messages: List[BaseMessage],
|
||||
stop: Optional[List[str]] = None,
|
||||
run_manager: Optional[AsyncCallbackManagerForLLMRun] = None,
|
||||
**kwargs: Any,
|
||||
) -> AsyncIterator[ChatGenerationChunk]:
|
||||
"""Asynchronously streaming OCI Data Science Model Deployment
|
||||
endpoint on given messages.
|
||||
|
||||
Args:
|
||||
messages (List[BaseMessage]):
|
||||
The messagaes to pass into the model.
|
||||
stop (List[str], Optional):
|
||||
List of stop words to use when generating.
|
||||
kwargs:
|
||||
requests_kwargs:
|
||||
Additional ``**kwargs`` to pass to requests.post
|
||||
|
||||
Returns:
|
||||
An Asynciterator of ChatGenerationChunk.
|
||||
|
||||
Raises:
|
||||
ValueError:
|
||||
Raise when invoking endpoint fails.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
messages = [
|
||||
(
|
||||
"system",
|
||||
"You are a helpful assistant that translates English to French. Translate the user sentence.",
|
||||
),
|
||||
("human", "I love programming."),
|
||||
]
|
||||
|
||||
chunk_iter = await chat.astream(messages)
|
||||
|
||||
""" # noqa: E501
|
||||
requests_kwargs = kwargs.pop("requests_kwargs", {})
|
||||
self.streaming = True
|
||||
params = self._invocation_params(stop, **kwargs)
|
||||
body = self._construct_json_body(messages, params) # request json body
|
||||
|
||||
default_chunk_class = AIMessageChunk
|
||||
async for line in await self.acompletion_with_retry(
|
||||
data=body, run_manager=run_manager, stream=True, **requests_kwargs
|
||||
):
|
||||
chunk = self._handle_sse_line(line, default_chunk_class)
|
||||
if run_manager:
|
||||
await run_manager.on_llm_new_token(chunk.text, chunk=chunk)
|
||||
yield chunk
|
||||
|
||||
def with_structured_output(
|
||||
self,
|
||||
schema: Optional[Union[Dict, Type[BaseModel]]] = None,
|
||||
*,
|
||||
method: Literal["json_mode"] = "json_mode",
|
||||
include_raw: bool = False,
|
||||
**kwargs: Any,
|
||||
) -> Runnable[LanguageModelInput, Union[Dict, BaseModel]]:
|
||||
"""Model wrapper that returns outputs formatted to match the given schema.
|
||||
|
||||
Args:
|
||||
schema: The output schema as a dict or a Pydantic class. If a Pydantic class
|
||||
then the model output will be an object of that class. If a dict then
|
||||
the model output will be a dict. With a Pydantic class the returned
|
||||
attributes will be validated, whereas with a dict they will not be. If
|
||||
`method` is "function_calling" and `schema` is a dict, then the dict
|
||||
must match the OpenAI function-calling spec.
|
||||
method: The method for steering model generation, currently only support
|
||||
for "json_mode". If "json_mode" then JSON mode will be used. Note that
|
||||
if using "json_mode" then you must include instructions for formatting
|
||||
the output into the desired schema into the model call.
|
||||
include_raw: If False then only the parsed structured output is returned. If
|
||||
an error occurs during model output parsing it will be raised. If True
|
||||
then both the raw model response (a BaseMessage) and the parsed model
|
||||
response will be returned. If an error occurs during output parsing it
|
||||
will be caught and returned as well. The final output is always a dict
|
||||
with keys "raw", "parsed", and "parsing_error".
|
||||
|
||||
Returns:
|
||||
A Runnable that takes any ChatModel input and returns as output:
|
||||
|
||||
If include_raw is True then a dict with keys:
|
||||
raw: BaseMessage
|
||||
parsed: Optional[_DictOrPydantic]
|
||||
parsing_error: Optional[BaseException]
|
||||
|
||||
If include_raw is False then just _DictOrPydantic is returned,
|
||||
where _DictOrPydantic depends on the schema:
|
||||
|
||||
If schema is a Pydantic class then _DictOrPydantic is the Pydantic
|
||||
class.
|
||||
|
||||
If schema is a dict then _DictOrPydantic is a dict.
|
||||
|
||||
""" # noqa: E501
|
||||
if kwargs:
|
||||
raise ValueError(f"Received unsupported arguments {kwargs}")
|
||||
is_pydantic_schema = _is_pydantic_class(schema)
|
||||
if method == "json_mode":
|
||||
llm = self.bind(response_format={"type": "json_object"})
|
||||
output_parser = (
|
||||
PydanticOutputParser(pydantic_object=schema) # type: ignore[type-var, arg-type]
|
||||
if is_pydantic_schema
|
||||
else JsonOutputParser()
|
||||
)
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Unrecognized method argument. Expected `json_mode`."
|
||||
f"Received: `{method}`."
|
||||
)
|
||||
|
||||
if include_raw:
|
||||
parser_assign = RunnablePassthrough.assign(
|
||||
parsed=itemgetter("raw") | output_parser, parsing_error=lambda _: None
|
||||
)
|
||||
parser_none = RunnablePassthrough.assign(parsed=lambda _: None)
|
||||
parser_with_fallback = parser_assign.with_fallbacks(
|
||||
[parser_none], exception_key="parsing_error"
|
||||
)
|
||||
return RunnableMap(raw=llm) | parser_with_fallback
|
||||
else:
|
||||
return llm | output_parser
|
||||
|
||||
def _invocation_params(self, stop: Optional[List[str]], **kwargs: Any) -> dict:
|
||||
"""Combines the invocation parameters with default parameters."""
|
||||
params = self._default_params
|
||||
_model_kwargs = self.model_kwargs or {}
|
||||
params["stop"] = stop or params.get("stop", [])
|
||||
return {**params, **_model_kwargs, **kwargs}
|
||||
|
||||
def _handle_sse_line(
|
||||
self, line: str, default_chunk_cls: Type[BaseMessageChunk] = AIMessageChunk
|
||||
) -> ChatGenerationChunk:
|
||||
"""Handle a single Server-Sent Events (SSE) line and process it into
|
||||
a chat generation chunk.
|
||||
|
||||
Args:
|
||||
line (str): A single line from the SSE stream in string format.
|
||||
default_chunk_cls (AIMessageChunk): The default class for message
|
||||
chunks to be used during the processing of the stream response.
|
||||
|
||||
Returns:
|
||||
ChatGenerationChunk: The processed chat generation chunk. If an error
|
||||
occurs, an empty `ChatGenerationChunk` is returned.
|
||||
"""
|
||||
try:
|
||||
obj = json.loads(line)
|
||||
return self._process_stream_response(obj, default_chunk_cls)
|
||||
except Exception as e:
|
||||
logger.debug(f"Error occurs when processing line={line}: {str(e)}")
|
||||
return ChatGenerationChunk(message=AIMessageChunk(content=""))
|
||||
|
||||
def _construct_json_body(self, messages: list, params: dict) -> dict:
|
||||
"""Constructs the request body as a dictionary (JSON).
|
||||
|
||||
Args:
|
||||
messages (list): A list of message objects to be included in the
|
||||
request body.
|
||||
params (dict): A dictionary of additional parameters to be included
|
||||
in the request body.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary representing the JSON request body, including
|
||||
converted messages and additional parameters.
|
||||
|
||||
"""
|
||||
from langchain_openai.chat_models.base import _convert_message_to_dict
|
||||
|
||||
return {
|
||||
"messages": [_convert_message_to_dict(m) for m in messages],
|
||||
**params,
|
||||
}
|
||||
|
||||
def _process_stream_response(
|
||||
self,
|
||||
response_json: dict,
|
||||
default_chunk_cls: Type[BaseMessageChunk] = AIMessageChunk,
|
||||
) -> ChatGenerationChunk:
|
||||
"""Formats streaming response in OpenAI spec.
|
||||
|
||||
Args:
|
||||
response_json (dict): The JSON response from the streaming endpoint.
|
||||
default_chunk_cls (type, optional): The default class to use for
|
||||
creating message chunks. Defaults to `AIMessageChunk`.
|
||||
|
||||
Returns:
|
||||
ChatGenerationChunk: An object containing the processed message
|
||||
chunk and any relevant generation information such as finish
|
||||
reason and usage.
|
||||
|
||||
Raises:
|
||||
ValueError: If the response JSON is not well-formed or does not
|
||||
contain the expected structure.
|
||||
"""
|
||||
from langchain_openai.chat_models.base import _convert_delta_to_message_chunk
|
||||
|
||||
try:
|
||||
choice = response_json["choices"][0]
|
||||
if not isinstance(choice, dict):
|
||||
raise TypeError("Endpoint response is not well formed.")
|
||||
except (KeyError, IndexError, TypeError) as e:
|
||||
raise ValueError(
|
||||
"Error while formatting response payload for chat model of type"
|
||||
) from e
|
||||
|
||||
chunk = _convert_delta_to_message_chunk(choice["delta"], default_chunk_cls)
|
||||
default_chunk_cls = chunk.__class__
|
||||
finish_reason = choice.get("finish_reason")
|
||||
usage = choice.get("usage")
|
||||
gen_info = {}
|
||||
if finish_reason is not None:
|
||||
gen_info.update({"finish_reason": finish_reason})
|
||||
if usage is not None:
|
||||
gen_info.update({"usage": usage})
|
||||
|
||||
return ChatGenerationChunk(
|
||||
message=chunk, generation_info=gen_info if gen_info else None
|
||||
)
|
||||
|
||||
def _process_response(self, response_json: dict) -> ChatResult:
|
||||
"""Formats response in OpenAI spec.
|
||||
|
||||
Args:
|
||||
response_json (dict): The JSON response from the chat model endpoint.
|
||||
|
||||
Returns:
|
||||
ChatResult: An object containing the list of `ChatGeneration` objects
|
||||
and additional LLM output information.
|
||||
|
||||
Raises:
|
||||
ValueError: If the response JSON is not well-formed or does not
|
||||
contain the expected structure.
|
||||
|
||||
"""
|
||||
from langchain_openai.chat_models.base import _convert_dict_to_message
|
||||
|
||||
generations = []
|
||||
try:
|
||||
choices = response_json["choices"]
|
||||
if not isinstance(choices, list):
|
||||
raise TypeError("Endpoint response is not well formed.")
|
||||
except (KeyError, TypeError) as e:
|
||||
raise ValueError(
|
||||
"Error while formatting response payload for chat model of type"
|
||||
) from e
|
||||
|
||||
for choice in choices:
|
||||
message = _convert_dict_to_message(choice["message"])
|
||||
generation_info = dict(finish_reason=choice.get("finish_reason"))
|
||||
if "logprobs" in choice:
|
||||
generation_info["logprobs"] = choice["logprobs"]
|
||||
|
||||
gen = ChatGeneration(
|
||||
message=message,
|
||||
generation_info=generation_info,
|
||||
)
|
||||
generations.append(gen)
|
||||
|
||||
token_usage = response_json.get("usage", {})
|
||||
llm_output = {
|
||||
"token_usage": token_usage,
|
||||
"model_name": self.model,
|
||||
"system_fingerprint": response_json.get("system_fingerprint", ""),
|
||||
}
|
||||
return ChatResult(generations=generations, llm_output=llm_output)
|
||||
|
||||
def bind_tools(
|
||||
self,
|
||||
tools: Sequence[Union[Dict[str, Any], Type[BaseModel], Callable, BaseTool]],
|
||||
**kwargs: Any,
|
||||
) -> Runnable[LanguageModelInput, BaseMessage]:
|
||||
formatted_tools = [convert_to_openai_tool(tool) for tool in tools]
|
||||
return super().bind(tools=formatted_tools, **kwargs)
|
||||
|
||||
|
||||
class ChatOCIModelDeploymentVLLM(ChatOCIModelDeployment):
|
||||
"""OCI large language chat models deployed with vLLM.
|
||||
|
||||
To use, you must provide the model HTTP endpoint from your deployed
|
||||
model, e.g. https://modeldeployment.us-ashburn-1.oci.customer-oci.com/<ocid>/predict.
|
||||
|
||||
To authenticate, `oracle-ads` has been used to automatically load
|
||||
credentials: https://accelerated-data-science.readthedocs.io/en/latest/user_guide/cli/authentication.html
|
||||
|
||||
Make sure to have the required policies to access the OCI Data
|
||||
Science Model Deployment endpoint. See:
|
||||
https://docs.oracle.com/en-us/iaas/data-science/using/model-dep-policies-auth.htm#model_dep_policies_auth__predict-endpoint
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from langchain_community.chat_models import ChatOCIModelDeploymentVLLM
|
||||
|
||||
chat = ChatOCIModelDeploymentVLLM(
|
||||
endpoint="https://modeldeployment.us-ashburn-1.oci.customer-oci.com/<ocid>/predict",
|
||||
frequency_penalty=0.1,
|
||||
max_tokens=512,
|
||||
temperature=0.2,
|
||||
top_p=1.0,
|
||||
# other model parameters...
|
||||
)
|
||||
|
||||
""" # noqa: E501
|
||||
|
||||
frequency_penalty: float = 0.0
|
||||
"""Penalizes repeated tokens according to frequency. Between 0 and 1."""
|
||||
|
||||
logit_bias: Optional[Dict[str, float]] = None
|
||||
"""Adjust the probability of specific tokens being generated."""
|
||||
|
||||
max_tokens: Optional[int] = 256
|
||||
"""The maximum number of tokens to generate in the completion."""
|
||||
|
||||
n: int = 1
|
||||
"""Number of output sequences to return for the given prompt."""
|
||||
|
||||
presence_penalty: float = 0.0
|
||||
"""Penalizes repeated tokens. Between 0 and 1."""
|
||||
|
||||
temperature: float = 0.2
|
||||
"""What sampling temperature to use."""
|
||||
|
||||
top_p: float = 1.0
|
||||
"""Total probability mass of tokens to consider at each step."""
|
||||
|
||||
best_of: Optional[int] = None
|
||||
"""Generates best_of completions server-side and returns the "best"
|
||||
(the one with the highest log probability per token).
|
||||
"""
|
||||
|
||||
use_beam_search: Optional[bool] = False
|
||||
"""Whether to use beam search instead of sampling."""
|
||||
|
||||
top_k: Optional[int] = -1
|
||||
"""Number of most likely tokens to consider at each step."""
|
||||
|
||||
min_p: Optional[float] = 0.0
|
||||
"""Float that represents the minimum probability for a token to be considered.
|
||||
Must be in [0,1]. 0 to disable this."""
|
||||
|
||||
repetition_penalty: Optional[float] = 1.0
|
||||
"""Float that penalizes new tokens based on their frequency in the
|
||||
generated text. Values > 1 encourage the model to use new tokens."""
|
||||
|
||||
length_penalty: Optional[float] = 1.0
|
||||
"""Float that penalizes sequences based on their length. Used only
|
||||
when `use_beam_search` is True."""
|
||||
|
||||
early_stopping: Optional[bool] = False
|
||||
"""Controls the stopping condition for beam search. It accepts the
|
||||
following values: `True`, where the generation stops as soon as there
|
||||
are `best_of` complete candidates; `False`, where a heuristic is applied
|
||||
to the generation stops when it is very unlikely to find better candidates;
|
||||
`never`, where the beam search procedure only stops where there cannot be
|
||||
better candidates (canonical beam search algorithm)."""
|
||||
|
||||
ignore_eos: Optional[bool] = False
|
||||
"""Whether to ignore the EOS token and continue generating tokens after
|
||||
the EOS token is generated."""
|
||||
|
||||
min_tokens: Optional[int] = 0
|
||||
"""Minimum number of tokens to generate per output sequence before
|
||||
EOS or stop_token_ids can be generated"""
|
||||
|
||||
stop_token_ids: Optional[List[int]] = None
|
||||
"""List of tokens that stop the generation when they are generated.
|
||||
The returned output will contain the stop tokens unless the stop tokens
|
||||
are special tokens."""
|
||||
|
||||
skip_special_tokens: Optional[bool] = True
|
||||
"""Whether to skip special tokens in the output. Defaults to True."""
|
||||
|
||||
spaces_between_special_tokens: Optional[bool] = True
|
||||
"""Whether to add spaces between special tokens in the output.
|
||||
Defaults to True."""
|
||||
|
||||
tool_choice: Optional[str] = None
|
||||
"""Whether to use tool calling.
|
||||
Defaults to None, tool calling is disabled.
|
||||
Tool calling requires model support and the vLLM to be configured
|
||||
with `--tool-call-parser`.
|
||||
Set this to `auto` for the model to make tool calls automatically.
|
||||
Set this to `required` to force the model to always call one or more tools.
|
||||
"""
|
||||
|
||||
chat_template: Optional[str] = None
|
||||
"""Use customized chat template.
|
||||
Defaults to None. The chat template from the tokenizer will be used.
|
||||
"""
|
||||
|
||||
@property
|
||||
def _llm_type(self) -> str:
|
||||
"""Return type of llm."""
|
||||
return "oci_model_depolyment_chat_endpoint_vllm"
|
||||
|
||||
@property
|
||||
def _default_params(self) -> Dict[str, Any]:
|
||||
"""Get the default parameters."""
|
||||
params = {
|
||||
"model": self.model,
|
||||
"stop": self.stop,
|
||||
"stream": self.streaming,
|
||||
}
|
||||
for attr_name in self._get_model_params():
|
||||
try:
|
||||
value = getattr(self, attr_name)
|
||||
if value is not None:
|
||||
params.update({attr_name: value})
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return params
|
||||
|
||||
def _get_model_params(self) -> List[str]:
|
||||
"""Gets the name of model parameters."""
|
||||
return [
|
||||
"best_of",
|
||||
"early_stopping",
|
||||
"frequency_penalty",
|
||||
"ignore_eos",
|
||||
"length_penalty",
|
||||
"logit_bias",
|
||||
"logprobs",
|
||||
"max_tokens",
|
||||
"min_p",
|
||||
"min_tokens",
|
||||
"n",
|
||||
"presence_penalty",
|
||||
"repetition_penalty",
|
||||
"skip_special_tokens",
|
||||
"spaces_between_special_tokens",
|
||||
"stop_token_ids",
|
||||
"temperature",
|
||||
"top_k",
|
||||
"top_p",
|
||||
"use_beam_search",
|
||||
"tool_choice",
|
||||
"chat_template",
|
||||
]
|
||||
|
||||
|
||||
class ChatOCIModelDeploymentTGI(ChatOCIModelDeployment):
|
||||
"""OCI large language chat models deployed with Text Generation Inference.
|
||||
|
||||
To use, you must provide the model HTTP endpoint from your deployed
|
||||
model, e.g. https://modeldeployment.us-ashburn-1.oci.customer-oci.com/<ocid>/predict.
|
||||
|
||||
To authenticate, `oracle-ads` has been used to automatically load
|
||||
credentials: https://accelerated-data-science.readthedocs.io/en/latest/user_guide/cli/authentication.html
|
||||
|
||||
Make sure to have the required policies to access the OCI Data
|
||||
Science Model Deployment endpoint. See:
|
||||
https://docs.oracle.com/en-us/iaas/data-science/using/model-dep-policies-auth.htm#model_dep_policies_auth__predict-endpoint
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from langchain_community.chat_models import ChatOCIModelDeploymentTGI
|
||||
|
||||
chat = ChatOCIModelDeploymentTGI(
|
||||
endpoint="https://modeldeployment.us-ashburn-1.oci.customer-oci.com/<ocid>/predict",
|
||||
max_token=512,
|
||||
temperature=0.2,
|
||||
frequency_penalty=0.1,
|
||||
seed=42,
|
||||
# other model parameters...
|
||||
)
|
||||
|
||||
""" # noqa: E501
|
||||
|
||||
frequency_penalty: Optional[float] = None
|
||||
"""Penalizes repeated tokens according to frequency. Between 0 and 1."""
|
||||
|
||||
logit_bias: Optional[Dict[str, float]] = None
|
||||
"""Adjust the probability of specific tokens being generated."""
|
||||
|
||||
logprobs: Optional[bool] = None
|
||||
"""Whether to return log probabilities of the output tokens or not."""
|
||||
|
||||
max_tokens: int = 256
|
||||
"""The maximum number of tokens to generate in the completion."""
|
||||
|
||||
n: int = 1
|
||||
"""Number of output sequences to return for the given prompt."""
|
||||
|
||||
presence_penalty: Optional[float] = None
|
||||
"""Penalizes repeated tokens. Between 0 and 1."""
|
||||
|
||||
seed: Optional[int] = None
|
||||
"""To sample deterministically,"""
|
||||
|
||||
temperature: float = 0.2
|
||||
"""What sampling temperature to use."""
|
||||
|
||||
top_p: Optional[float] = None
|
||||
"""Total probability mass of tokens to consider at each step."""
|
||||
|
||||
top_logprobs: Optional[int] = None
|
||||
"""An integer between 0 and 5 specifying the number of most
|
||||
likely tokens to return at each token position, each with an
|
||||
associated log probability. logprobs must be set to true if
|
||||
this parameter is used."""
|
||||
|
||||
@property
|
||||
def _llm_type(self) -> str:
|
||||
"""Return type of llm."""
|
||||
return "oci_model_depolyment_chat_endpoint_tgi"
|
||||
|
||||
@property
|
||||
def _default_params(self) -> Dict[str, Any]:
|
||||
"""Get the default parameters."""
|
||||
params = {
|
||||
"model": self.model,
|
||||
"stop": self.stop,
|
||||
"stream": self.streaming,
|
||||
}
|
||||
for attr_name in self._get_model_params():
|
||||
try:
|
||||
value = getattr(self, attr_name)
|
||||
if value is not None:
|
||||
params.update({attr_name: value})
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return params
|
||||
|
||||
def _get_model_params(self) -> List[str]:
|
||||
"""Gets the name of model parameters."""
|
||||
return [
|
||||
"frequency_penalty",
|
||||
"logit_bias",
|
||||
"logprobs",
|
||||
"max_tokens",
|
||||
"n",
|
||||
"presence_penalty",
|
||||
"seed",
|
||||
"temperature",
|
||||
"top_k",
|
||||
"top_p",
|
||||
"top_logprobs",
|
||||
]
|
||||
@@ -174,10 +174,10 @@ class ChatSambaNovaCloud(BaseChatModel):
|
||||
temperature: float = Field(default=0.7)
|
||||
"""model temperature"""
|
||||
|
||||
top_p: Optional[float] = Field()
|
||||
top_p: Optional[float] = Field(default=None)
|
||||
"""model top p"""
|
||||
|
||||
top_k: Optional[int] = Field()
|
||||
top_k: Optional[int] = Field(default=None)
|
||||
"""model top k"""
|
||||
|
||||
stream_options: dict = Field(default={"include_usage": True})
|
||||
@@ -593,7 +593,7 @@ class ChatSambaStudio(BaseChatModel):
|
||||
streaming_url: str = Field(default="", exclude=True)
|
||||
"""SambaStudio streaming Url"""
|
||||
|
||||
model: Optional[str] = Field()
|
||||
model: Optional[str] = Field(default=None)
|
||||
"""The name of the model or expert to use (for CoE endpoints)"""
|
||||
|
||||
streaming: bool = Field(default=False)
|
||||
@@ -605,16 +605,16 @@ class ChatSambaStudio(BaseChatModel):
|
||||
temperature: Optional[float] = Field(default=0.7)
|
||||
"""model temperature"""
|
||||
|
||||
top_p: Optional[float] = Field()
|
||||
top_p: Optional[float] = Field(default=None)
|
||||
"""model top p"""
|
||||
|
||||
top_k: Optional[int] = Field()
|
||||
top_k: Optional[int] = Field(default=None)
|
||||
"""model top k"""
|
||||
|
||||
do_sample: Optional[bool] = Field()
|
||||
do_sample: Optional[bool] = Field(default=None)
|
||||
"""whether to do sampling"""
|
||||
|
||||
process_prompt: Optional[bool] = Field()
|
||||
process_prompt: Optional[bool] = Field(default=True)
|
||||
"""whether process prompt (for CoE generic v1 and v2 endpoints)"""
|
||||
|
||||
stream_options: dict = Field(default={"include_usage": True})
|
||||
@@ -1012,6 +1012,16 @@ class ChatSambaStudio(BaseChatModel):
|
||||
"system_fingerprint": data["system_fingerprint"],
|
||||
"created": data["created"],
|
||||
}
|
||||
if data.get("usage") is not None:
|
||||
content = ""
|
||||
id = data["id"]
|
||||
metadata = {
|
||||
"finish_reason": finish_reason,
|
||||
"usage": data.get("usage"),
|
||||
"model_name": data["model"],
|
||||
"system_fingerprint": data["system_fingerprint"],
|
||||
"created": data["created"],
|
||||
}
|
||||
yield AIMessageChunk(
|
||||
content=content,
|
||||
id=id,
|
||||
|
||||
@@ -118,8 +118,8 @@ class O365BaseLoader(BaseLoader, BaseModel):
|
||||
metadata_dict[file.name] = {
|
||||
"source": file.web_url,
|
||||
"mime_type": file.mime_type,
|
||||
"created": file.created,
|
||||
"modified": file.modified,
|
||||
"created": str(file.created),
|
||||
"modified": str(file.modified),
|
||||
"created_by": str(file.created_by),
|
||||
"modified_by": str(file.modified_by),
|
||||
"description": file.description,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import warnings
|
||||
from typing import Iterator, Literal, Optional
|
||||
|
||||
from langchain_core.document_loaders import BaseLoader
|
||||
@@ -48,7 +49,6 @@ class FireCrawlLoader(BaseLoader):
|
||||
Join the waitlist to turn any web
|
||||
{'ogUrl': 'https://www.firecrawl.dev/', 'title': 'Home - Firecrawl', 'robots': 'follow, index', 'ogImage': 'https://www.firecrawl.dev/og.png?123', 'ogTitle': 'Firecrawl', 'sitemap': {'lastmod': '2024-08-12T00:28:16.681Z', 'changefreq': 'weekly'}, 'keywords': 'Firecrawl,Markdown,Data,Mendable,Langchain', 'sourceURL': 'https://www.firecrawl.dev/', 'ogSiteName': 'Firecrawl', 'description': 'Firecrawl crawls and converts any website into clean markdown.', 'ogDescription': 'Turn any website into LLM-ready data.', 'pageStatusCode': 200, 'ogLocaleAlternate': []}
|
||||
|
||||
|
||||
Async load:
|
||||
.. code-block:: python
|
||||
|
||||
@@ -64,13 +64,169 @@ class FireCrawlLoader(BaseLoader):
|
||||
|
||||
""" # noqa: E501
|
||||
|
||||
def legacy_crawler_options_adapter(self, params: dict) -> dict:
|
||||
use_legacy_options = False
|
||||
legacy_keys = [
|
||||
"includes",
|
||||
"excludes",
|
||||
"allowBackwardCrawling",
|
||||
"allowExternalContentLinks",
|
||||
"pageOptions",
|
||||
]
|
||||
for key in legacy_keys:
|
||||
if params.get(key):
|
||||
use_legacy_options = True
|
||||
break
|
||||
|
||||
if use_legacy_options:
|
||||
warnings.warn(
|
||||
"Deprecated parameters detected. See Firecrawl v1 docs for updates.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
if "includes" in params:
|
||||
if params["includes"] is True:
|
||||
params["includePaths"] = params["includes"]
|
||||
del params["includes"]
|
||||
|
||||
if "excludes" in params:
|
||||
if params["excludes"] is True:
|
||||
params["excludePaths"] = params["excludes"]
|
||||
del params["excludes"]
|
||||
|
||||
if "allowBackwardCrawling" in params:
|
||||
if params["allowBackwardCrawling"] is True:
|
||||
params["allowBackwardLinks"] = params["allowBackwardCrawling"]
|
||||
del params["allowBackwardCrawling"]
|
||||
|
||||
if "allowExternalContentLinks" in params:
|
||||
if params["allowExternalContentLinks"] is True:
|
||||
params["allowExternalLinks"] = params["allowExternalContentLinks"]
|
||||
del params["allowExternalContentLinks"]
|
||||
|
||||
if "pageOptions" in params:
|
||||
if isinstance(params["pageOptions"], dict):
|
||||
params["scrapeOptions"] = self.legacy_scrape_options_adapter(
|
||||
params["pageOptions"]
|
||||
)
|
||||
del params["pageOptions"]
|
||||
|
||||
return params
|
||||
|
||||
def legacy_scrape_options_adapter(self, params: dict) -> dict:
|
||||
use_legacy_options = False
|
||||
formats = ["markdown"]
|
||||
|
||||
if "extractorOptions" in params:
|
||||
if "mode" in params["extractorOptions"]:
|
||||
if (
|
||||
params["extractorOptions"]["mode"] == "llm-extraction"
|
||||
or params["extractorOptions"]["mode"]
|
||||
== "llm-extraction-from-raw-html"
|
||||
or params["extractorOptions"]["mode"]
|
||||
== "llm-extraction-from-markdown"
|
||||
):
|
||||
use_legacy_options = True
|
||||
if "extractionPrompt" in params["extractorOptions"]:
|
||||
if params["extractorOptions"]["extractionPrompt"]:
|
||||
params["prompt"] = params["extractorOptions"][
|
||||
"extractionPrompt"
|
||||
]
|
||||
else:
|
||||
params["prompt"] = params["extractorOptions"].get(
|
||||
"extractionPrompt",
|
||||
"Extract page information based on the schema.",
|
||||
)
|
||||
|
||||
if "extractionSchema" in params["extractorOptions"]:
|
||||
if params["extractorOptions"]["extractionSchema"]:
|
||||
params["schema"] = params["extractorOptions"][
|
||||
"extractionSchema"
|
||||
]
|
||||
|
||||
if "userPrompt" in params["extractorOptions"]:
|
||||
if params["extractorOptions"]["userPrompt"]:
|
||||
params["prompt"] = params["extractorOptions"]["userPrompt"]
|
||||
|
||||
del params["extractorOptions"]
|
||||
|
||||
scrape_keys = [
|
||||
"includeMarkdown",
|
||||
"includeHtml",
|
||||
"includeRawHtml",
|
||||
"includeExtract",
|
||||
"includeLinks",
|
||||
"screenshot",
|
||||
"fullPageScreenshot",
|
||||
"onlyIncludeTags",
|
||||
"removeTags",
|
||||
]
|
||||
for key in scrape_keys:
|
||||
if params.get(key):
|
||||
use_legacy_options = True
|
||||
break
|
||||
|
||||
if use_legacy_options:
|
||||
warnings.warn(
|
||||
"Deprecated parameters detected. See Firecrawl v1 docs for updates.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
if "includeMarkdown" in params:
|
||||
if params["includeMarkdown"] is False:
|
||||
formats.remove("markdown")
|
||||
del params["includeMarkdown"]
|
||||
|
||||
if "includeHtml" in params:
|
||||
if params["includeHtml"] is True:
|
||||
formats.append("html")
|
||||
del params["includeHtml"]
|
||||
|
||||
if "includeRawHtml" in params:
|
||||
if params["includeRawHtml"] is True:
|
||||
formats.append("rawHtml")
|
||||
del params["includeRawHtml"]
|
||||
|
||||
if "includeExtract" in params:
|
||||
if params["includeExtract"] is True:
|
||||
formats.append("extract")
|
||||
del params["includeExtract"]
|
||||
|
||||
if "includeLinks" in params:
|
||||
if params["includeLinks"] is True:
|
||||
formats.append("links")
|
||||
del params["includeLinks"]
|
||||
|
||||
if "screenshot" in params:
|
||||
if params["screenshot"] is True:
|
||||
formats.append("screenshot")
|
||||
del params["screenshot"]
|
||||
|
||||
if "fullPageScreenshot" in params:
|
||||
if params["fullPageScreenshot"] is True:
|
||||
formats.append("screenshot@fullPage")
|
||||
del params["fullPageScreenshot"]
|
||||
|
||||
if "onlyIncludeTags" in params:
|
||||
if params["onlyIncludeTags"] is True:
|
||||
params["includeTags"] = params["onlyIncludeTags"]
|
||||
del params["onlyIncludeTags"]
|
||||
|
||||
if "removeTags" in params:
|
||||
if params["removeTags"] is True:
|
||||
params["excludeTags"] = params["removeTags"]
|
||||
del params["removeTags"]
|
||||
|
||||
if "formats" not in params:
|
||||
params["formats"] = formats
|
||||
|
||||
return params
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
url: str,
|
||||
*,
|
||||
api_key: Optional[str] = None,
|
||||
api_url: Optional[str] = None,
|
||||
mode: Literal["crawl", "scrape"] = "crawl",
|
||||
mode: Literal["crawl", "scrape", "map"] = "crawl",
|
||||
params: Optional[dict] = None,
|
||||
):
|
||||
"""Initialize with API key and url.
|
||||
@@ -82,8 +238,9 @@ class FireCrawlLoader(BaseLoader):
|
||||
api_url: The Firecrawl API URL. If not specified will be read from env var
|
||||
FIRECRAWL_API_URL or defaults to https://api.firecrawl.dev.
|
||||
mode: The mode to run the loader in. Default is "crawl".
|
||||
Options include "scrape" (single url) and
|
||||
"crawl" (all accessible sub pages).
|
||||
Options include "scrape" (single url),
|
||||
"crawl" (all accessible sub pages),
|
||||
"map" (returns list of links that are semantically related).
|
||||
params: The parameters to pass to the Firecrawl API.
|
||||
Examples include crawlerOptions.
|
||||
For more details, visit: https://github.com/mendableai/firecrawl-py
|
||||
@@ -95,30 +252,58 @@ class FireCrawlLoader(BaseLoader):
|
||||
raise ImportError(
|
||||
"`firecrawl` package not found, please run `pip install firecrawl-py`"
|
||||
)
|
||||
if mode not in ("crawl", "scrape"):
|
||||
if mode not in ("crawl", "scrape", "search", "map"):
|
||||
raise ValueError(
|
||||
f"Unrecognized mode '{mode}'. Expected one of 'crawl', 'scrape'."
|
||||
f"Invalid mode '{mode}'. Allowed: 'crawl', 'scrape', 'search', 'map'."
|
||||
)
|
||||
|
||||
if not url:
|
||||
raise ValueError("Url must be provided")
|
||||
|
||||
api_key = api_key or get_from_env("api_key", "FIRECRAWL_API_KEY")
|
||||
self.firecrawl = FirecrawlApp(api_key=api_key, api_url=api_url)
|
||||
self.url = url
|
||||
self.mode = mode
|
||||
self.params = params
|
||||
self.params = params or {}
|
||||
|
||||
def lazy_load(self) -> Iterator[Document]:
|
||||
if self.mode == "scrape":
|
||||
firecrawl_docs = [self.firecrawl.scrape_url(self.url, params=self.params)]
|
||||
firecrawl_docs = [
|
||||
self.firecrawl.scrape_url(
|
||||
self.url, params=self.legacy_scrape_options_adapter(self.params)
|
||||
)
|
||||
]
|
||||
elif self.mode == "crawl":
|
||||
firecrawl_docs = self.firecrawl.crawl_url(self.url, params=self.params)
|
||||
if not self.url:
|
||||
raise ValueError("URL is required for crawl mode")
|
||||
crawl_response = self.firecrawl.crawl_url(
|
||||
self.url, params=self.legacy_crawler_options_adapter(self.params)
|
||||
)
|
||||
firecrawl_docs = crawl_response.get("data", [])
|
||||
elif self.mode == "map":
|
||||
if not self.url:
|
||||
raise ValueError("URL is required for map mode")
|
||||
firecrawl_docs = self.firecrawl.map_url(self.url, params=self.params)
|
||||
elif self.mode == "search":
|
||||
raise ValueError(
|
||||
"Search mode is not supported in this version, please downgrade."
|
||||
)
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Unrecognized mode '{self.mode}'. Expected one of 'crawl', 'scrape'."
|
||||
f"Invalid mode '{self.mode}'. Allowed: 'crawl', 'scrape', 'map'."
|
||||
)
|
||||
for doc in firecrawl_docs:
|
||||
metadata = doc.get("metadata", {})
|
||||
if (self.params is not None) and self.params.get(
|
||||
"extractorOptions", {}
|
||||
).get("mode") == "llm-extraction":
|
||||
metadata["llm_extraction"] = doc.get("llm_extraction")
|
||||
|
||||
yield Document(page_content=doc.get("markdown", ""), metadata=metadata)
|
||||
if self.mode == "map":
|
||||
page_content = doc
|
||||
metadata = {}
|
||||
else:
|
||||
page_content = (
|
||||
doc.get("markdown") or doc.get("html") or doc.get("rawHtml", "")
|
||||
)
|
||||
metadata = doc.get("metadata", {})
|
||||
if not page_content:
|
||||
continue
|
||||
yield Document(
|
||||
page_content=page_content,
|
||||
metadata=metadata,
|
||||
)
|
||||
|
||||
@@ -100,7 +100,13 @@ class OracleAutonomousDatabaseLoader(BaseLoader):
|
||||
cursor.execute(self.query)
|
||||
columns = [col[0] for col in cursor.description]
|
||||
data = cursor.fetchall()
|
||||
data = [dict(zip(columns, row)) for row in data]
|
||||
data = [
|
||||
{
|
||||
i: (j if not isinstance(j, oracledb.LOB) else j.read())
|
||||
for i, j in zip(columns, row)
|
||||
}
|
||||
for row in data
|
||||
]
|
||||
except oracledb.DatabaseError as e:
|
||||
print("Got error while connecting: " + str(e)) # noqa: T201
|
||||
data = []
|
||||
|
||||
@@ -268,6 +268,7 @@ class RecursiveUrlLoader(BaseLoader):
|
||||
base_url: Optional[str] = None,
|
||||
autoset_encoding: bool = True,
|
||||
encoding: Optional[str] = None,
|
||||
proxies: Optional[dict] = None,
|
||||
) -> None:
|
||||
"""Initialize with URL to crawl and any subdirectories to exclude.
|
||||
|
||||
@@ -313,6 +314,16 @@ class RecursiveUrlLoader(BaseLoader):
|
||||
encoding, unless the `encoding` argument has already been explicitly set.
|
||||
encoding: The encoding of the response. If manually set, the encoding will be
|
||||
set to given value, regardless of the `autoset_encoding` argument.
|
||||
proxies: A dictionary mapping protocol names to the proxy URLs to be used for requests.
|
||||
This allows the crawler to route its requests through specified proxy servers.
|
||||
If None, no proxies will be used and requests will go directly to the target URL.
|
||||
Example usage:
|
||||
..code-block:: python
|
||||
|
||||
proxies = {
|
||||
"http": "http://10.10.1.10:3128",
|
||||
"https": "https://10.10.1.10:1080",
|
||||
}
|
||||
""" # noqa: E501
|
||||
|
||||
self.url = url
|
||||
@@ -342,6 +353,7 @@ class RecursiveUrlLoader(BaseLoader):
|
||||
self.check_response_status = check_response_status
|
||||
self.continue_on_failure = continue_on_failure
|
||||
self.base_url = base_url if base_url is not None else url
|
||||
self.proxies = proxies
|
||||
|
||||
def _get_child_links_recursive(
|
||||
self, url: str, visited: Set[str], *, depth: int = 0
|
||||
@@ -360,7 +372,9 @@ class RecursiveUrlLoader(BaseLoader):
|
||||
# Get all links that can be accessed from the current URL
|
||||
visited.add(url)
|
||||
try:
|
||||
response = requests.get(url, timeout=self.timeout, headers=self.headers)
|
||||
response = requests.get(
|
||||
url, timeout=self.timeout, headers=self.headers, proxies=self.proxies
|
||||
)
|
||||
|
||||
if self.encoding is not None:
|
||||
response.encoding = self.encoding
|
||||
|
||||
@@ -3,6 +3,8 @@ from __future__ import annotations
|
||||
from typing import Iterator, List
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from langchain_core._api import deprecated
|
||||
|
||||
from langchain_community.embeddings.mlflow import MlflowEmbeddings
|
||||
|
||||
|
||||
@@ -11,6 +13,11 @@ def _chunk(texts: List[str], size: int) -> Iterator[List[str]]:
|
||||
yield texts[i : i + size]
|
||||
|
||||
|
||||
@deprecated(
|
||||
since="0.3.3",
|
||||
removal="1.0",
|
||||
alternative_import="langchain_databricks.DatabricksEmbeddings",
|
||||
)
|
||||
class DatabricksEmbeddings(MlflowEmbeddings):
|
||||
"""Databricks embeddings.
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class Text2vecEmbeddings(Embeddings, BaseModel):
|
||||
"""text2vec embedding models.
|
||||
|
||||
Install text2vec first, run 'pip install -U text2vec'.
|
||||
The gitbub repository for text2vec is : https://github.com/shibing624/text2vec
|
||||
The github repository for text2vec is : https://github.com/shibing624/text2vec
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
@@ -430,7 +430,7 @@ class Neo4jGraph(GraphStore):
|
||||
try:
|
||||
data, _, _ = self._driver.execute_query(
|
||||
Query(text=query, timeout=self.timeout),
|
||||
database=self._database,
|
||||
database_=self._database,
|
||||
parameters_=params,
|
||||
)
|
||||
json_data = [r.data() for r in data]
|
||||
@@ -457,7 +457,7 @@ class Neo4jGraph(GraphStore):
|
||||
):
|
||||
raise
|
||||
# fallback to allow implicit transactions
|
||||
with self._driver.session() as session:
|
||||
with self._driver.session(database=self._database) as session:
|
||||
data = session.run(Query(text=query, timeout=self.timeout), params)
|
||||
json_data = [r.data() for r in data]
|
||||
if self.sanitize:
|
||||
|
||||
@@ -396,6 +396,14 @@ def _import_oci_md_vllm() -> Type[BaseLLM]:
|
||||
return OCIModelDeploymentVLLM
|
||||
|
||||
|
||||
def _import_oci_md() -> Type[BaseLLM]:
|
||||
from langchain_community.llms.oci_data_science_model_deployment_endpoint import (
|
||||
OCIModelDeploymentLLM,
|
||||
)
|
||||
|
||||
return OCIModelDeploymentLLM
|
||||
|
||||
|
||||
def _import_oci_gen_ai() -> Type[BaseLLM]:
|
||||
from langchain_community.llms.oci_generative_ai import OCIGenAI
|
||||
|
||||
@@ -773,6 +781,8 @@ def __getattr__(name: str) -> Any:
|
||||
return _import_oci_md_tgi()
|
||||
elif name == "OCIModelDeploymentVLLM":
|
||||
return _import_oci_md_vllm()
|
||||
elif name == "OCIModelDeploymentLLM":
|
||||
return _import_oci_md()
|
||||
elif name == "OCIGenAI":
|
||||
return _import_oci_gen_ai()
|
||||
elif name == "OctoAIEndpoint":
|
||||
@@ -928,6 +938,7 @@ __all__ = [
|
||||
"OCIGenAI",
|
||||
"OCIModelDeploymentTGI",
|
||||
"OCIModelDeploymentVLLM",
|
||||
"OCIModelDeploymentLLM",
|
||||
"OctoAIEndpoint",
|
||||
"Ollama",
|
||||
"OpaquePrompts",
|
||||
@@ -1029,6 +1040,7 @@ def get_type_to_cls_dict() -> Dict[str, Callable[[], Type[BaseLLM]]]:
|
||||
"nlpcloud": _import_nlpcloud,
|
||||
"oci_model_deployment_tgi_endpoint": _import_oci_md_tgi,
|
||||
"oci_model_deployment_vllm_endpoint": _import_oci_md_vllm,
|
||||
"oci_model_deployment_endpoint": _import_oci_md,
|
||||
"oci_generative_ai": _import_oci_gen_ai,
|
||||
"octoai_endpoint": _import_octoai_endpoint,
|
||||
"ollama": _import_ollama,
|
||||
|
||||
@@ -396,7 +396,7 @@ class BedrockBase(BaseModel, ABC):
|
||||
"""Validate that AWS credentials to and python package exists in environment."""
|
||||
|
||||
# Skip creating new client if passed in constructor
|
||||
if values["client"] is not None:
|
||||
if values.get("client") is not None:
|
||||
return values
|
||||
|
||||
try:
|
||||
|
||||
@@ -5,6 +5,7 @@ from abc import ABC, abstractmethod
|
||||
from typing import Any, Callable, Dict, List, Mapping, Optional
|
||||
|
||||
import requests
|
||||
from langchain_core._api import deprecated
|
||||
from langchain_core.callbacks import CallbackManagerForLLMRun
|
||||
from langchain_core.language_models import LLM
|
||||
from pydantic import (
|
||||
@@ -262,6 +263,11 @@ def _pickle_fn_to_hex_string(fn: Callable) -> str:
|
||||
raise ValueError(f"Failed to pickle the function: {e}")
|
||||
|
||||
|
||||
@deprecated(
|
||||
since="0.3.3",
|
||||
removal="1.0",
|
||||
alternative_import="langchain_databricks.ChatDatabricks",
|
||||
)
|
||||
class Databricks(LLM):
|
||||
"""Databricks serving endpoint or a cluster driver proxy app for LLM.
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -123,14 +123,19 @@ class VLLM(BaseLLM):
|
||||
**kwargs: Any,
|
||||
) -> LLMResult:
|
||||
"""Run the LLM on the given prompt and input."""
|
||||
|
||||
from vllm import SamplingParams
|
||||
|
||||
# build sampling parameters
|
||||
params = {**self._default_params, **kwargs, "stop": stop}
|
||||
sampling_params = SamplingParams(**params)
|
||||
|
||||
# filter params for SamplingParams
|
||||
known_keys = SamplingParams.__annotations__.keys()
|
||||
sample_params = SamplingParams(
|
||||
**{k: v for k, v in params.items() if k in known_keys}
|
||||
)
|
||||
|
||||
# call the model
|
||||
outputs = self.client.generate(prompts, sampling_params)
|
||||
outputs = self.client.generate(prompts, sample_params)
|
||||
|
||||
generations = []
|
||||
for output in outputs:
|
||||
|
||||
@@ -95,7 +95,7 @@ class SQLStore(BaseStore[str, bytes]):
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from langchain_rag.storage import SQLStore
|
||||
from langchain_community.storage import SQLStore
|
||||
|
||||
# Instantiate the SQLStore with the root path
|
||||
sql_store = SQLStore(namespace="test", db_url="sqlite://:memory:")
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import inspect
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
from dataclasses import dataclass
|
||||
from io import StringIO
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional
|
||||
@@ -7,7 +10,7 @@ from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional
|
||||
if TYPE_CHECKING:
|
||||
from databricks.sdk import WorkspaceClient
|
||||
from databricks.sdk.service.catalog import FunctionInfo
|
||||
from databricks.sdk.service.sql import StatementParameterListItem
|
||||
from databricks.sdk.service.sql import StatementParameterListItem, StatementState
|
||||
|
||||
EXECUTE_FUNCTION_ARG_NAME = "__execution_args__"
|
||||
DEFAULT_EXECUTE_FUNCTION_ARGS = {
|
||||
@@ -15,6 +18,9 @@ DEFAULT_EXECUTE_FUNCTION_ARGS = {
|
||||
"row_limit": 100,
|
||||
"byte_limit": 4096,
|
||||
}
|
||||
UC_TOOL_CLIENT_EXECUTION_TIMEOUT = "UC_TOOL_CLIENT_EXECUTION_TIMEOUT"
|
||||
DEFAULT_UC_TOOL_CLIENT_EXECUTION_TIMEOUT = "120"
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def is_scalar(function: "FunctionInfo") -> bool:
|
||||
@@ -174,13 +180,42 @@ def execute_function(
|
||||
parameters=parametrized_statement.parameters,
|
||||
**execute_statement_args, # type: ignore
|
||||
)
|
||||
status = response.status
|
||||
assert status is not None, f"Statement execution failed: {response}"
|
||||
if status.state != StatementState.SUCCEEDED:
|
||||
error = status.error
|
||||
if response.status and job_pending(response.status.state) and response.statement_id:
|
||||
statement_id = response.statement_id
|
||||
wait_time = 0
|
||||
retry_cnt = 0
|
||||
client_execution_timeout = int(
|
||||
os.environ.get(
|
||||
UC_TOOL_CLIENT_EXECUTION_TIMEOUT,
|
||||
DEFAULT_UC_TOOL_CLIENT_EXECUTION_TIMEOUT,
|
||||
)
|
||||
)
|
||||
while wait_time < client_execution_timeout:
|
||||
wait = min(2**retry_cnt, client_execution_timeout - wait_time)
|
||||
_logger.debug(
|
||||
f"Retrying {retry_cnt} time to get statement execution "
|
||||
f"status after {wait} seconds."
|
||||
)
|
||||
time.sleep(wait)
|
||||
response = ws.statement_execution.get_statement(statement_id) # type: ignore
|
||||
if response.status is None or not job_pending(response.status.state):
|
||||
break
|
||||
wait_time += wait
|
||||
retry_cnt += 1
|
||||
if response.status and job_pending(response.status.state):
|
||||
return FunctionExecutionResult(
|
||||
error=f"Statement execution is still pending after {wait_time} "
|
||||
"seconds. Please increase the wait_timeout argument for executing "
|
||||
f"the function or increase {UC_TOOL_CLIENT_EXECUTION_TIMEOUT} "
|
||||
"environment variable for increasing retrying time, default is "
|
||||
f"{DEFAULT_UC_TOOL_CLIENT_EXECUTION_TIMEOUT} seconds."
|
||||
)
|
||||
assert response.status is not None, f"Statement execution failed: {response}"
|
||||
if response.status.state != StatementState.SUCCEEDED:
|
||||
error = response.status.error
|
||||
assert (
|
||||
error is not None
|
||||
), "Statement execution failed but no error message was provided."
|
||||
), f"Statement execution failed but no error message was provided: {response}"
|
||||
return FunctionExecutionResult(error=f"{error.error_code}: {error.message}")
|
||||
manifest = response.manifest
|
||||
assert manifest is not None
|
||||
@@ -211,3 +246,9 @@ def execute_function(
|
||||
return FunctionExecutionResult(
|
||||
format="CSV", value=csv_buffer.getvalue(), truncated=truncated
|
||||
)
|
||||
|
||||
|
||||
def job_pending(state: Optional["StatementState"]) -> bool:
|
||||
from databricks.sdk.service.sql import StatementState
|
||||
|
||||
return state in (StatementState.PENDING, StatementState.RUNNING)
|
||||
|
||||
@@ -94,6 +94,16 @@ class ArxivAPIWrapper(BaseModel):
|
||||
)
|
||||
return values
|
||||
|
||||
def _fetch_results(self, query: str) -> Any:
|
||||
"""Helper function to fetch arxiv results based on query."""
|
||||
if self.is_arxiv_identifier(query):
|
||||
return self.arxiv_search(
|
||||
id_list=query.split(), max_results=self.top_k_results
|
||||
).results()
|
||||
return self.arxiv_search(
|
||||
query[: self.ARXIV_MAX_QUERY_LENGTH], max_results=self.top_k_results
|
||||
).results()
|
||||
|
||||
def get_summaries_as_docs(self, query: str) -> List[Document]:
|
||||
"""
|
||||
Performs an arxiv search and returns list of
|
||||
@@ -107,16 +117,11 @@ class ArxivAPIWrapper(BaseModel):
|
||||
query: a plaintext search query
|
||||
"""
|
||||
try:
|
||||
if self.is_arxiv_identifier(query):
|
||||
results = self.arxiv_search(
|
||||
id_list=query.split(),
|
||||
max_results=self.top_k_results,
|
||||
).results()
|
||||
else:
|
||||
results = self.arxiv_search( # type: ignore
|
||||
query[: self.ARXIV_MAX_QUERY_LENGTH], max_results=self.top_k_results
|
||||
).results()
|
||||
results = self._fetch_results(
|
||||
query
|
||||
) # Using helper function to fetch results
|
||||
except self.arxiv_exceptions as ex:
|
||||
logger.error(f"Arxiv exception: {ex}") # Added error logging
|
||||
return [Document(page_content=f"Arxiv exception: {ex}")]
|
||||
docs = [
|
||||
Document(
|
||||
@@ -146,16 +151,11 @@ class ArxivAPIWrapper(BaseModel):
|
||||
query: a plaintext search query
|
||||
"""
|
||||
try:
|
||||
if self.is_arxiv_identifier(query):
|
||||
results = self.arxiv_search(
|
||||
id_list=query.split(),
|
||||
max_results=self.top_k_results,
|
||||
).results()
|
||||
else:
|
||||
results = self.arxiv_search( # type: ignore
|
||||
query[: self.ARXIV_MAX_QUERY_LENGTH], max_results=self.top_k_results
|
||||
).results()
|
||||
results = self._fetch_results(
|
||||
query
|
||||
) # Using helper function to fetch results
|
||||
except self.arxiv_exceptions as ex:
|
||||
logger.error(f"Arxiv exception: {ex}") # Added error logging
|
||||
return f"Arxiv exception: {ex}"
|
||||
docs = [
|
||||
f"Published: {result.updated.date()}\n"
|
||||
@@ -208,15 +208,9 @@ class ArxivAPIWrapper(BaseModel):
|
||||
try:
|
||||
# Remove the ":" and "-" from the query, as they can cause search problems
|
||||
query = query.replace(":", "").replace("-", "")
|
||||
if self.is_arxiv_identifier(query):
|
||||
results = self.arxiv_search(
|
||||
id_list=query[: self.ARXIV_MAX_QUERY_LENGTH].split(),
|
||||
max_results=self.load_max_docs,
|
||||
).results()
|
||||
else:
|
||||
results = self.arxiv_search( # type: ignore
|
||||
query[: self.ARXIV_MAX_QUERY_LENGTH], max_results=self.load_max_docs
|
||||
).results()
|
||||
results = self._fetch_results(
|
||||
query
|
||||
) # Using helper function to fetch results
|
||||
except self.arxiv_exceptions as ex:
|
||||
logger.debug("Error on arxiv: %s", ex)
|
||||
return
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user