Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsMemoryCallbacksArgillaConfidentContextInfinoLabel StudioLLMonitorPromptLayerSageMaker TrackingStreamlitTrubricsChat loadersComponentsCallbacksSageMaker TrackingOn this pageSageMaker TrackingThis notebook shows how LangChain Callback can be used to log and track prompts and other LLM hyperparameters into SageMaker Experiments. Here, we use different scenarios to showcase the capability:Scenario 1: Single LLM - A case where a single LLM model is used to generate output based on a given prompt.Scenario 2: Sequential Chain - A case where a sequential chain of two LLM models is used.Scenario 3: Agent with Tools (Chain of Thought) - A case where multiple tools (search and math) are used in addition to an LLM.Amazon SageMaker is a fully managed service that is used to quickly and easily build, train and deploy machine learning (ML) models. Amazon SageMaker Experiments is a capability of Amazon SageMaker that lets you organize, track, compare and evaluate ML experiments and model versions.In this notebook, we will create a single experiment to log the prompts from each scenario.Installation and Setup‚Äãpip install sagemakerpip install openaipip install google-search-resultsFirst, setup the required API keysOpenAI: https://platform.openai.com/account/api-keys (For OpenAI LLM model)Google SERP API: https://serpapi.com/manage-api-key (For Google Search Tool)import os## Add your API keys belowos.environ["OPENAI_API_KEY"] = "<ADD-KEY-HERE>"os.environ["SERPAPI_API_KEY"] = "<ADD-KEY-HERE>"from langchain.llms import OpenAIfrom langchain.prompts import PromptTemplatefrom langchain.chains import LLMChain, SimpleSequentialChainfrom langchain.agents import initialize_agent, load_toolsfrom
This notebook shows how LangChain Callback can be used to log and track prompts and other LLM hyperparameters into SageMaker Experiments. Here, we use different scenarios to showcase the capability:
This notebook shows how LangChain Callback can be used to log and track prompts and other LLM hyperparameters into SageMaker Experiments. Here, we use different scenarios to showcase the capability: ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsMemoryCallbacksArgillaConfidentContextInfinoLabel StudioLLMonitorPromptLayerSageMaker TrackingStreamlitTrubricsChat loadersComponentsCallbacksSageMaker TrackingOn this pageSageMaker TrackingThis notebook shows how LangChain Callback can be used to log and track prompts and other LLM hyperparameters into SageMaker Experiments. Here, we use different scenarios to showcase the capability:Scenario 1: Single LLM - A case where a single LLM model is used to generate output based on a given prompt.Scenario 2: Sequential Chain - A case where a sequential chain of two LLM models is used.Scenario 3: Agent with Tools (Chain of Thought) - A case where multiple tools (search and math) are used in addition to an LLM.Amazon SageMaker is a fully managed service that is used to quickly and easily build, train and deploy machine learning (ML) models. Amazon SageMaker Experiments is a capability of Amazon SageMaker that lets you organize, track, compare and evaluate ML experiments and model versions.In this notebook, we will create a single experiment to log the prompts from each scenario.Installation and Setup‚Äãpip install sagemakerpip install openaipip install google-search-resultsFirst, setup the required API keysOpenAI: https://platform.openai.com/account/api-keys (For OpenAI LLM model)Google SERP API: https://serpapi.com/manage-api-key (For Google Search Tool)import os## Add your API keys belowos.environ["OPENAI_API_KEY"] = "<ADD-KEY-HERE>"os.environ["SERPAPI_API_KEY"] = "<ADD-KEY-HERE>"from langchain.llms import OpenAIfrom langchain.prompts import PromptTemplatefrom langchain.chains import LLMChain, SimpleSequentialChainfrom langchain.agents import initialize_agent, load_toolsfrom