mirror of
https://github.com/hwchase17/langchain.git
synced 2026-02-05 00:30:18 +00:00
Compare commits
51 Commits
erick/core
...
bagatur/ha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09e330064a | ||
|
|
0640cbf2f1 | ||
|
|
380449a7a9 | ||
|
|
403c0ea801 | ||
|
|
c6d088bc15 | ||
|
|
6ed92f13d0 | ||
|
|
689e8b7e66 | ||
|
|
2678cda83b | ||
|
|
8f80dd28d9 | ||
|
|
cfcf783cb5 | ||
|
|
edfe35c2a8 | ||
|
|
e62e390ca0 | ||
|
|
97a819d578 | ||
|
|
c397baa85f | ||
|
|
4ceb28009a | ||
|
|
a562c54f7d | ||
|
|
30660786b3 | ||
|
|
b468552859 | ||
|
|
82242dfbb1 | ||
|
|
2cf2cefe39 | ||
|
|
7d65a32ee0 | ||
|
|
97dc578d47 | ||
|
|
6e228c84a8 | ||
|
|
2a27234a77 | ||
|
|
322ca84812 | ||
|
|
4d11211c89 | ||
|
|
f9cc9bdcf3 | ||
|
|
0ebddabf7d | ||
|
|
202d7f6c4a | ||
|
|
a38e903360 | ||
|
|
fdb7f951c8 | ||
|
|
88d71f6986 | ||
|
|
a4392b070d | ||
|
|
31e7664afd | ||
|
|
3165415369 | ||
|
|
591a3db4fb | ||
|
|
b8bfebd382 | ||
|
|
15c1ddaf99 | ||
|
|
8e66822100 | ||
|
|
3f74dfc3d8 | ||
|
|
edf6d0a0fb | ||
|
|
d2cd43601b | ||
|
|
12fea5b868 | ||
|
|
fead4749b9 | ||
|
|
f3925d71b9 | ||
|
|
92ae61bcc8 | ||
|
|
0a3e089827 | ||
|
|
c6533616b6 | ||
|
|
3fa5ce3e5f | ||
|
|
443b37403d | ||
|
|
57fbc6bdf1 |
32
.github/workflows/api_doc_build.yml
vendored
32
.github/workflows/api_doc_build.yml
vendored
@@ -10,6 +10,7 @@ env:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository == 'langchain-ai/langchain' || github.event_name != 'schedule'
|
||||
runs-on: ubuntu-latest
|
||||
permissions: write-all
|
||||
steps:
|
||||
@@ -73,6 +74,23 @@ jobs:
|
||||
with:
|
||||
repository: langchain-ai/langchain-unstructured
|
||||
path: langchain-unstructured
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: langchain-ai/langchain-databricks
|
||||
path: langchain-databricks
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: langchain-ai/langchain-ibm
|
||||
path: langchain-ibm
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: langchain-ai/langchain-azure
|
||||
path: langchain-azure
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: langchain-ai/langchain-mongodb
|
||||
path: langchain-mongodb
|
||||
|
||||
|
||||
|
||||
- name: Set Git config
|
||||
@@ -97,7 +115,11 @@ jobs:
|
||||
langchain/libs/standard-tests \
|
||||
langchain/libs/experimental \
|
||||
langchain/libs/partners/milvus \
|
||||
langchain/libs/partners/unstructured
|
||||
langchain/libs/partners/unstructured \
|
||||
langchain/libs/partners/databricks \
|
||||
langchain/libs/partners/ibm \
|
||||
langchain/libs/partners/azure-dynamic-sessions \
|
||||
langchain/libs/partners/mongodb
|
||||
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 +135,10 @@ 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
|
||||
mv langchain-ibm/libs/ibm langchain/libs/partners/ibm
|
||||
mv langchain-azure/libs/azure-dynamic-sessions langchain/libs/partners/azure-dynamic-sessions
|
||||
mv langchain-mongodb/libs/mongodb langchain/libs/partners/mongodb
|
||||
|
||||
- name: Rm old html
|
||||
run:
|
||||
@@ -131,8 +157,8 @@ jobs:
|
||||
run: |
|
||||
python -m pip install -U uv
|
||||
python -m uv pip install --upgrade --no-cache-dir pip setuptools
|
||||
# skip airbyte and ibm due to pandas dependency issue
|
||||
python -m uv pip install $(ls ./libs/partners | grep -vE "airbyte|ibm" | xargs -I {} echo "./libs/partners/{}")
|
||||
# skip airbyte due to pandas dependency issue
|
||||
python -m uv pip install $(ls ./libs/partners | grep -vE "airbyte" | xargs -I {} echo "./libs/partners/{}")
|
||||
python -m uv pip install libs/core libs/langchain libs/text-splitters libs/community libs/experimental
|
||||
python -m uv pip install -r docs/api_reference/requirements.txt
|
||||
|
||||
|
||||
2
.github/workflows/check-broken-links.yml
vendored
2
.github/workflows/check-broken-links.yml
vendored
@@ -7,7 +7,7 @@ on:
|
||||
|
||||
jobs:
|
||||
check-links:
|
||||
if: github.repository_owner == 'langchain-ai'
|
||||
if: github.repository_owner == 'langchain-ai' || github.event_name != 'schedule'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
2
.github/workflows/people.yml
vendored
2
.github/workflows/people.yml
vendored
@@ -14,7 +14,7 @@ on:
|
||||
|
||||
jobs:
|
||||
langchain-people:
|
||||
if: github.repository_owner == 'langchain-ai'
|
||||
if: github.repository_owner == 'langchain-ai' || github.event_name != 'schedule'
|
||||
runs-on: ubuntu-latest
|
||||
permissions: write-all
|
||||
steps:
|
||||
|
||||
19
.github/workflows/run_notebooks.yml
vendored
19
.github/workflows/run_notebooks.yml
vendored
@@ -20,7 +20,7 @@ env:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
if: github.repository == 'langchain-ai/langchain' || github.event_name != 'schedule'
|
||||
name: "Test docs"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -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:
|
||||
@@ -59,5 +51,6 @@ jobs:
|
||||
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
TAVILY_API_KEY: ${{ secrets.TAVILY_API_KEY }}
|
||||
WORKING_DIRECTORY: ${{ github.event.inputs.working-directory || 'all' }}
|
||||
run: |
|
||||
./docs/scripts/execute_notebooks.sh ${{ github.event.inputs.working-directory || 'all' }}
|
||||
./docs/scripts/execute_notebooks.sh $WORKING_DIRECTORY
|
||||
|
||||
2
.github/workflows/scheduled_test.yml
vendored
2
.github/workflows/scheduled_test.yml
vendored
@@ -10,7 +10,7 @@ env:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository_owner == 'langchain-ai'
|
||||
if: github.repository_owner == 'langchain-ai' || github.event_name != 'schedule'
|
||||
name: Python ${{ matrix.python-version }} - ${{ matrix.working-directory }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
||||
@@ -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/).
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -533,6 +533,7 @@ def _build_index(dirs: List[str]) -> None:
|
||||
"airbyte": "Airbyte",
|
||||
"aws": "AWS",
|
||||
"ai21": "AI21",
|
||||
"ibm": "IBM",
|
||||
}
|
||||
ordered = ["core", "langchain", "text-splitters", "community", "experimental"]
|
||||
main_ = [dir_ for dir_ in ordered if dir_ in dirs]
|
||||
|
||||
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/QK49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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+AftFyiSErtXlN0rDQmUxSXJoL41zF0mo79/XQasYR7mAwMMgnHQ5wczxu4zwNBS8+zmfH3EJd1iQFKeUBprLIRL3g5ggCjtRcEZc5FGGpCcZ8UnMgyGoiB0nBQXlW+xKtcElLipu0NCnnEj3yYMjOIMm4NmYgISgcICPCEN5RGVgEO7RVCDAY+BJRIbwBIhWnMBX7tM0dFFPBqVQDw6yiSYNSDADQ4EpPLc6YcAAJgIyX+Zy+dsPDF3GkQqFlA5QmkjEhWchIEHcV87PZSCBfAEjrvR9AXq6JEp7nxNHgGjOh/85NCGO+zwKhF9E5x0B6cz1lE4MYnhGWO4U7voEznfkeQ19CAI4ntzx6Pcipdz/EcQIARuR8AOOJJ3u/wgn/tB7oCKEH9wG8WM/2pWn5zOfYBeU+tdPfnHhUy6yV7dT/EtgIIE8IrFDXbgg+2P/LEhKyCVeCLy8hMSMSe727HJASKLiEIg7nZ/KvsJJEgZO7tA1mQ9XRSKrUpe725cyi1UoGrHI3rRBiUZr7eEEalGMDM20NP2rsQp1IohDqC2qjG02TfL9vy5vJNgZAIha1LlsOj/8almG8uzlHnbanVuQkgnZS8yim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HwaOLLJwTwVxC4ZK+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 @@
|
||||
eNrlV09v28gVb4GeAhTopfcJUaDAQqRJkZIpG0Ygy95E67WVxN7EzsIQRuRQ5Irk0DNDSXTgw2b7BfgR2nWkwnCzu0jQbrdNzz30C3gP/RD9BH1DUWs5DrAF9lTIB5rDee8378/vvXl6MR0SxgMa//wyiAVh2BGw4PmLKSMnKeHid5OICJ+65w87+wdfpiy4+sAXIuFrKys4CTSakBgHmkOjlaGx4vhYrMB7EpIC5rxH3ez7X3zwXIkI57hPuLKGPn2uOBTOigUslCOaIswIwsgnYeKlIcKcB1xg2K4ghdGQSDGecUEi5ayCbmj7wV0UZSjGEUEBRz3aW1RKOWG3VB6QMKRok/buogd0hBwco3Z5JsrAGEFdnN1bhLk26F2sEfj7Wz634N7ts4/hS0RdEspP/USolpSJYWXAfy4YwREsBEsJrMHDBFIgUiYhdG1VfqM0LKMmsqSA9tK4yJKE+uF9DSyTRkgBgYdBmHU5wczxu4zwNBS8+xmfqbiEOyxISi2liWZyiMT9ICaIwk4UnBIXeZQhmUxGfBLzYAgmYsdJwUD5FrvSbMiKi8oTNPQJJzKDUnEEOkU8YwISgoICHxGGClJJbiDco6lAgMcgmogM4QkQ7TiBr9ynaeiinuRFaR4oskyTDiSYgaNAVl54nTAgIRMBmS0LueLtHUcXcaRBIaU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O5/Jq4OZXv4FFt25WPcOwa45tOI2qaXmGTlzDaGC7ZlrE6P1VtkcHcGQqE8og1QRuwkBk+VUlwmPZczZMo2bWwdN1aLJOmLpkP+1tUekDX0dwK4cUu1+1PlRb2PGJul/QMZ9uHe01d9utPx+qi7xSO8lssJvGlMeB5032CYO05BdOSFMXmicjE8B63DzK39iuaXgWpIqAwR5ZVTc7+1McgpFDJ3/tmxvKmmWZyjqK8IZdt3S9mPM+n8x6/ve/TF0ssLw8Amj5ihwKHRgJ1Wa7H5Os1hmMzHZbzwYndfv+/fZe2D70n9WUyvwemGlo12OkVrAbBByoBiGvkXnlNvTKfLyaTVeqXjdMkJyNi10PzCEsAasANk7DEDB8GjjyloOBKohdMlbWAAQgBFbWnpfj28LIV7me9xRYMBhwOA5naGcVJaR9oH2Pz+HhxIDLmQvLaWsmdXx2587/b0Su3YdRXY7TS+VzMdgvndMBXzqX4QfhsvmsLV2S4Qf/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+omBZDWAox8KdgvIgFNzxmX4fZFUlAppGuIsXe3Q4zCYlDgjkVlTWcNm1EGJHwr2oKYhIwiDCCimBCQwkZDqTpiolBONzm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ftxwUiwo0b73299vKfjVyjj13fOnq5wP9L+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/OckN4KN3wIqQFGGmoi23fjGykEWKRUIPpRVQKPBvTZWREQuyUDhbR1O4BHEhQ2MVogDX4K0CWi4j54+zWiOCgdHAbRhzPwDYd6vghp9A1LjyJ8DcJA6w58BAGEYZnOMsHZoRRQEEIfI2OeZ6d4B+OfAbajFzGLwrq5PMSoOhqDlsQan3LHqkEa4HeVQNMIjsk6h0SbzEw0QPLT3aVmiheh7DbsVyMPJhxrH1sINMLEGVrgLvYJVYfUNR0PQIE6SfXoGgDfwyUnMCjawRTXtKNA9iDRsBmF8OK0IMNZACcYuKlUkJa24tCBPACYCvCffgJINZcH0ZJ14tsA7WphBL0YGMw4ikBvhYAoaA2hFHtB6AOQWjh+JGtY5+eITQLhyJke14PRT6FmHIWBGK5ndLBARUkaKIVYIPyPgF6O7PUa9/BeghLmXK8tGhsze0Qxwq7iXROEchWjCdlouXCT0ejMwm7LsL+LbqfR+dhgeaOnuPoyZJFxn8HZIRAG0FfLVBaUKcffAkmPss9qvkBBraB/IIvzcrbB8ddrBmA1D++8Z3DrkfC8eNpe38XNBCDHWFX9ww4YPz7zr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Kuh5C9W549kLX8kxy1IuaN7aS93tzIud7q9nan45E2/cyfsvBEsKnmjmM8bwULeCP7re63c+a3X80ZxpVY4rjknWM6f4zqfN5LfKN6g5j847ea0TtVKG4SL98Z5FzXt+s4b0YXrzoHrhun8lWp8nL8CVZHrK96nijfmV5vg3CVzkeN3i46Rue/v9Bz271TyVlQPPCd3RIc57F8mXhR2Bzh/b5CoeIWcfxlfTv6BefFCVbxQzVnzhCDmjeR68Q5ZtIvM2ztku8jcF9euedPqt6LcvTyybyMqrpnFNXO+CG7krtXtR0WAmn8z3rGI1bbswmUXLnsOMwPFe3LxnjxnRtxz8veenL+LyGUbqMpfDc71QpzDYqsW5pDoHH4nQeZbSouvoJh/kiM/f2adu6+JQvSr7ItvV5l/kj2zSBjMe8JALJJg895+n7+MAfsVLvm7idBfyJS7GOUWMWrOCZYEqfgHNUUZsqjUFCJ+tURcKYpx80jwS/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+WFoAlYIauPJnW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ZdS2BCrqRRMZtXWztG4U0b29g4tmfs6B5OAlEmQs1tJyqGYNYgNBQ2WciM1YOGrt2wMGtdQBYu4sLsHccuNwQOzz5gfp/07SH3IrHYL+pJJxRDlRczOTi0P1cdbl1db2m+yuqZT1cehN07uQvEvvwWg6HtlWbNvucBTo9alZ8noktpy3uQrUEHkMGKQGPPnSLBuv850FE8/BeV01dFU3vh+rspH40GsgwukzHzV4claG8H93U0DQATSi5FWan78v7zMSAIHlyVcgZr1e/9uHhRZA1Xq9XP3+ugzEeQnEKAb8u5sCOcBZCbYvxgt51bOTy1/DoutAwMslbFTqlWKtTvSyZVrVUqlqwncTsvEXWR4twJGpjCiDVBPohJ6YJJeFAI9lzdksGeVSBTzdgCJr+bFNOnFvm0of+AaCruxTbH/dvKs2seUStZPSMZlvH+039lrNPx2qy7xS21E20c1DykPPcWYdwiAtybnl09iG4snIDLAeN46StzW7ZDim7pi9olFzSFXdanfm2Acjh1byxi1tKuumWVI2UIA3axVT19MB77ezrOb/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/Q1oYVGEnbQ9FLG7THHvoC7r3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YfKGOGa4oYjGxAVzh0RVxFuHXrsT5laSsqKbPj97pVy3ZlpA8XO0uttky6jvqm61a0Weds0Zu0Rks9k5TAFDnMyyMukyh2mNbf6ahNwUVaGHjDFrRbZXmCOtTdNpCqw9pAk7nLoFhs+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+2r7yv3vufYCZEgoEpogurKKv6YQCt1bAhpStVs7QodG4zQfVVDQ2ihY9PUlX0VujLgj2mse+7stA7pPxP+43zv+z5f7+/5Pc9zs7UisrBi6BsWFJ0gS5QILLAzW7PQhI0webiqIZI35Epf7+DQIdtSVrbmCTFxSzAomgpjmEgXFUYytGCRC0p5kQTh3VSRZ6aSMeTyWxsz034NYSzmEPa3UPdM+yUDfOkEFv7tymZ/gPJbhorcpY2R5Z8Zhx3NkJHqbuVMQvOujA4rDv4xsZCowSIrqhjBBkGaCaET23JtsEzM3TMMteGNlE3PdtbWvdu5tq68t1DTfl3UPAEiFhW1nMZItKR82kLYVglO78F1FRlhyVLMhpY/QdXlKKTnFB1RBpxoyhSSqaxhUS4IFsojHStFCFGUJBsCdN90mSKWjQkINjww1N0YZW3VU5wEHaps2JSOQIIYoIAnkUV5yXAxpcSMYRMK7FkAIYWK8AQTnboJuzhv2KpMZRAlroYHilaZcS9gihZcFJKMvVubFiTPIgqqLz057+0TF2224wakGkaBsk3X4iqykBFFz/lnZtxMAm8UC8ku9g2j402iRmYPkgiIguz/kRpV1HNYU0i+kZ1rJGSwH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4d8CtFAxh1RDlI8ltdFKU8oge9Ojn1DpGexLdnckfjtDNPKJ7zfr3T003sK5ks9VBZEFanHlJNWwZeqWFqmBrIDHqLAlymMuGIyE+izghi2J0O3ShVWtXWFdxG21NVCH2ouQcy4fb/C08H/a3UprYJkR5lvW+kh6s1jv/qxvSX/3ODT7vt1HtP6q/zN76+399/shTB3f4bol0pUZ3B5K3HJ4/Lez72eFzuVcfe+uGSxcPJK9LkEvmX1r/+OS+Db7Hv9D1wCOzrf1fjNy3gD9++fbvmcdvLr4ZeOJi6sWZt7XzZ/fyXypf/+5LfSfu+3DLM/xNT15Q+jdP/nX8UOn9W7dNfGvf2NOVzx544vzyo7lz5le6W1OJge+jG+//jM/32kcfrJC9LwUeNN/42jfGfonln5//nO+57eWHJwpz9r2t0ZP7Z5eSby+PHxz4wHfHvzf8NLLwp8ADe/eY3730TnnLwj/77nlv4z/Gnt105/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+2IpQhzijDyaZh4aYiwEIGQGK5LSOMspIpMZELSS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geruVhW1iURls2wjy1m1K6tmA320e3DZmqk5UBC8RpKO5UrRDfXpfFhDMNq4oHI9lZ7ufH3AoZV6gMuteQ2cEz+NB9S9aH0Q/e8V+iG1yh8YTzodJ0xQfWZmfnmo70/nrb69+XZaajrjfRwHJ0Up5O+LMhidjEcuSV3XH44is3FiV4IeTYn3bsYCLUSpAYP0SOSvK/Xq1exmDsQLcN7ULVM3rW/HupojIYwaCHDxnA19kZ9VIfrf3CWQbABzKH9TpOfvi/ecRoBfpflGiN1oNP72YaK5oHqj7tjf3qaBOC8IscqR+OYuwVyAVbMicTmeM+iBm1//Cg7dHq3WzYqHTeI0qrWaW673ana9YfYauEGo2fiLao8EBKlcJoxDrilMwkBm+XUpwmPVc9YrVrVSA1fXoMmSMHVpJ+1tMuWEWEMwlUOG3S9bD/QWJj7VOwUe8/PNo73m7nbrT4f6IrD0djJdrs5jJuLA8yYdyiEv+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+uHYIyvmK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Ypb9e8CaaqEVsZIhkJWPEaa1V9qFyu66jsdDdFgk3VcQRz4W4Uc7mcGIJZUStmxRCySWaCgXC7lfA1h6y4r8leRjR67eXhZrejzId3hmpWOoVqLCXLeBWXbI80VrTgeJhsaE4mq8pcNTUONVW7PEmThB+1Jnw42VKmxckyWA2lxjy2UjOcTBZ22JPnBwL5gRjscJdgk+woNTO5Hnis03dhqXkF3OZ+gUuVmgNGMwF8UjwIsCrw1IgCGN8Je6AlWMZD495wqBbUpVYQnX4HGpWIctLZwdrlVS0M6nWzsWhFXFS8aJTwTWmCAycRNN8HJ0rkhhC9l/r/zOqjZmQq3RG/NPHZygqiIrCRSCYAZEgfvY/mRI2Ba10GGYh5XVlQHyIZOxaxE5DcNEFGgAsphwtz0tt/yyFtfBOyFAdnLEHrgzG7x1JCEHZLqZmnPKSTQNHcx21jxphJITpW0Dp/+8Om3K+Q078SNqFPbP5tydiFn9JddzZvrdpye3fr7RkNW+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_e593bb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Jr2AamasjCcesC3NOGZ0JOVDJpV2xfyc21rND/j7em2WtYa7bLg1dFmzXMdI+CTnP9A5W6Zj6iwXjAdelOh8HMMtgFkG1K+AACYC9DnbMbcYE5nyR9ptgkUnUwFe9CzzbrWyFLcw0+E6pmE2c9RniRdFiJmFnUYyqxyZphFDAjQdbX3GD+M0yFzr3TFAKEM2g5xPx2hdAzNSGxmoQ/WnLAx3La/AHUscEwpxWO5qdAXuCBXAIonxdVO4dHexjUet4RwVnUVZ0JkzvY6YLtAOaWRIOs+I18aTFCsoV8I16gWQK9E07JMTbEPsLYHdbBrtttV2Wg3s9d1xrkfBSeWq6ftZn9KQFN2vpxjz4YOmx/YEHyu4qCRjEs9rOL19FMBIpskdxpNU5bPrS2z1L7atXul1r42HXt41ZFu+kuB0G3b7ZP9xt9/7atgbkL3BUX+EX/LZcH/Qsz4nB1Rtet2sNy4v+gcxR850r9uNtnt5cXQvhDkidaRxrAzS7xooxeXFvoEyXV70DGIY+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/pqnK76XYrITmUFZFmQCnJzgcAaeQFygDXSfCg3TObSASDnomchCHU1fV6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RcYynemhFdQYefZV2OAKFwQW81bqfiTb1/wq5JNfFW+fEHD28oKz7r5I431flHN899+0jD4Lbjfzt9/ND4fcPrX9zSHtp1qLBfnHvgUsuHgQ//3r29YHz24L8D59a/fOXh/d/8bmTp6tyxpavMXZvP/Mi3YaHpcSUx8dKFi57+rvRH6Vn/k0tXr2z9/Av05tbOb/Y98nAo9Nam6I2cP/JB6u6e5z6ef+cF4Z6p5upd5/90vaLtu6PjW1qfXbg/PD/zn6ODXX9m2+Jfdyw++/i1+nuXflD2xpWvDt6vHNrkGMn888DstbnJjk9HHiq7/Pb6uqYvTyaknseO5BwXxJGTf9l3bvfHfXuG3rl8efB708RT2ypmTu6+dP2lTacG48r0t8PHovf8OHqk92dP/+SrM3W/nVY2U9wDrMc4/MbG4S++v77x/KMLT86fOPDL3+97L7y0t/tfew7+QtbeffrLe8s3Lhwb+8MzN8qnZxfOLXqP/kbecOV5P3Pi9Q1/vdQu3Ax7RuEHqbPcxdGNBz9b/KTtvnC6Zs+vKn7YAs9v/fzT75xqPVR58h8/Hdm8o3D3hTHnkbbR4M2vtx0e+rlyPUG9f63iRvi9j9TtShIdm/+jNLI9/X4/1uTmzXVlWx46CxbvKiv7LxN30us=
|
||||
@@ -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."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
"id": "08f8b820-5912-49c1-9d76-40be0571dffb",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"This creates a retriever (specifically a [VectorStoreRetriever](https://python.langchain.com/api_reference/core/vectorstores/langchain_core.vectorstores.VectorStoreRetriever.html)), which we can use in the usual way:"
|
||||
"This creates a retriever (specifically a [VectorStoreRetriever](https://python.langchain.com/api_reference/core/vectorstores/langchain_core.vectorstores.base.VectorStoreRetriever.html)), which we can use in the usual way:"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"Ensure the `langchain_community` and `friendli-client` are installed.\n",
|
||||
"\n",
|
||||
"```sh\n",
|
||||
"pip install -U langchain-comminity friendli-client.\n",
|
||||
"pip install -U langchain-community friendli-client.\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"Sign in to [Friendli Suite](https://suite.friendli.ai/) to create a Personal Access Token, and set it as the `FRIENDLI_TOKEN` environment."
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
"### 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",
|
||||
"| ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ | "
|
||||
"| ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ❌ | ✅ | ✅ | "
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
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
|
||||
}
|
||||
@@ -434,6 +434,160 @@
|
||||
"fine_tuned_model.invoke(messages)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "5d5d9793",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Multimodal Inputs\n",
|
||||
"\n",
|
||||
"OpenAI has models that support multimodal inputs. You can pass in images or audio to these models. For more information on how to do this in LangChain, head to the [multimodal inputs](/docs/how_to/multimodal_inputs) docs.\n",
|
||||
"\n",
|
||||
"You can see the list of models that support different modalities in [OpenAI's documentation](https://platform.openai.com/docs/models).\n",
|
||||
"\n",
|
||||
"At the time of this doc's writing, the main OpenAI models you would use would be:\n",
|
||||
"\n",
|
||||
"- Image inputs: `gpt-4o`, `gpt-4o-mini`\n",
|
||||
"- Audio inputs: `gpt-4o-audio-preview`\n",
|
||||
"\n",
|
||||
"For an example of passing in image inputs, see the [multimodal inputs how-to guide](/docs/how_to/multimodal_inputs).\n",
|
||||
"\n",
|
||||
"Below is an example of passing audio inputs to `gpt-4o-audio-preview`:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"id": "39d08780",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"\"I'm sorry, but I can't create audio content that involves yelling. Is there anything else I can help you with?\""
|
||||
]
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import base64\n",
|
||||
"\n",
|
||||
"from langchain_openai import ChatOpenAI\n",
|
||||
"\n",
|
||||
"llm = ChatOpenAI(\n",
|
||||
" model=\"gpt-4o-audio-preview\",\n",
|
||||
" temperature=0,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"with open(\n",
|
||||
" \"../../../../libs/partners/openai/tests/integration_tests/chat_models/audio_input.wav\",\n",
|
||||
" \"rb\",\n",
|
||||
") as f:\n",
|
||||
" # b64 encode it\n",
|
||||
" audio = f.read()\n",
|
||||
" audio_b64 = base64.b64encode(audio).decode()\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"output_message = llm.invoke(\n",
|
||||
" [\n",
|
||||
" (\n",
|
||||
" \"human\",\n",
|
||||
" [\n",
|
||||
" {\"type\": \"text\", \"text\": \"Transcribe the following:\"},\n",
|
||||
" # the audio clip says \"I'm sorry, but I can't create...\"\n",
|
||||
" {\n",
|
||||
" \"type\": \"input_audio\",\n",
|
||||
" \"input_audio\": {\"data\": audio_b64, \"format\": \"wav\"},\n",
|
||||
" },\n",
|
||||
" ],\n",
|
||||
" ),\n",
|
||||
" ]\n",
|
||||
")\n",
|
||||
"output_message.content"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "feb4a499",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Audio Generation (Preview)\n",
|
||||
"\n",
|
||||
":::info\n",
|
||||
"Requires `langchain-openai>=0.2.3`\n",
|
||||
":::\n",
|
||||
"\n",
|
||||
"OpenAI has a new [audio generation feature](https://platform.openai.com/docs/guides/audio?audio-generation-quickstart-example=audio-out) that allows you to use audio inputs and outputs with the `gpt-4o-audio-preview` model."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "f67a2cac",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from langchain_openai import ChatOpenAI\n",
|
||||
"\n",
|
||||
"llm = ChatOpenAI(\n",
|
||||
" model=\"gpt-4o-audio-preview\",\n",
|
||||
" temperature=0,\n",
|
||||
" model_kwargs={\n",
|
||||
" \"modalities\": [\"text\", \"audio\"],\n",
|
||||
" \"audio\": {\"voice\": \"alloy\", \"format\": \"wav\"},\n",
|
||||
" },\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"output_message = llm.invoke(\n",
|
||||
" [\n",
|
||||
" (\"human\", \"Are you made by OpenAI? Just answer yes or no\"),\n",
|
||||
" ]\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b7dd4e8b",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"`output_message.additional_kwargs['audio']` will contain a dictionary like\n",
|
||||
"```python\n",
|
||||
"{\n",
|
||||
" 'data': '<audio data b64-encoded',\n",
|
||||
" 'expires_at': 1729268602,\n",
|
||||
" 'id': 'audio_67127d6a44348190af62c1530ef0955a',\n",
|
||||
" 'transcript': 'Yes.'\n",
|
||||
"}\n",
|
||||
"```\n",
|
||||
"and the format will be what was passed in `model_kwargs['audio']['format']`.\n",
|
||||
"\n",
|
||||
"We can also pass this message with audio data back to the model as part of a message history before openai `expires_at` is reached.\n",
|
||||
"\n",
|
||||
":::note\n",
|
||||
"Output audio is stored under the `audio` key in `AIMessage.additional_kwargs`, but input content blocks are typed with an `input_audio` type and key in `HumanMessage.content` lists. \n",
|
||||
"\n",
|
||||
"For more information, see OpenAI's [audio docs](https://platform.openai.com/docs/guides/audio).\n",
|
||||
":::"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"id": "f5ae473d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"history = [\n",
|
||||
" (\"human\", \"Are you made by OpenAI? Just answer yes or no\"),\n",
|
||||
" output_message,\n",
|
||||
" (\"human\", \"And what is your name? Just give your name.\"),\n",
|
||||
"]\n",
|
||||
"second_output_message = llm.invoke(history)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a796d728-971b-408b-88d5-440015bbb941",
|
||||
@@ -447,7 +601,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"display_name": ".venv",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"source": [
|
||||
"## Setting up\n",
|
||||
"\n",
|
||||
"Follow [instructions to set up an AWS accoung](https://docs.aws.amazon.com/athena/latest/ug/setting-up.html).\n",
|
||||
"Follow [instructions to set up an AWS account](https://docs.aws.amazon.com/athena/latest/ug/setting-up.html).\n",
|
||||
"\n",
|
||||
"Install a python library:"
|
||||
]
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"source": [
|
||||
"## Setting up\n",
|
||||
"\n",
|
||||
"- Follow [instructions to set up an AWS accoung](https://docs.aws.amazon.com/athena/latest/ug/setting-up.html).\n",
|
||||
"- Follow [instructions to set up an AWS account](https://docs.aws.amazon.com/athena/latest/ug/setting-up.html).\n",
|
||||
"- Install the boto3 library: `pip install boto3`\n"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"Ensure the `langchain_community` and `friendli-client` are installed.\n",
|
||||
"\n",
|
||||
"```sh\n",
|
||||
"pip install -U langchain-comminity friendli-client.\n",
|
||||
"pip install -U langchain-community friendli-client.\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"Sign in to [Friendli Suite](https://suite.friendli.ai/) to create a Personal Access Token, and set it as the `FRIENDLI_TOKEN` environment."
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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
|
||||
|
||||
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
|
||||
```
|
||||
@@ -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",
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
14
docs/docs/troubleshooting/errors/INVALID_PROMPT_INPUT.mdx
Normal file
14
docs/docs/troubleshooting/errors/INVALID_PROMPT_INPUT.mdx
Normal file
@@ -0,0 +1,14 @@
|
||||
# INVALID_PROMPT_INPUT
|
||||
|
||||
A [prompt template](/docs/concepts#prompt-templates) received missing or invalid input variables.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
The following may help resolve this error:
|
||||
|
||||
- Double-check your prompt template to ensure that it is correct.
|
||||
- If you are using the default f-string format and you are using curly braces `{` anywhere in your template, they should be double escaped like this: `{{` (and if you want to render a double curly brace, you should use four curly braces: `{{{{`).
|
||||
- If you are using a [`MessagesPlaceholder`](/docs/concepts/#messagesplaceholder), make sure that you are passing in an array of messages or message-like objects.
|
||||
- If you are using shorthand tuples to declare your prompt template, make sure that the variable name is wrapped in curly braces (`["placeholder", "{messages}"]`).
|
||||
- Try viewing the inputs into your prompt template using [LangSmith](https://docs.smith.langchain.com/) or log statements to confirm they appear as expected.
|
||||
- If you are pulling a prompt from the [LangChain Prompt Hub](https://smith.langchain.com/prompts), try pulling and logging it or running it in isolation with a sample input to confirm that it is what you expect.
|
||||
272
docs/docs/troubleshooting/errors/INVALID_TOOL_RESULTS.ipynb
Normal file
272
docs/docs/troubleshooting/errors/INVALID_TOOL_RESULTS.ipynb
Normal file
File diff suppressed because one or more lines are too long
122
docs/docs/troubleshooting/errors/MESSAGE_COERCION_FAILURE.ipynb
Normal file
122
docs/docs/troubleshooting/errors/MESSAGE_COERCION_FAILURE.ipynb
Normal file
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# MESSAGE_COERCION_FAILURE\n",
|
||||
"\n",
|
||||
"Instead of always requiring instances of `BaseMessage`, several modules in LangChain take `MessageLikeRepresentation`, which is defined as:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from typing import Union\n",
|
||||
"\n",
|
||||
"from langchain_core.prompts.chat import (\n",
|
||||
" BaseChatPromptTemplate,\n",
|
||||
" BaseMessage,\n",
|
||||
" BaseMessagePromptTemplate,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"MessageLikeRepresentation = Union[\n",
|
||||
" Union[BaseMessagePromptTemplate, BaseMessage, BaseChatPromptTemplate],\n",
|
||||
" tuple[\n",
|
||||
" Union[str, type],\n",
|
||||
" Union[str, list[dict], list[object]],\n",
|
||||
" ],\n",
|
||||
" str,\n",
|
||||
"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"These include OpenAI style message objects (`{ role: \"user\", content: \"Hello world!\" }`),\n",
|
||||
"tuples, and plain strings (which are converted to [`HumanMessages`](/docs/concepts#humanmessage)).\n",
|
||||
"\n",
|
||||
"If one of these modules receives a value outside of one of these formats, you will receive an error like the following:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "ValueError",
|
||||
"evalue": "Message dict must contain 'role' and 'content' keys, got {'role': 'HumanMessage', 'random_field': 'random value'}",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/messages/utils.py:318\u001b[0m, in \u001b[0;36m_convert_to_message\u001b[0;34m(message)\u001b[0m\n\u001b[1;32m 317\u001b[0m \u001b[38;5;66;03m# None msg content is not allowed\u001b[39;00m\n\u001b[0;32m--> 318\u001b[0m msg_content \u001b[38;5;241m=\u001b[39m \u001b[43mmsg_kwargs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpop\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mcontent\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 319\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n",
|
||||
"\u001b[0;31mKeyError\u001b[0m: 'content'",
|
||||
"\nThe above exception was the direct cause of the following exception:\n",
|
||||
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[0;32mIn[5], line 10\u001b[0m\n\u001b[1;32m 3\u001b[0m uncoercible_message \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 4\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrole\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mHumanMessage\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 5\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrandom_field\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrandom value\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 6\u001b[0m }\n\u001b[1;32m 8\u001b[0m model \u001b[38;5;241m=\u001b[39m ChatAnthropic(model\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mclaude-3-5-sonnet-20240620\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m---> 10\u001b[0m \u001b[43mmodel\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minvoke\u001b[49m\u001b[43m(\u001b[49m\u001b[43m[\u001b[49m\u001b[43muncoercible_message\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/language_models/chat_models.py:287\u001b[0m, in \u001b[0;36mBaseChatModel.invoke\u001b[0;34m(self, input, config, stop, **kwargs)\u001b[0m\n\u001b[1;32m 275\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21minvoke\u001b[39m(\n\u001b[1;32m 276\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 277\u001b[0m \u001b[38;5;28minput\u001b[39m: LanguageModelInput,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 281\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs: Any,\n\u001b[1;32m 282\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m BaseMessage:\n\u001b[1;32m 283\u001b[0m config \u001b[38;5;241m=\u001b[39m ensure_config(config)\n\u001b[1;32m 284\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m cast(\n\u001b[1;32m 285\u001b[0m ChatGeneration,\n\u001b[1;32m 286\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgenerate_prompt(\n\u001b[0;32m--> 287\u001b[0m [\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_convert_input\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m)\u001b[49m],\n\u001b[1;32m 288\u001b[0m stop\u001b[38;5;241m=\u001b[39mstop,\n\u001b[1;32m 289\u001b[0m callbacks\u001b[38;5;241m=\u001b[39mconfig\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcallbacks\u001b[39m\u001b[38;5;124m\"\u001b[39m),\n\u001b[1;32m 290\u001b[0m tags\u001b[38;5;241m=\u001b[39mconfig\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtags\u001b[39m\u001b[38;5;124m\"\u001b[39m),\n\u001b[1;32m 291\u001b[0m metadata\u001b[38;5;241m=\u001b[39mconfig\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmetadata\u001b[39m\u001b[38;5;124m\"\u001b[39m),\n\u001b[1;32m 292\u001b[0m run_name\u001b[38;5;241m=\u001b[39mconfig\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrun_name\u001b[39m\u001b[38;5;124m\"\u001b[39m),\n\u001b[1;32m 293\u001b[0m run_id\u001b[38;5;241m=\u001b[39mconfig\u001b[38;5;241m.\u001b[39mpop(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrun_id\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m),\n\u001b[1;32m 294\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[1;32m 295\u001b[0m )\u001b[38;5;241m.\u001b[39mgenerations[\u001b[38;5;241m0\u001b[39m][\u001b[38;5;241m0\u001b[39m],\n\u001b[1;32m 296\u001b[0m )\u001b[38;5;241m.\u001b[39mmessage\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/language_models/chat_models.py:267\u001b[0m, in \u001b[0;36mBaseChatModel._convert_input\u001b[0;34m(self, input)\u001b[0m\n\u001b[1;32m 265\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m StringPromptValue(text\u001b[38;5;241m=\u001b[39m\u001b[38;5;28minput\u001b[39m)\n\u001b[1;32m 266\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28minput\u001b[39m, Sequence):\n\u001b[0;32m--> 267\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ChatPromptValue(messages\u001b[38;5;241m=\u001b[39m\u001b[43mconvert_to_messages\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 268\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 269\u001b[0m msg \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 270\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mInvalid input type \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mtype\u001b[39m(\u001b[38;5;28minput\u001b[39m)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m. \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 271\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mMust be a PromptValue, str, or list of BaseMessages.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 272\u001b[0m )\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/messages/utils.py:348\u001b[0m, in \u001b[0;36mconvert_to_messages\u001b[0;34m(messages)\u001b[0m\n\u001b[1;32m 346\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(messages, PromptValue):\n\u001b[1;32m 347\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m messages\u001b[38;5;241m.\u001b[39mto_messages()\n\u001b[0;32m--> 348\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m[\u001b[49m\u001b[43m_convert_to_message\u001b[49m\u001b[43m(\u001b[49m\u001b[43mm\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mm\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m]\u001b[49m\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/messages/utils.py:348\u001b[0m, in \u001b[0;36m<listcomp>\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 346\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(messages, PromptValue):\n\u001b[1;32m 347\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m messages\u001b[38;5;241m.\u001b[39mto_messages()\n\u001b[0;32m--> 348\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m [\u001b[43m_convert_to_message\u001b[49m\u001b[43m(\u001b[49m\u001b[43mm\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mfor\u001b[39;00m m \u001b[38;5;129;01min\u001b[39;00m messages]\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/messages/utils.py:321\u001b[0m, in \u001b[0;36m_convert_to_message\u001b[0;34m(message)\u001b[0m\n\u001b[1;32m 319\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 320\u001b[0m msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mMessage dict must contain \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mrole\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m and \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcontent\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m keys, got \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmessage\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m--> 321\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(msg) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n\u001b[1;32m 322\u001b[0m _message \u001b[38;5;241m=\u001b[39m _create_message_from_message_type(\n\u001b[1;32m 323\u001b[0m msg_type, msg_content, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mmsg_kwargs\n\u001b[1;32m 324\u001b[0m )\n\u001b[1;32m 325\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
|
||||
"\u001b[0;31mValueError\u001b[0m: Message dict must contain 'role' and 'content' keys, got {'role': 'HumanMessage', 'random_field': 'random value'}"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from langchain_anthropic import ChatAnthropic\n",
|
||||
"\n",
|
||||
"uncoercible_message = {\"role\": \"HumanMessage\", \"random_field\": \"random value\"}\n",
|
||||
"\n",
|
||||
"model = ChatAnthropic(model=\"claude-3-5-sonnet-20240620\")\n",
|
||||
"\n",
|
||||
"model.invoke([uncoercible_message])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Troubleshooting\n",
|
||||
"\n",
|
||||
"The following may help resolve this error:\n",
|
||||
"\n",
|
||||
"- Ensure that all inputs to chat models are an array of LangChain message classes or a supported message-like.\n",
|
||||
" - Check that there is no stringification or other unexpected transformation occuring.\n",
|
||||
"- Check the error's stack trace and add log or debugger statements."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv",
|
||||
"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.11.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
18
docs/docs/troubleshooting/errors/MODEL_AUTHENTICATION.mdx
Normal file
18
docs/docs/troubleshooting/errors/MODEL_AUTHENTICATION.mdx
Normal file
@@ -0,0 +1,18 @@
|
||||
# MODEL_AUTHENTICATION
|
||||
|
||||
Your model provider is denying you access to their service.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
The following may help resolve this error:
|
||||
|
||||
- Confirm that your API key or other credentials are correct.
|
||||
- If you are relying on an environment variable to authenticate, confirm that the variable name is correct and that it has a value set.
|
||||
- Note that environment variables can also be set by packages like `dotenv`.
|
||||
- For models, you can try explicitly passing an `api_key` parameter to rule out any environment variable issues like this:
|
||||
|
||||
```python
|
||||
model = ChatOpenAI(api_key="YOUR_KEY_HERE")
|
||||
```
|
||||
|
||||
- If you are using a proxy or other custom endpoint, make sure that your custom provider does not expect an alternative authentication scheme.
|
||||
10
docs/docs/troubleshooting/errors/MODEL_NOT_FOUND.mdx
Normal file
10
docs/docs/troubleshooting/errors/MODEL_NOT_FOUND.mdx
Normal file
@@ -0,0 +1,10 @@
|
||||
# MODEL_NOT_FOUND
|
||||
|
||||
The model name you have specified is not acknowledged by your provider.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
The following may help resolve this error:
|
||||
|
||||
- Double check the model string you are passing in.
|
||||
- If you are using a proxy or other alternative host with a model wrapper, confirm that the permitted model names are not restricted or altered.
|
||||
13
docs/docs/troubleshooting/errors/MODEL_RATE_LIMIT.mdx
Normal file
13
docs/docs/troubleshooting/errors/MODEL_RATE_LIMIT.mdx
Normal file
@@ -0,0 +1,13 @@
|
||||
# MODEL_RATE_LIMIT
|
||||
|
||||
You have hit the maximum number of requests that a model provider allows over a given time period and are being temporarily blocked.
|
||||
Generally, this error is temporary and your limit will reset after a certain amount of time.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
The following may help resolve this error:
|
||||
|
||||
- Contact your model provider and ask for a rate limit increase.
|
||||
- If many of your incoming requests are the same, utilize [model response caching](/docs/how_to/chat_model_caching/).
|
||||
- Spread requests across different providers if your application allows it.
|
||||
- Use a [`rate_limiter`](/docs/how_to/chat_model_rate_limiting/) to control the rate of requests to the model.
|
||||
126
docs/docs/troubleshooting/errors/OUTPUT_PARSING_FAILURE.ipynb
Normal file
126
docs/docs/troubleshooting/errors/OUTPUT_PARSING_FAILURE.ipynb
Normal file
@@ -0,0 +1,126 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# OUTPUT_PARSING_FAILURE\n",
|
||||
"\n",
|
||||
"An [output parser](/docs/concepts#output-parsers) was unable to handle model output as expected.\n",
|
||||
"\n",
|
||||
"To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'foo': 'bar'}"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from langchain_core.messages import AIMessage\n",
|
||||
"from langchain_core.output_parsers import JsonOutputParser\n",
|
||||
"\n",
|
||||
"message = AIMessage(content='```\\n{\"foo\": \"bar\"}\\n```')\n",
|
||||
"output_parser = JsonOutputParser()\n",
|
||||
"output_parser.invoke(message)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Internally, our JSON parser stripped out the markdown fence and newlines and then ran `json.loads`.\n",
|
||||
"\n",
|
||||
"If instead the chat model generated an output with malformed JSON, we will get an error:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "OutputParserException",
|
||||
"evalue": "Invalid json output: ```\n{{\"foo\":\n```",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mJSONDecodeError\u001b[0m Traceback (most recent call last)",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83\u001b[0m, in \u001b[0;36mJsonOutputParser.parse_result\u001b[0;34m(self, result, partial)\u001b[0m\n\u001b[1;32m 82\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 83\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mparse_json_markdown\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtext\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 84\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m JSONDecodeError \u001b[38;5;28;01mas\u001b[39;00m e:\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144\u001b[0m, in \u001b[0;36mparse_json_markdown\u001b[0;34m(json_string, parser)\u001b[0m\n\u001b[1;32m 143\u001b[0m json_str \u001b[38;5;241m=\u001b[39m json_string \u001b[38;5;28;01mif\u001b[39;00m match \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m match\u001b[38;5;241m.\u001b[39mgroup(\u001b[38;5;241m2\u001b[39m)\n\u001b[0;32m--> 144\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_parse_json\u001b[49m\u001b[43m(\u001b[49m\u001b[43mjson_str\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparser\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparser\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160\u001b[0m, in \u001b[0;36m_parse_json\u001b[0;34m(json_str, parser)\u001b[0m\n\u001b[1;32m 159\u001b[0m \u001b[38;5;66;03m# Parse the JSON string into a Python dictionary\u001b[39;00m\n\u001b[0;32m--> 160\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mparser\u001b[49m\u001b[43m(\u001b[49m\u001b[43mjson_str\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118\u001b[0m, in \u001b[0;36mparse_partial_json\u001b[0;34m(s, strict)\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[38;5;66;03m# If we got here, we ran out of characters to remove\u001b[39;00m\n\u001b[1;32m 116\u001b[0m \u001b[38;5;66;03m# and still couldn't parse the string as JSON, so return the parse error\u001b[39;00m\n\u001b[1;32m 117\u001b[0m \u001b[38;5;66;03m# for the original string.\u001b[39;00m\n\u001b[0;32m--> 118\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mjson\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloads\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstrict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstrict\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||
"File \u001b[0;32m~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359\u001b[0m, in \u001b[0;36mloads\u001b[0;34m(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)\u001b[0m\n\u001b[1;32m 358\u001b[0m kw[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mparse_constant\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m parse_constant\n\u001b[0;32m--> 359\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mcls\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkw\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdecode\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||
"File \u001b[0;32m~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337\u001b[0m, in \u001b[0;36mJSONDecoder.decode\u001b[0;34m(self, s, _w)\u001b[0m\n\u001b[1;32m 333\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Return the Python representation of ``s`` (a ``str`` instance\u001b[39;00m\n\u001b[1;32m 334\u001b[0m \u001b[38;5;124;03mcontaining a JSON document).\u001b[39;00m\n\u001b[1;32m 335\u001b[0m \n\u001b[1;32m 336\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m--> 337\u001b[0m obj, end \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraw_decode\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43midx\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m_w\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mend\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 338\u001b[0m end \u001b[38;5;241m=\u001b[39m _w(s, end)\u001b[38;5;241m.\u001b[39mend()\n",
|
||||
"File \u001b[0;32m~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353\u001b[0m, in \u001b[0;36mJSONDecoder.raw_decode\u001b[0;34m(self, s, idx)\u001b[0m\n\u001b[1;32m 352\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 353\u001b[0m obj, end \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mscan_once\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43midx\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 354\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m err:\n",
|
||||
"\u001b[0;31mJSONDecodeError\u001b[0m: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)",
|
||||
"\nThe above exception was the direct cause of the following exception:\n",
|
||||
"\u001b[0;31mOutputParserException\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[0;32mIn[9], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m message \u001b[38;5;241m=\u001b[39m AIMessage(content\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m```\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m{{\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfoo\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m```\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 2\u001b[0m output_parser \u001b[38;5;241m=\u001b[39m JsonOutputParser()\n\u001b[0;32m----> 3\u001b[0m \u001b[43moutput_parser\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minvoke\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmessage\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193\u001b[0m, in \u001b[0;36mBaseOutputParser.invoke\u001b[0;34m(self, input, config, **kwargs)\u001b[0m\n\u001b[1;32m 186\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21minvoke\u001b[39m(\n\u001b[1;32m 187\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 188\u001b[0m \u001b[38;5;28minput\u001b[39m: Union[\u001b[38;5;28mstr\u001b[39m, BaseMessage],\n\u001b[1;32m 189\u001b[0m config: Optional[RunnableConfig] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 190\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs: Any,\n\u001b[1;32m 191\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m T:\n\u001b[1;32m 192\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28minput\u001b[39m, BaseMessage):\n\u001b[0;32m--> 193\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_with_config\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 194\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mlambda\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43minner_input\u001b[49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparse_result\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 195\u001b[0m \u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43mChatGeneration\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmessage\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minner_input\u001b[49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 196\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 197\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 198\u001b[0m \u001b[43m \u001b[49m\u001b[43mconfig\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[43m \u001b[49m\u001b[43mrun_type\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mparser\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 200\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 201\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 202\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_call_with_config(\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01mlambda\u001b[39;00m inner_input: \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparse_result([Generation(text\u001b[38;5;241m=\u001b[39minner_input)]),\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28minput\u001b[39m,\n\u001b[1;32m 205\u001b[0m config,\n\u001b[1;32m 206\u001b[0m run_type\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mparser\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 207\u001b[0m )\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927\u001b[0m, in \u001b[0;36mRunnable._call_with_config\u001b[0;34m(self, func, input, config, run_type, serialized, **kwargs)\u001b[0m\n\u001b[1;32m 1923\u001b[0m context \u001b[38;5;241m=\u001b[39m copy_context()\n\u001b[1;32m 1924\u001b[0m context\u001b[38;5;241m.\u001b[39mrun(_set_config_context, child_config)\n\u001b[1;32m 1925\u001b[0m output \u001b[38;5;241m=\u001b[39m cast(\n\u001b[1;32m 1926\u001b[0m Output,\n\u001b[0;32m-> 1927\u001b[0m \u001b[43mcontext\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1928\u001b[0m \u001b[43m \u001b[49m\u001b[43mcall_func_with_variable_args\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# type: ignore[arg-type]\u001b[39;49;00m\n\u001b[1;32m 1929\u001b[0m \u001b[43m \u001b[49m\u001b[43mfunc\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# type: ignore[arg-type]\u001b[39;49;00m\n\u001b[1;32m 1930\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# type: ignore[arg-type]\u001b[39;49;00m\n\u001b[1;32m 1931\u001b[0m \u001b[43m \u001b[49m\u001b[43mconfig\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1932\u001b[0m \u001b[43m \u001b[49m\u001b[43mrun_manager\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1933\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1934\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m,\n\u001b[1;32m 1935\u001b[0m )\n\u001b[1;32m 1936\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 1937\u001b[0m run_manager\u001b[38;5;241m.\u001b[39mon_chain_error(e)\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396\u001b[0m, in \u001b[0;36mcall_func_with_variable_args\u001b[0;34m(func, input, config, run_manager, **kwargs)\u001b[0m\n\u001b[1;32m 394\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m run_manager \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m accepts_run_manager(func):\n\u001b[1;32m 395\u001b[0m kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrun_manager\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m run_manager\n\u001b[0;32m--> 396\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194\u001b[0m, in \u001b[0;36mBaseOutputParser.invoke.<locals>.<lambda>\u001b[0;34m(inner_input)\u001b[0m\n\u001b[1;32m 186\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21minvoke\u001b[39m(\n\u001b[1;32m 187\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 188\u001b[0m \u001b[38;5;28minput\u001b[39m: Union[\u001b[38;5;28mstr\u001b[39m, BaseMessage],\n\u001b[1;32m 189\u001b[0m config: Optional[RunnableConfig] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 190\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs: Any,\n\u001b[1;32m 191\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m T:\n\u001b[1;32m 192\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28minput\u001b[39m, BaseMessage):\n\u001b[1;32m 193\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_call_with_config(\n\u001b[0;32m--> 194\u001b[0m \u001b[38;5;28;01mlambda\u001b[39;00m inner_input: \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparse_result\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 195\u001b[0m \u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43mChatGeneration\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmessage\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minner_input\u001b[49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 196\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m,\n\u001b[1;32m 197\u001b[0m \u001b[38;5;28minput\u001b[39m,\n\u001b[1;32m 198\u001b[0m config,\n\u001b[1;32m 199\u001b[0m run_type\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mparser\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 200\u001b[0m )\n\u001b[1;32m 201\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 202\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_call_with_config(\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01mlambda\u001b[39;00m inner_input: \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparse_result([Generation(text\u001b[38;5;241m=\u001b[39minner_input)]),\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28minput\u001b[39m,\n\u001b[1;32m 205\u001b[0m config,\n\u001b[1;32m 206\u001b[0m run_type\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mparser\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 207\u001b[0m )\n",
|
||||
"File \u001b[0;32m~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86\u001b[0m, in \u001b[0;36mJsonOutputParser.parse_result\u001b[0;34m(self, result, partial)\u001b[0m\n\u001b[1;32m 84\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m JSONDecodeError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 85\u001b[0m msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mInvalid json output: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mtext\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m---> 86\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m OutputParserException(msg, llm_output\u001b[38;5;241m=\u001b[39mtext) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n",
|
||||
"\u001b[0;31mOutputParserException\u001b[0m: Invalid json output: ```\n{{\"foo\":\n```"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"message = AIMessage(content='```\\n{{\"foo\":\\n```')\n",
|
||||
"output_parser = JsonOutputParser()\n",
|
||||
"output_parser.invoke(message)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally,\n",
|
||||
"so you may see this error even if you're not visibly instantiating and using an output parser.\n",
|
||||
"\n",
|
||||
"## Troubleshooting\n",
|
||||
"\n",
|
||||
"The following may help resolve this error:\n",
|
||||
"\n",
|
||||
"- Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values.\n",
|
||||
" - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead.\n",
|
||||
"- Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format.\n",
|
||||
"- If you are using a smaller or less capable model, try using a more capable one.\n",
|
||||
"- Add [LLM-powered retries](/docs/how_to/output_parser_fixing/)."
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv",
|
||||
"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.11.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
12
docs/docs/troubleshooting/errors/index.mdx
Normal file
12
docs/docs/troubleshooting/errors/index.mdx
Normal file
@@ -0,0 +1,12 @@
|
||||
# Error reference
|
||||
|
||||
This page contains guides around resolving common errors you may find while building with LangChain.
|
||||
Errors referenced below will have an `lc_error_code` property corresponding to one of the below codes when they are thrown in code.
|
||||
|
||||
- [INVALID_PROMPT_INPUT](/docs/troubleshooting/errors/INVALID_PROMPT_INPUT)
|
||||
- [INVALID_TOOL_RESULTS](/docs/troubleshooting/errors/INVALID_TOOL_RESULTS)
|
||||
- [MESSAGE_COERCION_FAILURE](/docs/troubleshooting/errors/MESSAGE_COERCION_FAILURE)
|
||||
- [MODEL_AUTHENTICATION](/docs/troubleshooting/errors/MODEL_AUTHENTICATION)
|
||||
- [MODEL_NOT_FOUND](/docs/troubleshooting/errors/MODEL_NOT_FOUND)
|
||||
- [MODEL_RATE_LIMIT](/docs/troubleshooting/errors/MODEL_RATE_LIMIT)
|
||||
- [OUTPUT_PARSING_FAILURE](/docs/troubleshooting/errors/OUTPUT_PARSING_FAILURE)
|
||||
@@ -449,7 +449,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Right now, all we've done is add a simple persistence layer around the model. We can start to make the more complicated and personalized by adding in a prompt template.\n",
|
||||
"Right now, all we've done is add a simple persistence layer around the model. We can start to make the chatbot more complicated and personalized by adding in a prompt template.\n",
|
||||
"\n",
|
||||
"## Prompt templates\n",
|
||||
"\n",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
"* Run `.read Chinook.sql`\n",
|
||||
"* Test `SELECT * FROM Artist LIMIT 10;`\n",
|
||||
"\n",
|
||||
"Now, `Chinhook.db` is in our directory and we can interface with it using the SQLAlchemy-driven `SQLDatabase` class:"
|
||||
"Now, `Chinook.db` is in our directory and we can interface with it using the SQLAlchemy-driven `SQLDatabase` class:"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -377,7 +377,7 @@
|
||||
"\n",
|
||||
"* [Prompting strategies](/docs/how_to/sql_prompting): Advanced prompt engineering techniques.\n",
|
||||
"* [Query checking](/docs/how_to/sql_query_checking): Add query validation and error handling.\n",
|
||||
"* [Large databses](/docs/how_to/sql_large_db): Techniques for working with large databases."
|
||||
"* [Large databases](/docs/how_to/sql_large_db): Techniques for working with large databases."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -181,6 +181,11 @@ const config = {
|
||||
docId: "people",
|
||||
label: "People",
|
||||
},
|
||||
{
|
||||
type: "doc",
|
||||
docId: "troubleshooting/errors/index",
|
||||
label: "Error reference",
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
value: '<hr class="dropdown-separator" style="margin-top: 0.5rem; margin-bottom: 0.5rem">',
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ export default function PaginatorWrapper(props) {
|
||||
category="Docs Discussions"
|
||||
categoryId="DIC_kwDOIPDwls4CjJYb"
|
||||
mapping="pathname"
|
||||
strict="0"
|
||||
strict="1"
|
||||
reactionsEnabled="0"
|
||||
emitMetadata="0"
|
||||
inputPosition="bottom"
|
||||
|
||||
@@ -1026,8 +1026,8 @@ const FEATURE_TABLES = {
|
||||
link: "mongodb_atlas",
|
||||
deleteById: true,
|
||||
filtering: true,
|
||||
searchByVector: false,
|
||||
searchWithScore: false,
|
||||
searchByVector: true,
|
||||
searchWithScore: true,
|
||||
async: true,
|
||||
passesStandardTests: false,
|
||||
multiTenancy: false,
|
||||
|
||||
@@ -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,14 @@
|
||||
{
|
||||
"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*"
|
||||
},
|
||||
{
|
||||
"source": "/docs/troubleshooting/errors/:path((?:GRAPH_RECURSION_LIMIT|INVALID_CONCURRENT_GRAPH_UPDATE|INVALID_GRAPH_NODE_RETURN_VALUE|MULTIPLE_SUBGRAPHS)/?)*",
|
||||
"destination": "https://langchain-ai.github.io/langgraph/troubleshooting/errors/:path*"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -6,7 +6,7 @@ from langchain_core.prompts.prompt import PromptTemplate
|
||||
API_PLANNER_PROMPT = """You are a planner that plans a sequence of API calls to assist with user queries against an API.
|
||||
|
||||
You should:
|
||||
1) evaluate whether the user query can be solved by the API documentated below. If no, say why.
|
||||
1) evaluate whether the user query can be solved by the API documented below. If no, say why.
|
||||
2) if yes, generate a plan of API calls and say what they are doing step by step.
|
||||
3) If the plan includes a DELETE call, you should always return an ask from the User for authorization first unless the User has specifically asked to delete something.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -173,21 +173,23 @@ class GradientLLM(BaseLLM):
|
||||
"content-type": "application/json",
|
||||
},
|
||||
json=dict(
|
||||
samples=tuple(
|
||||
{
|
||||
"inputs": input,
|
||||
}
|
||||
for input in inputs
|
||||
)
|
||||
if multipliers is None
|
||||
else tuple(
|
||||
{
|
||||
"inputs": input,
|
||||
"fineTuningParameters": {
|
||||
"multiplier": multiplier,
|
||||
},
|
||||
}
|
||||
for input, multiplier in zip(inputs, multipliers)
|
||||
samples=(
|
||||
tuple(
|
||||
{
|
||||
"inputs": input,
|
||||
}
|
||||
for input in inputs
|
||||
)
|
||||
if multipliers is None
|
||||
else tuple(
|
||||
{
|
||||
"inputs": input,
|
||||
"fineTuningParameters": {
|
||||
"multiplier": multiplier,
|
||||
},
|
||||
}
|
||||
for input, multiplier in zip(inputs, multipliers)
|
||||
)
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -338,9 +340,11 @@ class GradientLLM(BaseLLM):
|
||||
) -> LLMResult:
|
||||
"""Run the LLM on the given prompt and input."""
|
||||
generations = []
|
||||
for generation in asyncio.gather(
|
||||
[self._acall(prompt, stop=stop, run_manager=run_manager, **kwargs)]
|
||||
for prompt in prompts
|
||||
for generation in await asyncio.gather(
|
||||
*[
|
||||
self._acall(prompt, stop=stop, run_manager=run_manager, **kwargs)
|
||||
for prompt in prompts
|
||||
]
|
||||
):
|
||||
generations.append([Generation(text=generation)])
|
||||
return LLMResult(generations=generations)
|
||||
|
||||
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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -116,7 +116,9 @@ class DallEAPIWrapper(BaseModel):
|
||||
|
||||
if is_openai_v1():
|
||||
client_params = {
|
||||
"api_key": self.openai_api_key,
|
||||
"api_key": self.openai_api_key.get_secret_value()
|
||||
if self.openai_api_key
|
||||
else None,
|
||||
"organization": self.openai_organization,
|
||||
"base_url": self.openai_api_base,
|
||||
"timeout": self.request_timeout,
|
||||
|
||||
@@ -64,7 +64,7 @@ class GoogleTrendsAPIWrapper(BaseModel):
|
||||
"q": query,
|
||||
}
|
||||
|
||||
total_results = []
|
||||
total_results: Any = []
|
||||
client = self.serp_search_engine(params)
|
||||
client_dict = client.get_dict()
|
||||
total_results = (
|
||||
|
||||
@@ -16,7 +16,7 @@ from typing import (
|
||||
)
|
||||
|
||||
import numpy as np
|
||||
from langchain_core._api import warn_deprecated
|
||||
from langchain_core._api import deprecated, warn_deprecated
|
||||
from langchain_core.documents import Document
|
||||
from langchain_core.embeddings import Embeddings
|
||||
from langchain_core.vectorstores import VST, VectorStore
|
||||
@@ -29,6 +29,11 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@deprecated(
|
||||
since="0.3.3",
|
||||
removal="1.0",
|
||||
alternative_import="langchain_databricks.DatabricksVectorSearch",
|
||||
)
|
||||
class DatabricksVectorSearch(VectorStore):
|
||||
"""`Databricks Vector Search` vector store.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user