Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan authored Mar 25, 2024
2 parents 1b780ac + dac2e01 commit 0006606
Show file tree
Hide file tree
Showing 60 changed files with 3,108 additions and 127 deletions.
1 change: 1 addition & 0 deletions .github/workflows/_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for airbyte
MONGODB_ATLAS_URI: ${{ secrets.MONGODB_ATLAS_URI }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
run: |
make integration_tests
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for airbyte
MONGODB_ATLAS_URI: ${{ secrets.MONGODB_ATLAS_URI }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
run: make integration_tests
working-directory: ${{ inputs.working-directory }}

Expand Down
10 changes: 5 additions & 5 deletions docs/docs/guides/local_llms.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"from langchain_community.llms import Ollama\n",
"\n",
"llm = Ollama(model=\"llama2\")\n",
"llm(\"The first man on the moon was ...\")"
"llm.invoke(\"The first man on the moon was ...\")"
]
},
{
Expand Down Expand Up @@ -140,7 +140,7 @@
"llm = Ollama(\n",
" model=\"llama2\", callback_manager=CallbackManager([StreamingStdOutCallbackHandler()])\n",
")\n",
"llm(\"The first man on the moon was ...\")"
"llm.invoke(\"The first man on the moon was ...\")"
]
},
{
Expand Down Expand Up @@ -226,7 +226,7 @@
"from langchain_community.llms import Ollama\n",
"\n",
"llm = Ollama(model=\"llama2:13b\")\n",
"llm(\"The first man on the moon was ... think step by step\")"
"llm.invoke(\"The first man on the moon was ... think step by step\")"
]
},
{
Expand Down Expand Up @@ -369,7 +369,7 @@
}
],
"source": [
"llm(\"The first man on the moon was ... Let's think step by step\")"
"llm.invoke(\"The first man on the moon was ... Let's think step by step\")"
]
},
{
Expand Down Expand Up @@ -426,7 +426,7 @@
}
],
"source": [
"llm(\"The first man on the moon was ... Let's think step by step\")"
"llm.invoke(\"The first man on the moon was ... Let's think step by step\")"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/integrations/chat/cohere.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"The integration lives in the `langchain-community` package. We also need to install the `cohere` package itself. We can install these with:\n",
"\n",
"```bash\n",
"pip install -U langchain-community cohere\n",
"pip install -U langchain-community langchain-cohere\n",
"```\n",
"\n",
"We'll also need to get a [Cohere API key](https://cohere.com/) and set the `COHERE_API_KEY` environment variable:"
Expand Down Expand Up @@ -89,7 +89,7 @@
},
"outputs": [],
"source": [
"from langchain_community.chat_models import ChatCohere\n",
"from langchain_cohere import ChatCohere\n",
"from langchain_core.messages import HumanMessage"
]
},
Expand Down
24 changes: 14 additions & 10 deletions docs/docs/integrations/chat/gigachat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": true,
"pycharm": {
"is_executing": true
}
},
"outputs": [],
"source": [
Expand All @@ -28,13 +31,14 @@
"collapsed": false
},
"source": [
"To get GigaChat credentials you need to [create account](https://developers.sber.ru/studio/login) and [get access to API](https://developers.sber.ru/docs/ru/gigachat/api/integration)\n",
"To get GigaChat credentials you need to [create account](https://developers.sber.ru/studio/login) and [get access to API](https://developers.sber.ru/docs/ru/gigachat/individuals-quickstart)\n",
"\n",
"## Example"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 2,
"metadata": {
"collapsed": false
},
Expand All @@ -48,20 +52,20 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from langchain_community.chat_models import GigaChat\n",
"\n",
"chat = GigaChat(verify_ssl_certs=False)"
"chat = GigaChat(verify_ssl_certs=False, scope=\"GIGACHAT_API_PERS\")"
]
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 8,
"metadata": {
"collapsed": false
},
Expand All @@ -70,7 +74,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"What do you get when you cross a goat and a skunk? A smelly goat!\n"
"The capital of Russia is Moscow.\n"
]
}
],
Expand All @@ -81,10 +85,10 @@
" SystemMessage(\n",
" content=\"You are a helpful AI that shares everything you know. Talk in English.\"\n",
" ),\n",
" HumanMessage(content=\"Tell me a joke\"),\n",
" HumanMessage(content=\"What is capital of Russia?\"),\n",
"]\n",
"\n",
"print(chat(messages).content)"
"print(chat.invoke(messages).content)"
]
}
],
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/integrations/llms/cohere.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"The integration lives in the `langchain-community` package. We also need to install the `cohere` package itself. We can install these with:\n",
"\n",
"```bash\n",
"pip install -U langchain-community cohere\n",
"pip install -U langchain-community langchain-cohere\n",
"```\n",
"\n",
"We'll also need to get a [Cohere API key](https://cohere.com/) and set the `COHERE_API_KEY` environment variable:"
Expand All @@ -39,7 +39,7 @@
},
"outputs": [
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
" ········\n"
Expand Down Expand Up @@ -91,7 +91,7 @@
},
"outputs": [],
"source": [
"from langchain_community.llms import Cohere\n",
"from langchain_cohere import Cohere\n",
"from langchain_core.messages import HumanMessage"
]
},
Expand Down Expand Up @@ -255,7 +255,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.1"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
20 changes: 12 additions & 8 deletions docs/docs/integrations/llms/gigachat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": true,
"pycharm": {
"is_executing": true
}
},
"outputs": [],
"source": [
Expand All @@ -28,13 +31,14 @@
"collapsed": false
},
"source": [
"To get GigaChat credentials you need to [create account](https://developers.sber.ru/studio/login) and [get access to API](https://developers.sber.ru/docs/ru/gigachat/api/integration)\n",
"To get GigaChat credentials you need to [create account](https://developers.sber.ru/studio/login) and [get access to API](https://developers.sber.ru/docs/ru/gigachat/individuals-quickstart)\n",
"\n",
"## Example"
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {
"collapsed": false
},
Expand All @@ -48,20 +52,20 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from langchain_community.llms import GigaChat\n",
"\n",
"llm = GigaChat(verify_ssl_certs=False)"
"llm = GigaChat(verify_ssl_certs=False, scope=\"GIGACHAT_API_PERS\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 9,
"metadata": {
"collapsed": false
},
Expand All @@ -84,8 +88,8 @@
"\n",
"llm_chain = LLMChain(prompt=prompt, llm=llm)\n",
"\n",
"generated = llm_chain.run(country=\"Russia\")\n",
"print(generated)"
"generated = llm_chain.invoke(input={\"country\": \"Russia\"})\n",
"print(generated[\"text\"])"
]
}
],
Expand Down
8 changes: 8 additions & 0 deletions docs/docs/integrations/providers/salute_devices.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@ See a [usage example](/docs/integrations/chat/gigachat).

```python
from langchain_community.chat_models import GigaChat
```

## Embeddings

See a [usage example](/docs/integrations/text_embedding/gigachat).

```python
from langchain_community.embeddings import GigaChatEmbeddings
```
2 changes: 1 addition & 1 deletion docs/docs/integrations/retrievers/cohere.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"outputs": [],
"source": [
"from langchain_community.chat_models import ChatCohere\n",
"from langchain_cohere import ChatCohere\n",
"from langchain_community.retrievers import CohereRagRetriever\n",
"from langchain_core.documents import Document"
]
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/integrations/text_embedding/cohere.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain_community.embeddings import CohereEmbeddings"
"from langchain_cohere import CohereEmbeddings"
]
},
{
Expand Down
Loading

0 comments on commit 0006606

Please sign in to comment.