forked from langchain-ai/langchain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
4,289 additions
and
13,210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,7 +123,9 @@ def new( | |
typer.echo(f" cd ./{app_name}\n") | ||
typer.echo("Then add templates with commands like:\n") | ||
typer.echo(" langchain app add extraction-openai-functions") | ||
typer.echo(" langchain app add git+ssh://[email protected]/efriis/simple-pirate.git\n\n") | ||
typer.echo( | ||
" langchain app add git+ssh://[email protected]/efriis/simple-pirate.git\n\n" | ||
) | ||
|
||
|
||
@app_cli.command() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.gritmodules* | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
version: 0.0.1 | ||
patterns: | ||
- name: github.com/getgrit/stdlib#* |
56 changes: 56 additions & 0 deletions
56
libs/cli/langchain_cli/namespaces/migrate/.grit/patterns/_test_replace_imports.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Testing the replace_imports migration | ||
|
||
This runs the v0.2 migration with a desired set of rules. | ||
|
||
```grit | ||
language python | ||
langchain_all_migrations() | ||
``` | ||
|
||
## Single import | ||
|
||
Before: | ||
|
||
```python | ||
from langchain.chat_models import ChatOpenAI | ||
``` | ||
|
||
After: | ||
|
||
```python | ||
from langchain_community.chat_models import ChatOpenAI | ||
``` | ||
|
||
## Community to partner | ||
|
||
```python | ||
from langchain_community.chat_models import ChatOpenAI | ||
``` | ||
|
||
```python | ||
from langchain_openai import ChatOpenAI | ||
``` | ||
|
||
## Noop | ||
|
||
This file should not match at all. | ||
|
||
```python | ||
from foo import ChatOpenAI | ||
``` | ||
|
||
## Mixed imports | ||
|
||
```python | ||
from langchain_community.chat_models import ChatOpenAI, ChatAnthropic, foo | ||
``` | ||
|
||
```python | ||
from langchain_community.chat_models import foo | ||
|
||
from langchain_openai import ChatOpenAI | ||
|
||
from langchain_anthropic import ChatAnthropic | ||
|
||
``` |
15 changes: 15 additions & 0 deletions
15
libs/cli/langchain_cli/namespaces/migrate/.grit/patterns/anthropic.grit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
language python | ||
|
||
// This migration is generated automatically - do not manually edit this file | ||
pattern langchain_migrate_anthropic() { | ||
find_replace_imports(list=[ | ||
[`langchain_community.chat_models.anthropic`, `ChatAnthropic`, `langchain_anthropic`, `ChatAnthropic`], | ||
[`langchain_community.llms.anthropic`, `Anthropic`, `langchain_anthropic`, `Anthropic`], | ||
[`langchain_community.chat_models`, `ChatAnthropic`, `langchain_anthropic`, `ChatAnthropic`], | ||
[`langchain_community.llms`, `Anthropic`, `langchain_anthropic`, `Anthropic`] | ||
]) | ||
} | ||
|
||
// Add this for invoking directly | ||
langchain_migrate_anthropic() |
67 changes: 67 additions & 0 deletions
67
libs/cli/langchain_cli/namespaces/migrate/.grit/patterns/astradb.grit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
|
||
language python | ||
|
||
// This migration is generated automatically - do not manually edit this file | ||
pattern langchain_migrate_astradb() { | ||
find_replace_imports(list=[ | ||
|
||
[ | ||
`langchain_community.vectorstores.astradb`, | ||
`AstraDB`, | ||
`langchain_astradb`, | ||
`AstraDBVectorStore` | ||
] | ||
, | ||
|
||
[ | ||
`langchain_community.storage.astradb`, | ||
`AstraDBByteStore`, | ||
`langchain_astradb`, | ||
`AstraDBByteStore` | ||
] | ||
, | ||
|
||
[ | ||
`langchain_community.storage.astradb`, | ||
`AstraDBStore`, | ||
`langchain_astradb`, | ||
`AstraDBStore` | ||
] | ||
, | ||
|
||
[ | ||
`langchain_community.cache`, | ||
`AstraDBCache`, | ||
`langchain_astradb`, | ||
`AstraDBCache` | ||
] | ||
, | ||
|
||
[ | ||
`langchain_community.cache`, | ||
`AstraDBSemanticCache`, | ||
`langchain_astradb`, | ||
`AstraDBSemanticCache` | ||
] | ||
, | ||
|
||
[ | ||
`langchain_community.chat_message_histories.astradb`, | ||
`AstraDBChatMessageHistory`, | ||
`langchain_astradb`, | ||
`AstraDBChatMessageHistory` | ||
] | ||
, | ||
|
||
[ | ||
`langchain_community.document_loaders.astradb`, | ||
`AstraDBLoader`, | ||
`langchain_astradb`, | ||
`AstraDBLoader` | ||
] | ||
|
||
]) | ||
} | ||
|
||
// Add this for invoking directly | ||
langchain_migrate_astradb() |
38 changes: 38 additions & 0 deletions
38
libs/cli/langchain_cli/namespaces/migrate/.grit/patterns/community_to_core.grit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
language python | ||
|
||
// This migration is generated automatically - do not manually edit this file | ||
pattern langchain_migrate_community_to_core() { | ||
find_replace_imports(list=[ | ||
[`langchain_community.callbacks.tracers`, `ConsoleCallbackHandler`, `langchain_core.tracers`, `ConsoleCallbackHandler`], | ||
[`langchain_community.callbacks.tracers`, `FunctionCallbackHandler`, `langchain_core.tracers.stdout`, `FunctionCallbackHandler`], | ||
[`langchain_community.callbacks.tracers`, `LangChainTracer`, `langchain_core.tracers`, `LangChainTracer`], | ||
[`langchain_community.callbacks.tracers`, `LangChainTracerV1`, `langchain_core.tracers.langchain_v1`, `LangChainTracerV1`], | ||
[`langchain_community.docstore.document`, `Document`, `langchain_core.documents`, `Document`], | ||
[`langchain_community.document_loaders`, `Blob`, `langchain_core.document_loaders`, `Blob`], | ||
[`langchain_community.document_loaders`, `BlobLoader`, `langchain_core.document_loaders`, `BlobLoader`], | ||
[`langchain_community.document_loaders.base`, `BaseBlobParser`, `langchain_core.document_loaders`, `BaseBlobParser`], | ||
[`langchain_community.document_loaders.base`, `BaseLoader`, `langchain_core.document_loaders`, `BaseLoader`], | ||
[`langchain_community.document_loaders.blob_loaders`, `Blob`, `langchain_core.document_loaders`, `Blob`], | ||
[`langchain_community.document_loaders.blob_loaders`, `BlobLoader`, `langchain_core.document_loaders`, `BlobLoader`], | ||
[`langchain_community.document_loaders.blob_loaders.schema`, `Blob`, `langchain_core.document_loaders`, `Blob`], | ||
[`langchain_community.document_loaders.blob_loaders.schema`, `BlobLoader`, `langchain_core.document_loaders`, `BlobLoader`], | ||
[`langchain_community.tools`, `BaseTool`, `langchain_core.tools`, `BaseTool`], | ||
[`langchain_community.tools`, `StructuredTool`, `langchain_core.tools`, `StructuredTool`], | ||
[`langchain_community.tools`, `Tool`, `langchain_core.tools`, `Tool`], | ||
[`langchain_community.tools`, `format_tool_to_openai_function`, `langchain_core.utils.function_calling`, `format_tool_to_openai_function`], | ||
[`langchain_community.tools`, `tool`, `langchain_core.tools`, `tool`], | ||
[`langchain_community.tools.convert_to_openai`, `format_tool_to_openai_function`, `langchain_core.utils.function_calling`, `format_tool_to_openai_function`], | ||
[`langchain_community.tools.convert_to_openai`, `format_tool_to_openai_tool`, `langchain_core.utils.function_calling`, `format_tool_to_openai_tool`], | ||
[`langchain_community.tools.render`, `format_tool_to_openai_function`, `langchain_core.utils.function_calling`, `format_tool_to_openai_function`], | ||
[`langchain_community.tools.render`, `format_tool_to_openai_tool`, `langchain_core.utils.function_calling`, `format_tool_to_openai_tool`], | ||
[`langchain_community.utils.openai_functions`, `FunctionDescription`, `langchain_core.utils.function_calling`, `FunctionDescription`], | ||
[`langchain_community.utils.openai_functions`, `ToolDescription`, `langchain_core.utils.function_calling`, `ToolDescription`], | ||
[`langchain_community.utils.openai_functions`, `convert_pydantic_to_openai_function`, `langchain_core.utils.function_calling`, `convert_pydantic_to_openai_function`], | ||
[`langchain_community.utils.openai_functions`, `convert_pydantic_to_openai_tool`, `langchain_core.utils.function_calling`, `convert_pydantic_to_openai_tool`], | ||
[`langchain_community.vectorstores`, `VectorStore`, `langchain_core.vectorstores`, `VectorStore`] | ||
]) | ||
} | ||
|
||
// Add this for invoking directly | ||
langchain_migrate_community_to_core() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
libs/cli/langchain_cli/namespaces/migrate/.grit/patterns/everything.grit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
language python | ||
|
||
pattern langchain_all_migrations() { | ||
any { | ||
langchain_migrate_community_to_core(), | ||
langchain_migrate_fireworks(), | ||
langchain_migrate_ibm(), | ||
langchain_migrate_langchain_to_core(), | ||
langchain_migrate_langchain_to_langchain_community(), | ||
langchain_migrate_langchain_to_textsplitters(), | ||
langchain_migrate_openai(), | ||
langchain_migrate_pinecone(), | ||
langchain_migrate_anthropic() | ||
} | ||
} | ||
|
||
langchain_all_migrations() |
15 changes: 15 additions & 0 deletions
15
libs/cli/langchain_cli/namespaces/migrate/.grit/patterns/fireworks.grit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
language python | ||
|
||
// This migration is generated automatically - do not manually edit this file | ||
pattern langchain_migrate_fireworks() { | ||
find_replace_imports(list=[ | ||
[`langchain_community.chat_models.fireworks`, `ChatFireworks`, `langchain_fireworks`, `ChatFireworks`], | ||
[`langchain_community.llms.fireworks`, `Fireworks`, `langchain_fireworks`, `Fireworks`], | ||
[`langchain_community.chat_models`, `ChatFireworks`, `langchain_fireworks`, `ChatFireworks`], | ||
[`langchain_community.llms`, `Fireworks`, `langchain_fireworks`, `Fireworks`] | ||
]) | ||
} | ||
|
||
// Add this for invoking directly | ||
langchain_migrate_fireworks() |
13 changes: 13 additions & 0 deletions
13
libs/cli/langchain_cli/namespaces/migrate/.grit/patterns/ibm.grit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
language python | ||
|
||
// This migration is generated automatically - do not manually edit this file | ||
pattern langchain_migrate_ibm() { | ||
find_replace_imports(list=[ | ||
[`langchain_community.llms.watsonxllm`, `WatsonxLLM`, `langchain_ibm`, `WatsonxLLM`], | ||
[`langchain_community.llms`, `WatsonxLLM`, `langchain_ibm`, `WatsonxLLM`] | ||
]) | ||
} | ||
|
||
// Add this for invoking directly | ||
langchain_migrate_ibm() |
Oops, something went wrong.