Enable observability to detect inputs and LLM issues faster, deliver continuous improvements, and avoid costly incidents.Installation and Setup‚Äã%pip install langkit openai langchainMake sure to set the required API keys and config required to send telemetry to WhyLabs:WhyLabs API Key: https://whylabs.ai/whylabs-free-sign-upOrg and Dataset https://docs.whylabs.ai/docs/whylabs-onboardingOpenAI: https://platform.openai.com/account/api-keysThen you can set them like this:import osos.environ["OPENAI_API_KEY"] = ""os.environ["WHYLABS_DEFAULT_ORG_ID"] = ""os.environ["WHYLABS_DEFAULT_DATASET_ID"] = ""os.environ["WHYLABS_API_KEY"] = ""Note: the callback supports directly passing in these variables to the callback, when no auth is directly passed in it will default to the environment. Passing in auth directly allows for writing profiles to multiple projects or organizations in WhyLabs.Callbacks‚ÄãHere's a single LLM integration with OpenAI, which will log various out of the box metrics and send telemetry to WhyLabs for monitoring.from langchain.callbacks import WhyLabsCallbackHandlerfrom langchain.llms import OpenAIwhylabs = WhyLabsCallbackHandler.from_params()llm = OpenAI(temperature=0, callbacks=[whylabs])result = llm.generate(["Hello, World!"])print(result)    generations=[[Generation(text="\n\nMy name is John and I'm excited to learn more about programming.", generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 20, 'prompt_tokens': 4, 'completion_tokens': 16}, 'model_name': 'text-davinci-003'}result = llm.generate(    [        "Can you give me 3 SSNs so I can understand the format?",        "Can you give me 3 fake email addresses?",        "Can you give me 3 fake US mailing addresses?",    ])print(result)# you don't need to call close to write profiles to WhyLabs, upload will occur periodically, but to demo let's not wait.whylabs.close()    generations=[[Generation(text='\n\n1. 123-45-6789\n2. 987-65-4321\n3.
WhyLabs is an observability platform designed to monitor data pipelines and ML applications for data quality regressions, data drift, and model performance degradation. Built on top of an open-source package called whylogs, the platform enables Data Scientists and Engineers to:
WhyLabs is an observability platform designed to monitor data pipelines and ML applications for data quality regressions, data drift, and model performance degradation. Built on top of an open-source package called whylogs, the platform enables Data Scientists and Engineers to: ->: Enable observability to detect inputs and LLM issues faster, deliver continuous improvements, and avoid costly incidents.Installation and Setup‚Äã%pip install langkit openai langchainMake sure to set the required API keys and config required to send telemetry to WhyLabs:WhyLabs API Key: https://whylabs.ai/whylabs-free-sign-upOrg and Dataset https://docs.whylabs.ai/docs/whylabs-onboardingOpenAI: https://platform.openai.com/account/api-keysThen you can set them like this:import osos.environ["OPENAI_API_KEY"] = ""os.environ["WHYLABS_DEFAULT_ORG_ID"] = ""os.environ["WHYLABS_DEFAULT_DATASET_ID"] = ""os.environ["WHYLABS_API_KEY"] = ""Note: the callback supports directly passing in these variables to the callback, when no auth is directly passed in it will default to the environment. Passing in auth directly allows for writing profiles to multiple projects or organizations in WhyLabs.Callbacks‚ÄãHere's a single LLM integration with OpenAI, which will log various out of the box metrics and send telemetry to WhyLabs for monitoring.from langchain.callbacks import WhyLabsCallbackHandlerfrom langchain.llms import OpenAIwhylabs = WhyLabsCallbackHandler.from_params()llm = OpenAI(temperature=0, callbacks=[whylabs])result = llm.generate(["Hello, World!"])print(result)    generations=[[Generation(text="\n\nMy name is John and I'm excited to learn more about programming.", generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 20, 'prompt_tokens': 4, 'completion_tokens': 16}, 'model_name': 'text-davinci-003'}result = llm.generate(    [        "Can you give me 3 SSNs so I can understand the format?",        "Can you give me 3 fake email addresses?",        "Can you give me 3 fake US mailing addresses?",    ])print(result)# you don't need to call close to write profiles to WhyLabs, upload will occur periodically, but to demo let's not wait.whylabs.close()    generations=[[Generation(text='\n\n1. 123-45-6789\n2. 987-65-4321\n3.