Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsChat modelsAnthropicAnthropic FunctionsAnyscaleAzureAzureML Chat Online EndpointBaichuan ChatBaidu QianfanBedrock ChatCohereERNIE-Bot ChatEverlyAIFireworksGCP Vertex AIJinaChatKonkoüöÖ LiteLLMLlama APIMiniMaxOllamaOpenAIPromptLayer ChatOpenAITongyi QwenvLLM ChatYandexGPTDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsMemoryCallbacksChat loadersComponentsChat modelsAnyscaleAnyscaleThis notebook demonstrates the use of langchain.chat_models.ChatAnyscale for Anyscale Endpoints.Set ANYSCALE_API_KEY environment variableor use the anyscale_api_key keyword argument# !pip install openaiimport osfrom getpass import getpassos.environ["ANYSCALE_API_KEY"] = getpass()     ¬∑¬∑¬∑¬∑¬∑¬∑¬∑¬∑Let's try out each model offered on Anyscale Endpointsfrom langchain.chat_models import ChatAnyscalechats = {    model: ChatAnyscale(model_name=model, temperature=1.0)    for model in ChatAnyscale.get_available_models()}print(chats.keys())    dict_keys(['meta-llama/Llama-2-70b-chat-hf', 'meta-llama/Llama-2-7b-chat-hf', 'meta-llama/Llama-2-13b-chat-hf'])We can use async methods and other stuff supported by ChatOpenAIThis way, the three requests will only take as long as the longest individual request.import asynciofrom langchain.schema import SystemMessage, HumanMessagemessages = [    SystemMessage(        content="You are a helpful AI that shares everything you know."    ),    HumanMessage(        content="Tell me technical facts about yourself. Are you a transformer model? How many billions of parameters do you have?"    ),]async def get_msgs():    tasks = [        chat.apredict_messages(messages)        for chat in chats.values()    ]    responses = await asyncio.gather(*tasks)    return dict(zip(chats.keys(), responses))import
This notebook demonstrates the use of langchain.chat_models.ChatAnyscale for Anyscale Endpoints.
This notebook demonstrates the use of langchain.chat_models.ChatAnyscale for Anyscale Endpoints. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsChat modelsAnthropicAnthropic FunctionsAnyscaleAzureAzureML Chat Online EndpointBaichuan ChatBaidu QianfanBedrock ChatCohereERNIE-Bot ChatEverlyAIFireworksGCP Vertex AIJinaChatKonkoüöÖ LiteLLMLlama APIMiniMaxOllamaOpenAIPromptLayer ChatOpenAITongyi QwenvLLM ChatYandexGPTDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsMemoryCallbacksChat loadersComponentsChat modelsAnyscaleAnyscaleThis notebook demonstrates the use of langchain.chat_models.ChatAnyscale for Anyscale Endpoints.Set ANYSCALE_API_KEY environment variableor use the anyscale_api_key keyword argument# !pip install openaiimport osfrom getpass import getpassos.environ["ANYSCALE_API_KEY"] = getpass()     ¬∑¬∑¬∑¬∑¬∑¬∑¬∑¬∑Let's try out each model offered on Anyscale Endpointsfrom langchain.chat_models import ChatAnyscalechats = {    model: ChatAnyscale(model_name=model, temperature=1.0)    for model in ChatAnyscale.get_available_models()}print(chats.keys())    dict_keys(['meta-llama/Llama-2-70b-chat-hf', 'meta-llama/Llama-2-7b-chat-hf', 'meta-llama/Llama-2-13b-chat-hf'])We can use async methods and other stuff supported by ChatOpenAIThis way, the three requests will only take as long as the longest individual request.import asynciofrom langchain.schema import SystemMessage, HumanMessagemessages = [    SystemMessage(        content="You are a helpful AI that shares everything you know."    ),    HumanMessage(        content="Tell me technical facts about yourself. Are you a transformer model? How many billions of parameters do you have?"    ),]async def get_msgs():    tasks = [        chat.apredict_messages(messages)        for chat in chats.values()    ]    responses = await asyncio.gather(*tasks)    return dict(zip(chats.keys(), responses))import