Skip to content

Commit

Permalink
docs: standardize azure openai page (#23642)
Browse files Browse the repository at this point in the history
part of #22296
  • Loading branch information
baskaryan committed Jun 28, 2024
1 parent e8d7700 commit 381aedc
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 80 deletions.
266 changes: 198 additions & 68 deletions docs/docs/integrations/chat/azure_chat_openai.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/docs/integrations/chat/openai.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.1"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions libs/cli/langchain_cli/integration_template/docs/chat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"\n",
"- TODO: Make sure API reference link is correct.\n",
"\n",
"This notebook provides a quick overview for getting started with __ModuleName__ [chat models](/docs/concepts/#chat-models). For detailed documentation of all Chat__ModuleName__ features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/chat_models/__module_name__.chat_models.Chat__ModuleName__.html).\n",
"This will help you getting started with __ModuleName__ [chat models](/docs/concepts/#chat-models). For detailed documentation of all Chat__ModuleName__ features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/chat_models/__module_name__.chat_models.Chat__ModuleName__.html).\n",
"\n",
"- TODO: Add any other relevant links, like information about models, prices, context windows, etc. See https://python.langchain.com/v0.2/docs/integrations/chat/openai/ for an example.\n",
"\n",
Expand Down Expand Up @@ -253,7 +253,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.1"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class __ModuleName__Loader(BaseLoader):
# https://github.com/langchain-ai/langchain/blob/869523ad728e6b76d77f170cce13925b4ebc3c1e/libs/community/langchain_community/document_loaders/recursive_url_loader.py#L54
"""
__ModuleName__ document loader integration
# TODO: Replace with relevant packages, env vars.
Setup:
Install ``__package_name__`` and set environment variable ``__MODULE_NAME___API_KEY``.
Expand Down Expand Up @@ -48,7 +48,7 @@ class __ModuleName__Loader(BaseLoader):
.. code-block:: python
TODO: Example output
TODO: Example output
# TODO: Delete if async load is not implemented
Async load:
Expand All @@ -67,6 +67,6 @@ class __ModuleName__Loader(BaseLoader):
# Do not implement load(), a default implementation is already available.
def lazy_load(self) -> Iterator[Document]:
raise NotImplementedError()

# TODO: Implement if you would like to change default BaseLoader implementation
# async def alazy_load(self) -> AsyncIterator[Document]:
# async def alazy_load(self) -> AsyncIterator[Document]:
13 changes: 10 additions & 3 deletions libs/cli/langchain_cli/namespaces/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ def create_doc(
component_type: Annotated[
str,
typer.Option(
help=("The type of component. Currently only 'ChatModel', 'DocumentLoader' supported."),
help=(
"The type of component. Currently only 'ChatModel', 'DocumentLoader' supported."
),
),
] = "ChatModel",
destination_dir: Annotated[
Expand Down Expand Up @@ -197,9 +199,14 @@ def create_doc(

# copy over template from ../integration_template
if component_type == "ChatModel":
docs_template = Path(__file__).parents[1] / "integration_template/docs/chat.ipynb"
docs_template = (
Path(__file__).parents[1] / "integration_template/docs/chat.ipynb"
)
elif component_type == "DocumentLoader":
docs_template = Path(__file__).parents[1] / "integration_template/docs/document_loaders.ipynb"
docs_template = (
Path(__file__).parents[1]
/ "integration_template/docs/document_loaders.ipynb"
)
shutil.copy(docs_template, destination_path)

# replacements in file
Expand Down
4 changes: 3 additions & 1 deletion libs/community/langchain_community/callbacks/openai_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@
"gpt-3.5-turbo-16k-0613-completion": 0.004,
# Azure GPT-35 input
"gpt-35-turbo": 0.0015, # Azure OpenAI version of ChatGPT
"gpt-35-turbo-0301": 0.0015, # Azure OpenAI version of ChatGPT
"gpt-35-turbo-0125": 0.0005,
"gpt-35-turbo-0301": 0.002, # Azure OpenAI version of ChatGPT
"gpt-35-turbo-0613": 0.0015,
"gpt-35-turbo-instruct": 0.0015,
"gpt-35-turbo-16k": 0.003,
"gpt-35-turbo-16k-0613": 0.003,
# Azure GPT-35 output
"gpt-35-turbo-completion": 0.002, # Azure OpenAI version of ChatGPT
"gpt-35-turbo-0125-completion": 0.0015,
"gpt-35-turbo-0301-completion": 0.002, # Azure OpenAI version of ChatGPT
"gpt-35-turbo-0613-completion": 0.002,
"gpt-35-turbo-instruct-completion": 0.002,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_on_llm_end_finetuned_model(
"model_name,expected_cost",
[
("gpt-35-turbo", 0.0035),
("gpt-35-turbo-0301", 0.0035),
("gpt-35-turbo-0301", 0.004),
(
"gpt-35-turbo-0613",
0.0035,
Expand Down

0 comments on commit 381aedc

Please sign in to comment.