id
stringlengths
14
16
text
stringlengths
45
2.05k
source
stringlengths
53
111
e2ed6b9e33d4-1
data = loader.load() data [Document(page_content="# Banana Teardown\nIn this teardown, we open a banana to see what's inside. Yellow and delicious, but most importantly, yellow.\n\n\n###Tools Required:\n\n - Fingers\n\n - Teeth\n\n - Thumbs\n\n\n###Parts Required:\n\n - None\n\n\n## Step 1\nTake one banana from the bu...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-2
[Document(page_content='# My iPhone 6 is typing and opening apps by itself\nmy iphone 6 is typing and opening apps by itself. How do i fix this. I just bought it last week.\nI restored as manufactures cleaned up the screen\nthe problem continues\n\n## 27 Answers\n\nFilter by: \n\nMost Helpful\nNewest\nOldest\n\n### Acc...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-3
same issues, screen freezing, opening apps by itself, selecting the screens and typing on it\'s own. I first suspected aliens and then ghosts and then hackers.\niPhone 6 is weak physically and tend to bend on pressure. And my phone had no case or cover.\nI took the phone to apple stores and they said sensors need to be...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-4
to iTunes and reset your phone completely. (please take a back-up first).\nAnd your phone should be good to use again.\nWhat really happened here for me is that the sensors might have stuck to the screen and with mild twisting, they got disengaged/released.\nI posted this in Apple Community and the moderators deleted i...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-5
to local area iphone repairing lab, and they detected that it is an LCD issue. LCD get out of order without any reason (It was neither hit or nor slipped, but LCD get out of order all and sudden, while using it) it started opening things at random. I get LCD replaced with new one, that cost me $80.00 in total ($70.00 ...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-6
took it off I noticed that there was a lot of dust and dirt around the areas that the case didn\'t cover. I shined a light in my ports and noticed they were filled with dust. Tomorrow I plan on using pressurized air to clean it out and the problem should be solved. If you plug in your phone and unplug it and it stops ...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-7
I have my original charger. I am going to clean it and try everyone’s advice. It really sucks! I had 40,000,000 on my heart of Vegas slots! I play every day. I would be spinning and my fingers were no where max buttons and it would light up and switch to max. It did it 3 times before I caught it light up by its s...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-8
that it\'s most likely a hardware problem--which the "genius" probably knows too.\nI\'m getting ready to go Android.\n\n\n\n### Other Answer\nI experienced similar ghost touches. Two weeks ago, I changed my iPhone 6 Plus shell (I had forced the phone into it because it’s pretty tight), and also put a new glass screen ...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-9
solved.\n\n\n\n### Other Answer\nthank you so much for this post! i was struggling doing the reset because i cannot type userids and passwords correctly because the iphone 6 plus i have kept on typing letters incorrectly. I have been doing it for a day until i come across this article. Very helpful! God bless you!!\n\n...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-10
up and fix your phone for free! You pay a lot for a Apple they should back it. I did the next 30 month payments and finally have it paid off in June. My iPad sept. Looking forward to a almost 100 drop in my phone bill! Now this crap!!! Really\n\n\n\n### Other Answer\nIf your phone is JailBroken, suggest downloadin...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-11
below. I took it off and it stopped. I ordered more protectors from amazon and replaced it\n\n\n\n### Other Answer\niPhone 6 Plus first generation….I had the same issues as all above, apps opening by themselves, self typing, ultra sensitive screen, items jumping around all over….it even called someone on FaceTime twice...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-12
laptop that was plugged in to the same wall plug as my phone charger with the dollar store block plug….until I changed the block plug.\n\n\n\n### Other Answer\nHad the problem: Inherited a 6s Plus from my wife. She had no problem with it.\nLooks like it was merely the cheap phone case I purchased on Amazon. It was eith...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-13
come back to needing the original iPhone cable…or at least another 1 that would have come with another iPhone…not the $5 Store fast charging cables. My original cable is pretty beat up - like most that I see - but I’ve been beaten up much MUCH less by sticking with its use! I didn’t find that the casing/shell around ...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-14
way to get rid of my password and all of a sudden my phone wants to touch stuff on its own which got my phone disabled many times to the point where I have to wait a whole hour and I really need to finish something on my phone today PLEASE HELPPPP\n\n\n\n### Other Answer\nIn my case , iphone 6 screen was faulty. I got ...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-15
in LCD connector on the motherboard, specially if you lock/unlock screen and screen works again for sometime. lcd connectors gets disconnected lightly from the motherboard due to multiple falls and hits after sometime. best of luck for all\n\n\n\n### Other Answer\nI am facing the same issue whereby these ghost touches ...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-16
all my images and videos to my PC and restarted the phone - problem solved. Been working now for two days.', lookup_str='', metadata={'source': 'https://www.ifixit.com/Answers/View/318583/My+iPhone+6+is+typing+and+opening+apps+by+itself', 'title': 'My iPhone 6 is typing and opening apps by itself'}, lookup_index=0)]
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-17
loader = IFixitLoader("https://www.ifixit.com/Device/Standard_iPad") data = loader.load() data [Document(page_content="Standard iPad\nThe standard edition of the tablet computer made by Apple.\n== Background Information ==\n\nOriginally introduced in January 2010, the iPad is Apple's standard edition of their tablet co...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-18
data = IFixitLoader.load_suggestions("Banana") data [Document(page_content='Banana\nTasty fruit. Good source of potassium. Yellow.\n== Background Information ==\n\nCommonly misspelled, this wildly popular, phone shaped fruit serves as nutrition and an obstacle to slow down vehicles racing close behind you. Also used co...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
e2ed6b9e33d4-19
Document(page_content="# Banana Teardown\nIn this teardown, we open a banana to see what's inside. Yellow and delicious, but most importantly, yellow.\n\n\n###Tools Required:\n\n - Fingers\n\n - Teeth\n\n - Thumbs\n\n\n###Parts Required:\n\n - None\n\n\n## Step 1\nTake one banana from the bunch.\nDon't squeeze too har...
https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/ifixit.html
409c08f6eb27-0
.ipynb .pdf Async API for LLM Async API for LLM# LangChain provides async support for LLMs by leveraging the asyncio library. Async support is particularly useful for calling multiple LLMs concurrently, as these calls are network-bound. Currently, only OpenAI and PromptLayerOpenAI are supported, but async support for o...
https://langchain.readthedocs.io/en/latest/modules/llms/async_llm.html
409c08f6eb27-1
I'm doing well, thank you. How about you? I'm doing well, thank you. How about you? I'm doing well, how about you? I'm doing well, thank you. How about you? I'm doing well, thank you. How about you? I'm doing well, thank you. How about yourself? I'm doing well, thank you! How about you? I'm doing well, thank you. How a...
https://langchain.readthedocs.io/en/latest/modules/llms/async_llm.html
8885a2a093f2-0
.md .pdf Key Concepts Contents LLMs Generation LLMResult Key Concepts# LLMs# Wrappers around Large Language Models (in particular, the “generate” ability of large language models) are at the core of LangChain functionality. The core method that these classes expose is a generate method, which takes in a list of strin...
https://langchain.readthedocs.io/en/latest/modules/llms/key_concepts.html
c0399b4503ef-0
.rst .pdf How-To Guides How-To Guides# The examples here all address certain “how-to” guides for working with LLMs. They are split into two categories: Generic Functionality: Covering generic functionality all LLMs should have. Integrations: Covering integrations with various LLM providers. Asynchronous: Covering async...
https://langchain.readthedocs.io/en/latest/modules/llms/how_to_guides.html
35eede938cb9-0
.ipynb .pdf Getting Started Getting Started# This notebook goes over how to use the LLM class in LangChain. The LLM class is a class designed for interfacing with LLMs. There are lots of LLM providers (OpenAI, Cohere, Hugging Face, etc) - this class is designed to provide a standard interface for all of them. In this p...
https://langchain.readthedocs.io/en/latest/modules/llms/getting_started.html
35eede938cb9-1
llm_result.generations[-1] [Generation(text="\n\nWhat if love neverspeech\n\nWhat if love never ended\n\nWhat if love was only a feeling\n\nI'll never know this love\n\nIt's not a feeling\n\nBut it's what we have for each other\n\nWe just know that love is something strong\n\nAnd we can't help but be happy\n\nWe just f...
https://langchain.readthedocs.io/en/latest/modules/llms/getting_started.html
8b1357755a01-0
.rst .pdf Generic Functionality Generic Functionality# The examples here all address certain “how-to” guides for working with LLMs. LLM Serialization: A walkthrough of how to serialize LLMs to and from disk. LLM Caching: Covers different types of caches, and how to use a cache to save results of LLM calls. Custom LLM: ...
https://langchain.readthedocs.io/en/latest/modules/llms/generic_how_to.html
14e91458cced-0
.ipynb .pdf Streaming with LLMs Streaming with LLMs# LangChain provides streaming support for LLMs. Currently, we only support streaming for the OpenAI and ChatOpenAI LLM implementation, but streaming support for other LLM implementations is on the roadmap. To utilize streaming, use a CallbackHandler that implements on...
https://langchain.readthedocs.io/en/latest/modules/llms/streaming_llm.html
14e91458cced-1
On a hot summer night. Chorus Sparkling water, sparkling water, It's the best way to stay hydrated, It's so crisp and so clean, It's the perfect way to stay refreshed. We still have access to the end LLMResult if using generate. However, token_usage is not currently supported for streaming. llm.generate(["Tell me a jok...
https://langchain.readthedocs.io/en/latest/modules/llms/streaming_llm.html
14e91458cced-2
Sparkling water, you're the key To a healthy life, a happy soul A drink that makes me feel whole Chorus: Sparkling water, oh so fine A drink that's always on my mind With every sip, I feel alive Sparkling water, you're my vibe Outro: Sparkling water, you're the one A drink that's always so much fun I'll never let you g...
https://langchain.readthedocs.io/en/latest/modules/llms/streaming_llm.html
aaff3357a0db-0
.rst .pdf Integrations Integrations# The examples here are all “how-to” guides for how to integrate with various LLM providers. OpenAI: Covers how to connect to OpenAI models. Cohere: Covers how to connect to Cohere models. AI21: Covers how to connect to AI21 models. Huggingface Hub: Covers how to connect to LLMs hoste...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations.html
8d7573659681-0
.ipynb .pdf Hugging Face Hub Hugging Face Hub# This example showcases how to connect to the Hugging Face Hub. from langchain import PromptTemplate, HuggingFaceHub, LLMChain template = """Question: {question} Answer: Let's think step by step.""" prompt = PromptTemplate(template=template, input_variables=["question"]) ll...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/huggingface_hub.html
4f71c02f7769-0
.ipynb .pdf Writer Writer# This example goes over how to use LangChain to interact with Writer models from langchain.llms import Writer from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think step by step.""" prompt = PromptTemplate(template=template, input_variables=["ques...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/writer.html
6b4bb94fe35e-0
.ipynb .pdf Manifest Contents Compare HF Models Manifest# This notebook goes over how to use Manifest and LangChain. For more detailed information on manifest, and how to use it with local hugginface models like in this example, see https://github.com/HazyResearch/manifest from manifest import Manifest from langchain...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/manifest.html
6b4bb94fe35e-1
state_of_the_union = f.read() mp_chain.run(state_of_the_union) 'President Obama delivered his annual State of the Union address on Tuesday night, laying out his priorities for the coming year. Obama said the government will provide free flu vaccines to all Americans, ending the government shutdown and allowing business...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/manifest.html
6b4bb94fe35e-2
) manifest3 = ManifestWrapper( client=Manifest( client_name="huggingface", client_connection="http://127.0.0.1:5002" ), llm_kwargs={"temperature": 0.01} ) llms = [manifest1, manifest2, manifest3] model_lab = ModelLaboratory(llms) model_lab.compare("What color is a flamingo?") Input: What col...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/manifest.html
a9a71ee2d736-0
.ipynb .pdf ForefrontAI LLM Example Contents Imports Set the Environment API Key Create the ForefrontAI instance Create a Prompt Template Initiate the LLMChain Run the LLMChain ForefrontAI LLM Example# This notebook goes over how to use Langchain with ForefrontAI. Imports# import os from langchain.llms import Forefro...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/forefrontai_example.html
a9a71ee2d736-1
By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Mar 22, 2023.
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/forefrontai_example.html
b09503d79905-0
.ipynb .pdf GooseAI LLM Example Contents Install openai Imports Set the Environment API Key Create the GooseAI instance Create a Prompt Template Initiate the LLMChain Run the LLMChain GooseAI LLM Example# This notebook goes over how to use Langchain with GooseAI. Install openai# The openai package is required to use ...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/gooseai_example.html
b09503d79905-1
Initiate the LLMChain Run the LLMChain By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Mar 22, 2023.
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/gooseai_example.html
1c881bd9463b-0
.ipynb .pdf StochasticAI StochasticAI# This example goes over how to use LangChain to interact with StochasticAI models from langchain.llms import StochasticAI from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think step by step.""" prompt = PromptTemplate(template=template...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/stochasticai.html
e29cda58bb51-0
.ipynb .pdf Cohere Cohere# This example goes over how to use LangChain to interact with Cohere models from langchain.llms import Cohere from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think step by step.""" prompt = PromptTemplate(template=template, input_variables=["ques...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/cohere.html
e29cda58bb51-1
llm_chain.run(question) " Let's start with the year that Justin Beiber was born. You know that he was born in 1994. We have to go back one year. 1993.\n\n1993 was the year that the Dallas Cowboys won the Super Bowl. They won over the Buffalo Bills in Super Bowl 26.\n\nNow, let's do it backwards. According to our inform...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/cohere.html
c4de5e51a139-0
.ipynb .pdf Aleph Alpha Aleph Alpha# This example goes over how to use LangChain to interact with Aleph Alpha models from langchain.llms import AlephAlpha from langchain import PromptTemplate, LLMChain template = """Q: {question} A:""" prompt = PromptTemplate(template=template, input_variables=["question"]) llm = Aleph...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/aleph_alpha.html
28849d9aff7d-0
.ipynb .pdf Self-Hosted Models via Runhouse Self-Hosted Models via Runhouse# This example goes over how to use LangChain and Runhouse to interact with models hosted on your own GPU, or on-demand GPUs on AWS, GCP, AWS, or Lambda. For more information, see Runhouse or the Runhouse docs. from langchain.llms import SelfHos...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/self_hosted_examples.html
28849d9aff7d-1
INFO | 2023-02-17 05:42:24,016 | Time to send message: 0.48 seconds "\n\nLet's say we're talking sports teams who won the Super Bowl in the year Justin Beiber" You can also load more custom models through the SelfHostedHuggingFaceLLM interface: llm = SelfHostedHuggingFaceLLM( model_id="google/flan-t5-small", ta...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/self_hosted_examples.html
28849d9aff7d-2
INFO | 2023-02-17 05:42:59,522 | Time to send message: 0.3 seconds 'john w. bush' You can send your pipeline directly over the wire to your model, but this will only work for small models (<2 Gb), and will be pretty slow: pipeline = load_pipeline() llm = SelfHostedPipeline.from_pipeline( pipeline=pipeline, hardware...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/self_hosted_examples.html
8e02ba5e179c-0
.ipynb .pdf AI21 AI21# This example goes over how to use LangChain to interact with AI21 models from langchain.llms import AI21 from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think step by step.""" prompt = PromptTemplate(template=template, input_variables=["question"]) ...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/ai21.html
00c219e7fcb3-0
.ipynb .pdf SageMakerEndpoint SageMakerEndpoint# This notebooks goes over how to use an LLM hosted on a SageMaker endpoint. !pip3 install langchain boto3 from langchain.docstore.document import Document example_doc_1 = """ Peter and Elizabeth took a taxi to attend the night party in the city. While in the party, Elizab...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/sagemaker.html
00c219e7fcb3-1
return response_json[0]["generated_text"] content_handler = ContentHandler() chain = load_qa_chain( llm=SagemakerEndpoint( endpoint_name="endpoint-name", credentials_profile_name="credentials-profile-name", region_name="us-west-2", model_kwargs={"temperature":1e-10}, conte...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/sagemaker.html
f642e909fab8-0
.ipynb .pdf Modal Modal# This example goes over how to use LangChain to interact with Modal models from langchain.llms import Modal from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think step by step.""" prompt = PromptTemplate(template=template, input_variables=["question...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/modal.html
3990c2fde161-0
.ipynb .pdf PromptLayer OpenAI Contents Install PromptLayer Imports Set the Environment API Key Use the PromptLayerOpenAI LLM like normal Using PromptLayer Track PromptLayer OpenAI# This example showcases how to connect to PromptLayer to start recording your OpenAI requests. Install PromptLayer# The promptlayer packa...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/promptlayer_openai.html
3990c2fde161-1
llm_results = llm.generate(["Tell me a joke"]) for res in llm_results.generations: pl_request_id = res[0].generation_info["pl_request_id"] promptlayer.track.score(request_id=pl_request_id, score=100) Using this allows you to track the performance of your model in the PromptLayer dashboard. If you are using a pr...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/promptlayer_openai.html
492bde049bb2-0
.ipynb .pdf DeepInfra LLM Example Contents Imports Set the Environment API Key Create the DeepInfra instance Create a Prompt Template Initiate the LLMChain Run the LLMChain DeepInfra LLM Example# This notebook goes over how to use Langchain with DeepInfra. Imports# import os from langchain.llms import DeepInfra from ...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/deepinfra_example.html
492bde049bb2-1
By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Mar 22, 2023.
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/deepinfra_example.html
475b4f4c6e03-0
.ipynb .pdf Banana Banana# This example goes over how to use LangChain to interact with Banana models import os from langchain.llms import Banana from langchain import PromptTemplate, LLMChain os.environ["BANANA_API_KEY"] = "YOUR_API_KEY" template = """Question: {question} Answer: Let's think step by step.""" prompt = ...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/banana.html
4d3979d3d030-0
.ipynb .pdf Anthropic Anthropic# This example goes over how to use LangChain to interact with Anthropic models from langchain.llms import Anthropic from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think step by step.""" prompt = PromptTemplate(template=template, input_vari...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/anthropic_example.html
dd6609294558-0
.ipynb .pdf OpenAI OpenAI# This example goes over how to use LangChain to interact with OpenAI models from langchain.llms import OpenAI from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think step by step.""" prompt = PromptTemplate(template=template, input_variables=["ques...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/openai.html
206516565635-0
.ipynb .pdf CerebriumAI LLM Example Contents Install cerebrium Imports Set the Environment API Key Create the CerebriumAI instance Create a Prompt Template Initiate the LLMChain Run the LLMChain CerebriumAI LLM Example# This notebook goes over how to use Langchain with CerebriumAI. Install cerebrium# The cerebrium pa...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/cerebriumai_example.html
206516565635-1
llm_chain.run(question) previous Banana next Cohere Contents Install cerebrium Imports Set the Environment API Key Create the CerebriumAI instance Create a Prompt Template Initiate the LLMChain Run the LLMChain By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Mar 22, 2023.
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/cerebriumai_example.html
39e6521d2dfd-0
.ipynb .pdf Petals LLM Example Contents Install petals Imports Set the Environment API Key Create the Petals instance Create a Prompt Template Initiate the LLMChain Run the LLMChain Petals LLM Example# This notebook goes over how to use Langchain with Petals. Install petals# The petals package is required to use the ...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/petals_example.html
39e6521d2dfd-1
By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Mar 22, 2023.
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/petals_example.html
fec7d594338c-0
.ipynb .pdf Azure OpenAI LLM Example Contents API configuration Deployments Azure OpenAI LLM Example# This notebook goes over how to use Langchain with Azure OpenAI. The Azure OpenAI API is compatible with OpenAI’s API. The openai Python package makes it easy to use both OpenAI and Azure OpenAI. You can call Azure ...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/azure_openai_example.html
fec7d594338c-1
import openai response = openai.Completion.create( engine="text-davinci-002-prod", prompt="This is a test", max_tokens=5 ) # Import Azure OpenAI from langchain.llms import AzureOpenAI # Create an instance of Azure OpenAI # Replace the deployment name with your own llm = AzureOpenAI(deployment_name="text-dav...
https://langchain.readthedocs.io/en/latest/modules/llms/integrations/azure_openai_example.html
bef95c9f9087-0
.ipynb .pdf Custom LLM Custom LLM# This notebook goes over how to create a custom LLM wrapper, in case you want to use your own LLM or a different wrapper than one that is supported in LangChain. There is only one required thing that a custom LLM needs to implement: A _call method that takes in a string, some optional ...
https://langchain.readthedocs.io/en/latest/modules/llms/examples/custom_llm.html
bef95c9f9087-1
By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Mar 22, 2023.
https://langchain.readthedocs.io/en/latest/modules/llms/examples/custom_llm.html
8e51f6dc3b6e-0
.ipynb .pdf LLM Serialization Contents Loading Saving LLM Serialization# This notebook walks through how to write and read an LLM Configuration to and from disk. This is useful if you want to save the configuration for a given LLM (e.g., the provider, the temperature, etc). from langchain.llms import OpenAI from lang...
https://langchain.readthedocs.io/en/latest/modules/llms/examples/llm_serialization.html
8e51f6dc3b6e-1
llm.save("llm.json") llm.save("llm.yaml") previous LLM Caching next Token Usage Tracking Contents Loading Saving By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Mar 22, 2023.
https://langchain.readthedocs.io/en/latest/modules/llms/examples/llm_serialization.html
853addbcc3f3-0
.ipynb .pdf Fake LLM Fake LLM# We expose a fake LLM class that can be used for testing. This allows you to mock out calls to the LLM and simulate what would happen if the LLM responded in a certain way. In this notebook we go over how to use this. We start this with using the FakeLLM in an agent. from langchain.llms.fa...
https://langchain.readthedocs.io/en/latest/modules/llms/examples/fake_llm.html
fb411fc488fc-0
.ipynb .pdf LLM Caching Contents In Memory Cache SQLite Cache Redis Cache SQLAlchemy Cache Custom SQLAlchemy Schemas Optional Caching Optional Caching in Chains LLM Caching# This notebook covers how to cache results of individual LLM calls. from langchain.llms import OpenAI In Memory Cache# import langchain from lang...
https://langchain.readthedocs.io/en/latest/modules/llms/examples/llm_caching.html
fb411fc488fc-1
llm("Tell me a joke") CPU times: user 17 ms, sys: 9.76 ms, total: 26.7 ms Wall time: 825 ms '\n\nWhy did the chicken cross the road?\n\nTo get to the other side.' %%time # The second time it is, so it goes faster llm("Tell me a joke") CPU times: user 2.46 ms, sys: 1.23 ms, total: 3.7 ms Wall time: 2.67 ms '\n\nWhy did ...
https://langchain.readthedocs.io/en/latest/modules/llms/examples/llm_caching.html
fb411fc488fc-2
from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy_utils import TSVectorType from langchain.cache import SQLAlchemyCache Base = declarative_base() class FulltextLLMCache(Base): # type: ignore """Postgres table for fulltext-indexed LLM Cache""" __tablena...
https://langchain.readthedocs.io/en/latest/modules/llms/examples/llm_caching.html
fb411fc488fc-3
%%time llm("Tell me a joke") CPU times: user 4.91 ms, sys: 2.64 ms, total: 7.55 ms Wall time: 623 ms '\n\nTwo guys stole a calendar. They got six months each.' Optional Caching in Chains# You can also turn off caching for particular nodes in chains. Note that because of certain interfaces, its often easier to construct...
https://langchain.readthedocs.io/en/latest/modules/llms/examples/llm_caching.html
fb411fc488fc-4
Wall time: 5.09 s '\n\nPresident Biden is discussing the American Rescue Plan and the Bipartisan Infrastructure Law, which will create jobs and help Americans. He also talks about his vision for America, which includes investing in education and infrastructure. In response to Russian aggression in Ukraine, the United S...
https://langchain.readthedocs.io/en/latest/modules/llms/examples/llm_caching.html
0828591adb15-0
.ipynb .pdf Token Usage Tracking Token Usage Tracking# This notebook goes over how to track your token usage for specific calls. It is currently only implemented for the OpenAI API. Let’s first look at an extremely simple example of tracking token usage for a single LLM call. from langchain.llms import OpenAI from lang...
https://langchain.readthedocs.io/en/latest/modules/llms/examples/token_usage_tracking.html
0828591adb15-1
Action: Search Action Input: "Olivia Wilde boyfriend" Observation: Jason Sudeikis Thought: I need to find out Jason Sudeikis' age Action: Search Action Input: "Jason Sudeikis age" Observation: 47 years Thought: I need to calculate 47 raised to the 0.23 power Action: Calculator Action Input: 47^0.23 Observation: Answer:...
https://langchain.readthedocs.io/en/latest/modules/llms/examples/token_usage_tracking.html
df0af113f1b1-0
.md .pdf Key Concepts Contents Chains Sequential Chain Prompt Selectors Key Concepts# Chains# A chain is made up of links, which can be either primitives or other chains. They vary greatly in complexity and are combination of generic, highly configurable pipelines and more narrow (but usually more complex) pipelines....
https://langchain.readthedocs.io/en/latest/modules/chains/key_concepts.html
d57d64d9234d-0
.rst .pdf How-To Guides How-To Guides# A chain is made up of links, which can be either primitives or other chains. Primitives can be either prompts, llms, utils, or other chains. The examples here are all end-to-end chains for specific applications. They are broken up into three categories: Generic Chains: Generic cha...
https://langchain.readthedocs.io/en/latest/modules/chains/how_to_guides.html
d197a81a4053-0
.rst .pdf Utility Chains Utility Chains# A chain is made up of links, which can be either primitives or other chains. Primitives can be either prompts, llms, utils, or other chains. The examples here are all end-to-end chains for specific applications, focused on interacting an LLMChain with a specific utility. LLMMath...
https://langchain.readthedocs.io/en/latest/modules/chains/utility_how_to.html
d197a81a4053-1
Example Notebook LLMChecker Chain Links Used: LLMChain Notes: This chain takes user input (a question), uses an LLM chain to answer that question, and then uses other LLMChains to self-check that answer. Example Notebook LLMRequests Chain Links Used: Requests, LLMChain Notes: This chain takes a URL and other inputs, us...
https://langchain.readthedocs.io/en/latest/modules/chains/utility_how_to.html
e6adc41d17b7-0
.ipynb .pdf Getting Started Contents Why do we need chains? Query an LLM with the LLMChain Combine chains with the SequentialChain Create a custom chain with the Chain class Getting Started# In this tutorial, we will learn about creating simple chains in LangChain. We will learn how to create a chain, add components ...
https://langchain.readthedocs.io/en/latest/modules/chains/getting_started.html
e6adc41d17b7-1
print(chain.run("colorful socks")) Rainbow Socks Co. You can use a chat model in an LLMChain as well: from langchain.chat_models import ChatOpenAI from langchain.prompts.chat import ( ChatPromptTemplate, HumanMessagePromptTemplate, ) human_message_prompt = HumanMessagePromptTemplate( prompt=PromptTempla...
https://langchain.readthedocs.io/en/latest/modules/chains/getting_started.html
e6adc41d17b7-2
template="Write a catchphrase for the following company: {company_name}", ) chain_two = LLMChain(llm=llm, prompt=second_prompt) Now we can combine the two LLMChains, so that we can create a company name and a catchphrase in a single step. from langchain.chains import SimpleSequentialChain overall_chain = SimpleSequenti...
https://langchain.readthedocs.io/en/latest/modules/chains/getting_started.html
e6adc41d17b7-3
return list(all_input_vars) @property def output_keys(self) -> List[str]: return ['concat_output'] def _call(self, inputs: Dict[str, str]) -> Dict[str, str]: output_1 = self.chain_1.run(inputs) output_2 = self.chain_2.run(inputs) return {'concat_output': output_1 + output_2} ...
https://langchain.readthedocs.io/en/latest/modules/chains/getting_started.html
3ab2359bfe6c-0
.rst .pdf Generic Chains Generic Chains# A chain is made up of links, which can be either primitives or other chains. Primitives can be either prompts, llms, utils, or other chains. The examples here are all generic end-to-end chains that are meant to be used to construct other chains rather than serving a specific pur...
https://langchain.readthedocs.io/en/latest/modules/chains/generic_how_to.html
a931f2a9384c-0
.ipynb .pdf Async API for Chain Async API for Chain# LangChain provides async support for Chains by leveraging the asyncio library. Async methods are currently supported in LLMChain (through arun, apredict, acall) and LLMMathChain (through arun and acall), ChatVectorDBChain, and QA chains. Async support for other chain...
https://langchain.readthedocs.io/en/latest/modules/chains/async_chain.html
a931f2a9384c-1
await generate_concurrently() elapsed = time.perf_counter() - s print('\033[1m' + f"Concurrent executed in {elapsed:0.2f} seconds." + '\033[0m') s = time.perf_counter() generate_serially() elapsed = time.perf_counter() - s print('\033[1m' + f"Serial executed in {elapsed:0.2f} seconds." + '\033[0m') BrightSmile Toothpas...
https://langchain.readthedocs.io/en/latest/modules/chains/async_chain.html
301170efb649-0
.ipynb .pdf LLMRequestsChain LLMRequestsChain# Using the request library to get HTML results from a URL and then an LLM to parse results from langchain.llms import OpenAI from langchain.chains import LLMRequestsChain, LLMChain from langchain.prompts import PromptTemplate template = """Between >>> and <<< are the raw se...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/llm_requests.html
9892213f8ba4-0
.ipynb .pdf LLM Math Contents Customize Prompt LLM Math# This notebook showcases using LLMs and Python REPLs to do complex word math problems. from langchain import OpenAI, LLMMathChain llm = OpenAI(temperature=0) llm_math = LLMMathChain(llm=llm, verbose=True) llm_math.run("What is 13 raised to the .3432 power?") > E...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/llm_math.html
9892213f8ba4-1
${{Output of your code}} ``` Answer: ${{Answer}} Begin. Question: What is 37593 * 67? ```python import numpy as np print(np.multiply(37593, 67)) ``` ```output 2518731 ``` Answer: 2518731 Question: {question}""" PROMPT = PromptTemplate(input_variables=["question"], template=_PROMPT_TEMPLATE) llm_math = LLMMathChain(llm=...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/llm_math.html
14685603d528-0
.ipynb .pdf SQLite example Contents Customize Prompt Return Intermediate Steps Choosing how to limit the number of rows returned Adding example rows from each table Custom Table Info SQLDatabaseSequentialChain SQLite example# This example showcases hooking up an LLM to answer questions over a database. This uses the ...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/sqlite.html
14685603d528-1
Answer: There are 8 employees. > Finished chain. ' There are 8 employees.' Customize Prompt# You can also customize the prompt that is used. Here is an example prompting it to understand that foobar is the same as the Employee table from langchain.prompts.prompt import PromptTemplate _DEFAULT_TEMPLATE = """Given an inp...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/sqlite.html
14685603d528-2
result = db_chain("How many employees are there in the foobar table?") result["intermediate_steps"] > Entering new SQLDatabaseChain chain... How many employees are there in the foobar table? SQLQuery: SELECT COUNT(*) FROM Employee; SQLResult: [(8,)] Answer: There are 8 employees in the foobar table. > Finished chain. ...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/sqlite.html
14685603d528-3
Answer: Some example tracks by composer Johann Sebastian Bach are 'Concerto for 2 Violins in D Minor, BWV 1043: I. Vivace', 'Aria Mit 30 Veränderungen, BWV 988 "Goldberg Variations": Aria', and 'Suite for Solo Cello No. 1 in G Major, BWV 1007: I. Prélude'. > Finished chain. ' Some example tracks by composer Johann Seba...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/sqlite.html
14685603d528-4
"MediaTypeId" INTEGER NOT NULL, "GenreId" INTEGER, "Composer" NVARCHAR(220), "Milliseconds" INTEGER NOT NULL, "Bytes" INTEGER, "UnitPrice" NUMERIC(10, 2) NOT NULL, PRIMARY KEY ("TrackId"), FOREIGN KEY("MediaTypeId") REFERENCES "MediaType" ("MediaTypeId"), FOREIGN KEY("GenreId") REFERENCES "Genre" ("Genr...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/sqlite.html
14685603d528-5
SQLQuery: SELECT Name FROM Track WHERE Composer LIKE '%Bach%' LIMIT 5; SQLResult: [('American Woman',), ('Concerto for 2 Violins in D Minor, BWV 1043: I. Vivace',), ('Aria Mit 30 Veränderungen, BWV 988 "Goldberg Variations": Aria',), ('Suite for Solo Cello No. 1 in G Major, BWV 1007: I. Prélude',), ('Toccata and Fugue ...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/sqlite.html
14685603d528-6
Custom Table Info# In some cases, it can be useful to provide custom table information instead of using the automatically generated table definitions and the first sample_rows_in_table_info sample rows. For example, if you know that the first few rows of a table are uninformative, it could help to manually provide exam...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/sqlite.html
14685603d528-7
PlaylistId Name 1 Music 2 Movies */ CREATE TABLE Track ( "TrackId" INTEGER NOT NULL, "Name" NVARCHAR(200) NOT NULL, "Composer" NVARCHAR(220), PRIMARY KEY ("TrackId") ) /* 3 rows from Track table: TrackId Name Composer 1 For Those About To Rock (We Salute You) Angus Young, Malcolm Young, Brian Johnson 2 Balls to th...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/sqlite.html
14685603d528-8
Answer: Some example tracks by Bach are 'American Woman', 'Concerto for 2 Violins in D Minor, BWV 1043: I. Vivace', 'Aria Mit 30 Veränderungen, BWV 988 "Goldberg Variations": Aria', 'Suite for Solo Cello No. 1 in G Major, BWV 1007: I. Prélude', and 'Toccata and Fugue in D Minor, BWV 565: I. Toccata'. > Finished chain. ...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/sqlite.html
14685603d528-9
> Entering new SQLDatabaseChain chain... How many employees are also customers? SQLQuery: SELECT COUNT(*) FROM Employee INNER JOIN Customer ON Employee.EmployeeId = Customer.SupportRepId; SQLResult: [(59,)] Answer: 59 employees are also customers. > Finished chain. > Finished chain. ' 59 employees are also customers.'...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/sqlite.html
343660a0e518-0
.ipynb .pdf PAL Contents Math Prompt Colored Objects Intermediate Steps PAL# Implements Program-Aided Language Models, as in https://arxiv.org/pdf/2211.10435.pdf. from langchain.chains import PALChain from langchain import OpenAI llm = OpenAI(model_name='code-davinci-002', temperature=0, max_tokens=512) Math Prompt# ...
https://langchain.readthedocs.io/en/latest/modules/chains/examples/pal.html