prompt=CONDENSE_QUESTION_PROMPT)doc_chain = load_qa_chain(streaming_llm, chain_type="stuff", prompt=QA_PROMPT)qa = ConversationalRetrievalChain(    retriever=vectorstore.as_retriever(),    combine_docs_chain=doc_chain,    question_generator=question_generator,)chat_history = []query = "What did the president say about Ketanji Brown Jackson"result = qa({"question": query, "chat_history": chat_history})     The president said that Ketanji Brown Jackson is one of the nation's top legal minds and that she will continue Justice Breyer's legacy of excellence.chat_history = [(query, result["answer"])]query = "Did he mention who she suceeded"result = qa({"question": query, "chat_history": chat_history})     Justice Stephen Breyerget_chat_history Functionâ€‹You can also specify a get_chat_history function, which can be used to format the chat_history string.def get_chat_history(inputs) -> str:    res = []    for human, ai in inputs:        res.append(f"Human:{human}\nAI:{ai}")    return "\n".join(res)qa = ConversationalRetrievalChain.from_llm(    llm, vectorstore.as_retriever(), get_chat_history=get_chat_history)chat_history = []query = "What did the president say about Ketanji Brown Jackson"result = qa({"question": query, "chat_history": chat_history})result["answer"]    " The president said that Ketanji Brown Jackson is one of the nation's top legal minds and that she will continue Justice Breyer's legacy of excellence."PreviousVectaraNextVectara Text GenerationPass in chat historyReturn Source DocumentsConversationalRetrievalChain with


Text GenerationPass in chat historyReturn Source DocumentsConversationalRetrievalChain with search_distanceConversationalRetrievalChain with map_reduceConversationalRetrievalChain with Question Answering with sourcesConversationalRetrievalChain with streaming to stdoutget_chat_history FunctionCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Vectara Text Generation | ğŸ¦œï¸�ğŸ”— Langchain


Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesGrouped by providerWandB TracingAI21 LabsAimAirbyteAirtableAleph AlphaAlibaba Cloud OpensearchAmazon API GatewayAnalyticDBAnnoyAnyscaleApifyArangoDBArgillaArthurArxivAtlasDBAwaDBAWS S3 DirectoryAZLyricsAzure Blob StorageAzure Cognitive SearchAzure OpenAIBananaBasetenBeamBedrockBiliBiliBlackboardBrave SearchCassandraCerebriumAIChaindeskChromaClarifaiClearMLCnosDBCohereCollege ConfidentialCometConfluenceC TransformersDatabricksDatadog TracingDatadog LogsDataForSEODeepInfraDeep LakeDiffbotDiscordDocugamiDuckDBElasticsearchEverNoteFacebook ChatFigmaFlyteForefrontAIGitGitBookGoldenGoogle BigQueryGoogle Cloud StorageGoogle DriveGoogle SearchGoogle SerperGooseAIGPT4AllGraphsignalGrobidGutenbergHacker NewsHazy ResearchHeliconeHologresHugging FaceiFixitIMSDbInfinoJinaLanceDBLangChain Decorators âœ¨Llama.cppMarqoMediaWikiDumpMetalMicrosoft OneDriveMicrosoft PowerPointMicrosoft WordMilvusMLflow AI GatewayMLflowModalModelScopeModern TreasuryMomentoMotherduckMyScaleNLPCloudNotion DBObsidianOpenAIOpenLLMOpenSearchOpenWeatherMapPetalsPGVectorPineconePipelineAIPortkeyPredibasePrediction GuardPromptLayerPsychicQdrantRay ServeRebuffRedditRedisReplicateRoamRocksetRunhouseRWKV-4SageMaker EndpointSearxNG Search APISerpAPIShale


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraChat Over Documents with VectaraVectara Text GenerationVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerVectaraVectara Text GenerationOn this pageVectara Text GenerationThis notebook is based on text generation notebook and adapted to Vectara.Prepare Dataâ€‹First, we prepare the data. For this example, we fetch a documentation site that consists of markdown files hosted on Github and split them into small enough Documents.import osfrom langchain.llms import OpenAIfrom langchain.docstore.document import Documentimport requestsfrom langchain.vectorstores import Vectarafrom langchain.text_splitter import CharacterTextSplitterfrom langchain.prompts import PromptTemplateimport pathlibimport subprocessimport tempfiledef get_github_docs(repo_owner, repo_name):    with tempfile.TemporaryDirectory() as d:        subprocess.check_call(            f"git clone --depth 1 https://github.com/{repo_owner}/{repo_name}.git .",            cwd=d,            shell=True,        )        git_sha = (            subprocess.check_output("git rev-parse HEAD", shell=True, cwd=d)            .decode("utf-8")            .strip()


.strip()        )        repo_path = pathlib.Path(d)        markdown_files = list(repo_path.glob("*/*.md")) + list(            repo_path.glob("*/*.mdx")        )        for markdown_file in markdown_files:            with open(markdown_file, "r") as f:                relative_path = markdown_file.relative_to(repo_path)                github_url = f"https://github.com/{repo_owner}/{repo_name}/blob/{git_sha}/{relative_path}"                yield Document(page_content=f.read(), metadata={"source": github_url})sources = get_github_docs("yirenlu92", "deno-manual-forked")source_chunks = []splitter = CharacterTextSplitter(separator=" ", chunk_size=1024, chunk_overlap=0)for source in sources:    for chunk in splitter.split_text(source.page_content):        source_chunks.append(chunk)    Cloning into '.'...Set Up Vector DBâ€‹Now that we have the documentation content in chunks, let's put all this information in a vector index for easy retrieval.import ossearch_index = Vectara.from_texts(source_chunks, embedding=None)Set Up LLM Chain with Custom Promptâ€‹Next, let's set up a simple LLM chain but give it a custom prompt for blog post generation. Note that the custom prompt is parameterized and takes two inputs: context, which will be the documents fetched from the


custom prompt is parameterized and takes two inputs: context, which will be the documents fetched from the vector search, and topic, which is given by the user.from langchain.chains import LLMChainprompt_template = """Use the context below to write a 400 word blog post about the topic below:    Context: {context}    Topic: {topic}    Blog post:"""PROMPT = PromptTemplate(template=prompt_template, input_variables=["context", "topic"])llm = OpenAI(openai_api_key=os.environ["OPENAI_API_KEY"], temperature=0)chain = LLMChain(llm=llm, prompt=PROMPT)Generate Textâ€‹Finally, we write a function to apply our inputs to the chain. The function takes an input parameter topic. We find the documents in the vector index that correspond to that topic, and use them as additional context in our simple LLM chain.def generate_blog_post(topic):    docs = search_index.similarity_search(topic, k=4)    inputs = [{"context": doc.page_content, "topic": topic} for doc in docs]    print(chain.apply(inputs))generate_blog_post("environment variables")    [{'text': '\n\nEnvironment variables are a powerful tool for managing configuration settings in your applications. They allow you to store and access values from anywhere in your code, making it easier to keep your codebase organized and maintainable.\n\nHowever, there are times when you may want to use environment variables specifically for a single command. This is where shell variables come in. Shell variables are similar to environment variables, but they won\'t be exported to spawned commands. They are defined with the following syntax:\n\n```sh\nVAR_NAME=value\n```\n\nFor example, if you wanted to use a shell variable instead of an environment variable in a command, you could do something like


wanted to use a shell variable instead of an environment variable in a command, you could do something like this:\n\n```sh\nVAR=hello && echo $VAR && deno eval "console.log(\'Deno: \' + Deno.env.get(\'VAR\'))"\n```\n\nThis would output the following:\n\n```\nhello\nDeno: undefined\n```\n\nShell variables can be useful when you want to re-use a value, but don\'t want it available in any spawned processes.\n\nAnother way to use environment variables is through pipelines. Pipelines provide a way to pipe the'}, {'text': '\n\nEnvironment variables are a great way to store and access sensitive information in your applications. They are also useful for configuring applications and managing different environments. In Deno, there are two ways to use environment variables: the built-in `Deno.env` and the `.env` file.\n\nThe `Deno.env` is a built-in feature of the Deno runtime that allows you to set and get environment variables. It has getter and setter methods that you can use to access and set environment variables. For example, you can set the `FIREBASE_API_KEY` and `FIREBASE_AUTH_DOMAIN` environment variables like this:\n\n```ts\nDeno.env.set("FIREBASE_API_KEY", "examplekey123");\nDeno.env.set("FIREBASE_AUTH_DOMAIN", "firebasedomain.com");\n\nconsole.log(Deno.env.get("FIREBASE_API_KEY")); // examplekey123\nconsole.log(Deno.env.get("FIREBASE_AUTH_DOMAIN")); // firebasedomain'}, {'text': "\n\nEnvironment variables are a powerful tool for managing configuration and settings in your applications. They allow you to store and access values that can be used in your code, and they can be set and changed without having to modify your code.\n\nIn Deno,


and they can be set and changed without having to modify your code.\n\nIn Deno, environment variables are defined using the `export` command. For example, to set a variable called `VAR_NAME` to the value `value`, you would use the following command:\n\n```sh\nexport VAR_NAME=value\n```\n\nYou can then access the value of the environment variable in your code using the `Deno.env.get()` method. For example, if you wanted to log the value of the `VAR_NAME` variable, you could use the following code:\n\n```js\nconsole.log(Deno.env.get('VAR_NAME'));\n```\n\nYou can also set environment variables for a single command. To do this, you can list the environment variables before the command, like so:\n\n```\nVAR=hello VAR2=bye deno run main.ts\n```\n\nThis will set the environment variables `VAR` and `V"}, {'text': "\n\nEnvironment variables are a powerful tool for managing settings and configuration in your applications. They can be used to store information such as user preferences, application settings, and even passwords. In this blog post, we'll discuss how to make Deno scripts executable with a hashbang (shebang).\n\nA hashbang is a line of code that is placed at the beginning of a script. It tells the system which interpreter to use when running the script. In the case of Deno, the hashbang should be `#!/usr/bin/env -S deno run --allow-env`. This tells the system to use the Deno interpreter and to allow the script to access environment variables.\n\nOnce the hashbang is in place, you may need to give the script execution permissions. On Linux, this can be done with the command `sudo chmod +x hashbang.ts`. After that, you can execute the script by calling it like any other command:


hashbang.ts`. After that, you can execute the script by calling it like any other command: `./hashbang.ts`.\n\nIn the example program, we give the context permission to access the environment variables and print the Deno installation path. This is done by using the `Deno.env.get()` function, which returns the value of the specified environment"}]PreviousChat Over Documents with VectaraNextVespaPrepare DataSet Up Vector DBSet Up LLM Chain with Custom PromptGenerate TextCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Page Not Found | ğŸ¦œï¸�ğŸ”— Langchain

Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKPage Not FoundWe could not find what you were looking for.Please contact the owner of the site that linked you to the original URL and let them know their link is broken.CommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Metal | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerMetalOn this pageMetalThis page covers how to use Metal within LangChain.What is Metal?â€‹Metal is a  managed retrieval & memory platform built for production. Easily index your data into Metal and run semantic search and retrieval on it.Quick startâ€‹Get started by creating a Metal account.Then, you can easily take advantage of the MetalRetriever class to start retrieving your data for semantic search, prompting context, etc. This class takes a Metal instance and a dictionary of parameters to pass to the Metal API.from langchain.retrievers import MetalRetrieverfrom metal_sdk.metal import Metalmetal = Metal("API_KEY", "CLIENT_ID", "INDEX_ID");retriever = MetalRetriever(metal, params={"limit": 2})docs = retriever.get_relevant_documents("search term")PreviousMediaWikiDumpNextMicrosoft OneDriveWhat is Metal?Quick startCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Confluence | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerConfluenceOn this pageConfluenceConfluence is a wiki collaboration platform that saves and organizes all of the project-related material. Confluence is a knowledge base that primarily handles content management activities. Installation and Setupâ€‹pip install atlassian-python-apiWe need to set up username/api_key or Oauth2 login.


See instructions.Document Loaderâ€‹See a usage example.from langchain.document_loaders import ConfluenceLoaderPreviousCometNextC TransformersInstallation and SetupDocument LoaderCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Marqo | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerMarqoOn this pageMarqoThis page covers how to use the Marqo ecosystem within LangChain.What is Marqo?â€‹Marqo is a tensor search engine that uses embeddings stored in in-memory HNSW indexes to achieve cutting edge search speeds. Marqo can scale to hundred-million document indexes with horizontal index sharding and allows for async and non-blocking data upload and search. Marqo uses the latest machine learning models from PyTorch, Huggingface, OpenAI and more. You can start with a pre-configured model or bring your own. The built in ONNX support and conversion allows for faster inference and higher throughput on both CPU and GPU.Because Marqo include its own inference your documents can have a mix of text and images, you can bring Marqo indexes with data from your other systems into the langchain ecosystem without having to worry about your embeddings being compatible. Deployment of Marqo is flexible, you can get started yourself with our docker image or contact us about our managed cloud offering!To run Marqo locally with our docker image, see our getting started.Installation and Setupâ€‹Install the Python SDK with pip install marqoWrappersâ€‹VectorStoreâ€‹There exists a wrapper around Marqo indexes, allowing you to use them within the vectorstore framework. Marqo lets you select from a range of models for generating embeddings and exposes some preprocessing configurations.The


Marqo lets you select from a range of models for generating embeddings and exposes some preprocessing configurations.The Marqo vectorstore can also work with existing multimodel indexes where your documents have a mix of images and text, for more information refer to our documentation. Note that instaniating the Marqo vectorstore with an existing multimodal index will disable the ability to add any new documents to it via the langchain vectorstore add_texts method.To import this vectorstore:from langchain.vectorstores import MarqoFor a more detailed walkthrough of the Marqo wrapper and some of its unique features, see this notebookPreviousLlama.cppNextMediaWikiDumpWhat is Marqo?Installation and SetupWrappersVectorStoreCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Zilliz | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerZillizOn this pageZillizZilliz Cloud is a fully managed service on cloud for LF AI MilvusÂ®,Installation and Setupâ€‹Install the Python SDK:pip install pymilvusVectorstoreâ€‹A wrapper around Zilliz indexes allows you to use it as a vectorstore,


whether for semantic search or example selection.from langchain.vectorstores import MilvusFor a more detailed walkthrough of the Miluvs wrapper, see this notebookPreviousZepInstallation and SetupVectorstoreCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Clarifai | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerClarifaiOn this pageClarifaiClarifai is one of first deep learning platforms having been founded in 2013. Clarifai provides an AI platform with the full AI lifecycle for data exploration, data labeling, model training, evaluation and inference around images, video, text and audio data. In the LangChain ecosystem, as far as we're aware, Clarifai is the only provider that supports LLMs, embeddings and a vector store in one production scale platform, making it an excellent choice to operationalize your LangChain implementations.Installation and Setupâ€‹Install the Python SDK:pip install clarifaiSign-up for a Clarifai account, then get a personal access token to access the Clarifai API from your security settings and set it as an environment variable (CLARIFAI_PAT).Modelsâ€‹Clarifai provides 1,000s of AI models for many different use cases. You can explore them here to find the one most suited for your use case. These models include those created by other providers such as OpenAI, Anthropic, Cohere, AI21, etc. as well as state of the art from open source such as Falcon, InstructorXL, etc. so that you build the best in AI into your products. You'll find these organized by the creator's user_id and into projects we call applications denoted by their app_id. Those IDs will be needed in additional to the model_id and optionally the


by their app_id. Those IDs will be needed in additional to the model_id and optionally the version_id, so make note of all these IDs once you found the best model for your use case!Also note that given there are many models for images, video, text and audio understanding, you can build some interested AI agents that utilize the variety of AI models as experts to understand those data types.LLMsâ€‹To find the selection of LLMs in the Clarifai platform you can select the text to text model type here.from langchain.llms import Clarifaillm = Clarifai(pat=CLARIFAI_PAT, user_id=USER_ID, app_id=APP_ID, model_id=MODEL_ID)For more details, the docs on the Clarifai LLM wrapper provide a detailed walkthrough.Text Embedding Modelsâ€‹To find the selection of text embeddings models in the Clarifai platform you can select the text to embedding model type here.There is a Clarifai Embedding model in LangChain, which you can access with:from langchain.embeddings import ClarifaiEmbeddingsembeddings = ClarifaiEmbeddings(pat=CLARIFAI_PAT, user_id=USER_ID, app_id=APP_ID, model_id=MODEL_ID)For more details, the docs on the Clarifai Embeddings wrapper provide a detailed walthrough.Vectorstoreâ€‹Clarifai's vector DB was launched in 2016 and has been optimized to support live search queries. With workflows in the Clarifai platform, you data is automatically indexed by am embedding model and optionally other models as well to index that information in the DB for search. You can query the DB not only via the vectors but also filter by metadata matches, other AI predicted concepts, and even do geo-coordinate search. Simply create an application, select the appropriate base workflow for your type of data, and upload it (through the


an application, select the appropriate base workflow for your type of data, and upload it (through the API as documented here or the UIs at clarifai.com).You an also add data directly from LangChain as well, and the auto-indexing will take place for you. You'll notice this is a little different than other vectorstores where you need to provde an embedding model in their constructor and have LangChain coordinate getting the embeddings from text and writing those to the index. Not only is it more convenient, but it's much more scalable to use Clarifai's distributed cloud to do all the index in the background.from langchain.vectorstores import Clarifaiclarifai_vector_db = Clarifai.from_texts(user_id=USER_ID, app_id=APP_ID, texts=texts, pat=CLARIFAI_PAT, number_of_docs=NUMBER_OF_DOCS, metadatas = metadatas)For more details, the docs on the Clarifai vector store provide a detailed walthrough.PreviousChromaNextClearMLInstallation and SetupModelsLLMsText Embedding ModelsVectorstoreCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Microsoft PowerPoint | ğŸ¦œï¸�ğŸ”— Langchain


Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesGrouped by providerWandB TracingAI21 LabsAimAirbyteAirtableAleph AlphaAlibaba Cloud OpensearchAmazon API GatewayAnalyticDBAnnoyAnyscaleApifyArangoDBArgillaArthurArxivAtlasDBAwaDBAWS S3 DirectoryAZLyricsAzure Blob StorageAzure Cognitive SearchAzure OpenAIBananaBasetenBeamBedrockBiliBiliBlackboardBrave SearchCassandraCerebriumAIChaindeskChromaClarifaiClearMLCnosDBCohereCollege ConfidentialCometConfluenceC TransformersDatabricksDatadog TracingDatadog LogsDataForSEODeepInfraDeep LakeDiffbotDiscordDocugamiDuckDBElasticsearchEverNoteFacebook ChatFigmaFlyteForefrontAIGitGitBookGoldenGoogle BigQueryGoogle Cloud StorageGoogle DriveGoogle SearchGoogle SerperGooseAIGPT4AllGraphsignalGrobidGutenbergHacker NewsHazy ResearchHeliconeHologresHugging FaceiFixitIMSDbInfinoJinaLanceDBLangChain Decorators âœ¨Llama.cppMarqoMediaWikiDumpMetalMicrosoft OneDriveMicrosoft PowerPointMicrosoft WordMilvusMLflow AI GatewayMLflowModalModelScopeModern TreasuryMomentoMotherduckMyScaleNLPCloudNotion DBObsidianOpenAIOpenLLMOpenSearchOpenWeatherMapPetalsPGVectorPineconePipelineAIPortkeyPredibasePrediction GuardPromptLayerPsychicQdrantRay ServeRebuffRedditRedisReplicateRoamRocksetRunhouseRWKV-4SageMaker EndpointSearxNG Search APISerpAPIShale


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerMicrosoft PowerPointOn this pageMicrosoft PowerPointMicrosoft PowerPoint is a presentation program by Microsoft.Installation and Setupâ€‹There isn't any special setup for it.Document Loaderâ€‹See a usage example.from langchain.document_loaders import UnstructuredPowerPointLoaderPreviousMicrosoft OneDriveNextMicrosoft WordInstallation and SetupDocument LoaderCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


MyScale | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerMyScaleOn this pageMyScaleThis page covers how to use MyScale vector database within LangChain.


It is broken into two parts: installation and setup, and then references to specific MyScale wrappers.With MyScale, you can manage both structured and unstructured (vectorized) data, and perform joint queries and analytics on both types of data using SQL. Plus, MyScale's cloud-native OLAP architecture, built on top of ClickHouse, enables lightning-fast data processing even on massive datasets.Introductionâ€‹Overview to MyScale and High performance vector searchYou can now register on our SaaS and start a cluster now!If you are also interested in how we managed to integrate SQL and vector, please refer to this document for further syntax reference.We also deliver with live demo on huggingface! Please checkout our huggingface space! They search millions of vector within a blink!Installation and Setupâ€‹Install the Python SDK with pip install clickhouse-connectSetting up environmentsâ€‹There are two ways to set up parameters for myscale index.Environment VariablesBefore you run the app, please set the environment variable with export:
export MYSCALE_HOST='<your-endpoints-url>' MYSCALE_PORT=<your-endpoints-port> MYSCALE_USERNAME=<your-username> MYSCALE_PASSWORD=<your-password> ...You can easily find your account, password and other info on our SaaS. For details please refer to this document


Every attributes under MyScaleSettings can be set with prefix MYSCALE_ and is case insensitive.Create MyScaleSettings object with parameters```pythonfrom langchain.vectorstores import MyScale, MyScaleSettingsconfig = MyScaleSetting(host="<your-backend-url>", port=8443, ...)index = MyScale(embedding_function, config)index.add_documents(...)```Wrappersâ€‹supported functions:add_textsadd_documentsfrom_textsfrom_documentssimilarity_searchasimilarity_searchsimilarity_search_by_vectorasimilarity_search_by_vectorsimilarity_search_with_relevance_scoresVectorStoreâ€‹There exists a wrapper around MyScale database, allowing you to use it as a vectorstore,
whether for semantic search or similar example retrieval.To import this vectorstore:from langchain.vectorstores import MyScaleFor a more detailed walkthrough of the MyScale wrapper, see this notebookPreviousMotherduckNextNLPCloudIntroductionInstallation and SetupSetting up environmentsWrappersVectorStoreCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


scikit-learn | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerscikit-learnOn this pagescikit-learnscikit-learn is an open source collection of machine learning algorithms,


including some implementations of the k nearest neighbors. SKLearnVectorStore wraps this implementation and adds the possibility to persist the vector store in json, bson (binary json) or Apache Parquet format.Installation and Setupâ€‹Install the Python package with pip install scikit-learnVector Storeâ€‹SKLearnVectorStore provides a simple wrapper around the nearest neighbor implementation in the
scikit-learn package, allowing you to use it as a vectorstore.To import this vectorstore:from langchain.vectorstores import SKLearnVectorStoreFor a more detailed walkthrough of the SKLearnVectorStore wrapper, see this notebook.PreviousSingleStoreDBNextSlackInstallation and SetupVector StoreCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


MLflow | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerMLflowMLflowThis notebook goes over how to track your LangChain experiments into your MLflow Serverpip install azureml-mlflowpip install pandaspip install textstatpip install spacypip install openaipip install google-search-resultspython -m spacy download en_core_web_smimport osos.environ["MLFLOW_TRACKING_URI"] = ""os.environ["OPENAI_API_KEY"] = ""os.environ["SERPAPI_API_KEY"] = ""from langchain.callbacks import MlflowCallbackHandlerfrom langchain.llms import OpenAI"""Main function.This function is used to try the callback handler.Scenarios:1. OpenAI LLM2. Chain with multiple SubChains on multiple generations3. Agent with Tools"""mlflow_callback = MlflowCallbackHandler()llm = OpenAI(    model_name="gpt-3.5-turbo", temperature=0, callbacks=[mlflow_callback], verbose=True)# SCENARIO 1 - LLMllm_result = llm.generate(["Tell me a joke"])mlflow_callback.flush_tracker(llm)from langchain.prompts import PromptTemplatefrom langchain.chains import LLMChain# SCENARIO 2 - Chaintemplate = """You are a playwright. Given the title of play, it is your job to write a synopsis for that title.Title: {title}Playwright: This is a synopsis for the above play:"""prompt_template = PromptTemplate(input_variables=["title"],


This is a synopsis for the above play:"""prompt_template = PromptTemplate(input_variables=["title"], template=template)synopsis_chain = LLMChain(llm=llm, prompt=prompt_template, callbacks=[mlflow_callback])test_prompts = [    {        "title": "documentary about good video games that push the boundary of game design"    },]synopsis_chain.apply(test_prompts)mlflow_callback.flush_tracker(synopsis_chain)from langchain.agents import initialize_agent, load_toolsfrom langchain.agents import AgentType# SCENARIO 3 - Agent with Toolstools = load_tools(["serpapi", "llm-math"], llm=llm, callbacks=[mlflow_callback])agent = initialize_agent(    tools,    llm,    agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,    callbacks=[mlflow_callback],    verbose=True,)agent.run(    "Who is Leo DiCaprio's girlfriend? What is her current age raised to the 0.43 power?")mlflow_callback.flush_tracker(agent, finish=True)PreviousMLflow AI GatewayNextModalCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Chaindesk | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerChaindeskOn this pageChaindeskChaindesk is an open source document retrieval platform that helps to connect your personal data with Large Language Models.Installation and Setupâ€‹We need to sign up for Chaindesk, create a datastore, add some data and get your datastore api endpoint url.


We need the API Key.Retrieverâ€‹See a usage example.from langchain.retrievers import ChaindeskRetrieverPreviousCerebriumAINextChromaInstallation and SetupRetrieverCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Google Serper | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerGoogle SerperOn this pageGoogle SerperThis page covers how to use the Serper Google Search API within LangChain. Serper is a low-cost Google Search API that can be used to add answer box, knowledge graph, and organic results data from Google Search.


It is broken into two parts: setup, and then references to the specific Google Serper wrapper.Setupâ€‹Go to serper.dev to sign up for a free accountGet the api key and set it as an environment variable (SERPER_API_KEY)Wrappersâ€‹Utilityâ€‹There exists a GoogleSerperAPIWrapper utility which wraps this API. To import this utility:from langchain.utilities import GoogleSerperAPIWrapperYou can use it as part of a Self Ask chain:from langchain.utilities import GoogleSerperAPIWrapperfrom langchain.llms.openai import OpenAIfrom langchain.agents import initialize_agent, Toolfrom langchain.agents import AgentTypeimport osos.environ["SERPER_API_KEY"] = ""os.environ['OPENAI_API_KEY'] = ""llm = OpenAI(temperature=0)search = GoogleSerperAPIWrapper()tools = [    Tool(        name="Intermediate Answer",        func=search.run,        description="useful for when you need to ask with search"    )]self_ask_with_search = initialize_agent(tools, llm, agent=AgentType.SELF_ASK_WITH_SEARCH, verbose=True)self_ask_with_search.run("What is the hometown of the reigning men's U.S. Open champion?")Outputâ€‹Entering new AgentExecutor chain... Yes.Follow up: Who is the reigning men's U.S. Open champion?Intermediate answer: Current champions Carlos Alcaraz, 2022 men's singles champion.Follow up: Where is Carlos Alcaraz from?Intermediate answer: El Palmar, SpainSo the final answer is: El Palmar, Spain> Finished chain.'El Palmar, Spain'For a more detailed walkthrough of this wrapper, see this notebook.Toolâ€‹You can also easily load this wrapper as a Tool (to use with an Agent).


You can do this with:from langchain.agents import load_toolstools = load_tools(["google-serper"])For more information on tools, see this page.PreviousGoogle SearchNextGooseAISetupWrappersUtilityToolCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Petals | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerPetalsOn this pagePetalsThis page covers how to use the Petals ecosystem within LangChain.


It is broken into two parts: installation and setup, and then references to specific Petals wrappers.Installation and Setupâ€‹Install with pip install petalsGet a Hugging Face api key and set it as an environment variable (HUGGINGFACE_API_KEY)Wrappersâ€‹LLMâ€‹There exists an Petals LLM wrapper, which you can access with from langchain.llms import PetalsPreviousOpenWeatherMapNextPGVectorInstallation and SetupWrappersLLMCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


MLflow AI Gateway | ğŸ¦œï¸�ğŸ”— Langchain


Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesGrouped by providerWandB TracingAI21 LabsAimAirbyteAirtableAleph AlphaAlibaba Cloud OpensearchAmazon API GatewayAnalyticDBAnnoyAnyscaleApifyArangoDBArgillaArthurArxivAtlasDBAwaDBAWS S3 DirectoryAZLyricsAzure Blob StorageAzure Cognitive SearchAzure OpenAIBananaBasetenBeamBedrockBiliBiliBlackboardBrave SearchCassandraCerebriumAIChaindeskChromaClarifaiClearMLCnosDBCohereCollege ConfidentialCometConfluenceC TransformersDatabricksDatadog TracingDatadog LogsDataForSEODeepInfraDeep LakeDiffbotDiscordDocugamiDuckDBElasticsearchEverNoteFacebook ChatFigmaFlyteForefrontAIGitGitBookGoldenGoogle BigQueryGoogle Cloud StorageGoogle DriveGoogle SearchGoogle SerperGooseAIGPT4AllGraphsignalGrobidGutenbergHacker NewsHazy ResearchHeliconeHologresHugging FaceiFixitIMSDbInfinoJinaLanceDBLangChain Decorators âœ¨Llama.cppMarqoMediaWikiDumpMetalMicrosoft OneDriveMicrosoft PowerPointMicrosoft WordMilvusMLflow AI GatewayMLflowModalModelScopeModern TreasuryMomentoMotherduckMyScaleNLPCloudNotion DBObsidianOpenAIOpenLLMOpenSearchOpenWeatherMapPetalsPGVectorPineconePipelineAIPortkeyPredibasePrediction GuardPromptLayerPsychicQdrantRay ServeRebuffRedditRedisReplicateRoamRocksetRunhouseRWKV-4SageMaker EndpointSearxNG Search APISerpAPIShale


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerMLflow AI GatewayOn this pageMLflow AI GatewayThe MLflow AI Gateway service is a powerful tool designed to streamline the usage and management of various large language model (LLM) providers, such as OpenAI and Anthropic, within an organization. It offers a high-level interface that simplifies the interaction with these services by providing a unified endpoint to handle specific LLM related requests. See the MLflow AI Gateway documentation for more details.Installation and Setupâ€‹Install mlflow with MLflow AI Gateway dependencies:pip install 'mlflow[gateway]'Set the OpenAI API key as an environment variable:export OPENAI_API_KEY=...Create a configuration file:routes:  - name: completions    route_type: llm/v1/completions    model:      provider: openai      name: text-davinci-003      config:        openai_api_key: $OPENAI_API_KEY  - name: embeddings    route_type: llm/v1/embeddings    model:      provider: openai      name: text-embedding-ada-002      config:        openai_api_key: $OPENAI_API_KEYStart the Gateway server:mlflow gateway start --config-path /path/to/config.yamlCompletions Exampleâ€‹import


gateway start --config-path /path/to/config.yamlCompletions Exampleâ€‹import mlflowfrom langchain import LLMChain, PromptTemplatefrom langchain.llms import MlflowAIGatewaygateway = MlflowAIGateway(    gateway_uri="http://127.0.0.1:5000",    route="completions",    params={        "temperature": 0.0,        "top_p": 0.1,    },)llm_chain = LLMChain(    llm=gateway,    prompt=PromptTemplate(        input_variables=["adjective"],        template="Tell me a {adjective} joke",    ),)result = llm_chain.run(adjective="funny")print(result)with mlflow.start_run():    model_info = mlflow.langchain.log_model(chain, "model")model = mlflow.pyfunc.load_model(model_info.model_uri)print(model.predict([{"adjective": "funny"}]))Embeddings Exampleâ€‹from langchain.embeddings import MlflowAIGatewayEmbeddingsembeddings = MlflowAIGatewayEmbeddings(    gateway_uri="http://127.0.0.1:5000",    route="embeddings",)print(embeddings.embed_query("hello"))print(embeddings.embed_documents(["hello"]))Chat Exampleâ€‹from langchain.chat_models import ChatMLflowAIGatewayfrom langchain.schema import HumanMessage, SystemMessagechat = ChatMLflowAIGateway(    gateway_uri="http://127.0.0.1:5000",    route="chat",    params={


route="chat",    params={        "temperature": 0.1    })messages = [    SystemMessage(        content="You are a helpful assistant that translates English to French."    ),    HumanMessage(        content="Translate this sentence from English to French: I love programming."    ),]print(chat(messages))Databricks MLflow AI Gatewayâ€‹Databricks MLflow AI Gateway is in private preview.


Please contact a Databricks representative to enroll in the preview.from langchain import LLMChain, PromptTemplatefrom langchain.llms import MlflowAIGatewaygateway = MlflowAIGateway(    gateway_uri="databricks",    route="completions",)llm_chain = LLMChain(    llm=gateway,    prompt=PromptTemplate(        input_variables=["adjective"],        template="Tell me a {adjective} joke",    ),)result = llm_chain.run(adjective="funny")print(result)PreviousMilvusNextMLflowInstallation and SetupCompletions ExampleEmbeddings ExampleChat ExampleDatabricks MLflow AI GatewayCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


AI21 Labs | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerAI21 LabsOn this pageAI21 LabsThis page covers how to use the AI21 ecosystem within LangChain.


It is broken into two parts: installation and setup, and then references to specific AI21 wrappers.Installation and Setupâ€‹Get an AI21 api key and set it as an environment variable (AI21_API_KEY)Wrappersâ€‹LLMâ€‹There exists an AI21 LLM wrapper, which you can access with from langchain.llms import AI21PreviousWandB TracingNextAimInstallation and SetupWrappersLLMCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Runhouse | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerRunhouseOn this pageRunhouseThis page covers how to use the Runhouse ecosystem within LangChain.


It is broken into three parts: installation and setup, LLMs, and Embeddings.Installation and Setupâ€‹Install the Python SDK with pip install runhouseIf you'd like to use on-demand cluster, check your cloud credentials with sky checkSelf-hosted LLMsâ€‹For a basic self-hosted LLM, you can use the SelfHostedHuggingFaceLLM class. For more
custom LLMs, you can use the SelfHostedPipeline parent class.from langchain.llms import SelfHostedPipeline, SelfHostedHuggingFaceLLMFor a more detailed walkthrough of the Self-hosted LLMs, see this notebookSelf-hosted Embeddingsâ€‹There are several ways to use self-hosted embeddings with LangChain via Runhouse.For a basic self-hosted embedding from a Hugging Face Transformers model, you can use
the SelfHostedEmbedding class.from langchain.llms import SelfHostedPipeline, SelfHostedHuggingFaceLLMFor a more detailed walkthrough of the Self-hosted Embeddings, see this notebookPreviousRocksetNextRWKV-4Installation and SetupSelf-hosted LLMsSelf-hosted EmbeddingsCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Databricks | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerDatabricksOn this pageDatabricksThis notebook covers how to connect to the Databricks runtimes and Databricks SQL using the SQLDatabase wrapper of LangChain.


It is broken into 3 parts: installation and setup, connecting to Databricks, and examples.Installation and Setupâ€‹pip install databricks-sql-connectorConnecting to Databricksâ€‹You can connect to Databricks runtimes and Databricks SQL using the SQLDatabase.from_databricks() method.Syntaxâ€‹SQLDatabase.from_databricks(    catalog: str,    schema: str,    host: Optional[str] = None,    api_token: Optional[str] = None,    warehouse_id: Optional[str] = None,    cluster_id: Optional[str] = None,    engine_args: Optional[dict] = None,    **kwargs: Any)Required Parametersâ€‹catalog: The catalog name in the Databricks database.schema: The schema name in the catalog.Optional Parametersâ€‹There following parameters are optional. When executing the method in a Databricks notebook, you don't need to provide them in most of the cases.host: The Databricks workspace hostname, excluding 'https://' part. Defaults to 'DATABRICKS_HOST' environment variable or current workspace if in a Databricks notebook.api_token: The Databricks personal access token for accessing the Databricks SQL warehouse or the cluster. Defaults to 'DATABRICKS_TOKEN' environment variable or a temporary one is generated if in a Databricks notebook.warehouse_id: The warehouse ID in the Databricks SQL.cluster_id: The cluster ID in the Databricks Runtime. If running in a Databricks notebook and both 'warehouse_id' and 'cluster_id' are None, it uses the ID of the cluster the notebook is attached to.engine_args: The arguments to be used when connecting Databricks.**kwargs: Additional keyword arguments for the SQLDatabase.from_uri


be used when connecting Databricks.**kwargs: Additional keyword arguments for the SQLDatabase.from_uri method.Examplesâ€‹# Connecting to Databricks with SQLDatabase wrapperfrom langchain import SQLDatabasedb = SQLDatabase.from_databricks(catalog="samples", schema="nyctaxi")# Creating a OpenAI Chat LLM wrapperfrom langchain.chat_models import ChatOpenAIllm = ChatOpenAI(temperature=0, model_name="gpt-4")SQL Chain exampleâ€‹This example demonstrates the use of the SQL Chain for answering a question over a Databricks database.from langchain import SQLDatabaseChaindb_chain = SQLDatabaseChain.from_llm(llm, db, verbose=True)db_chain.run(    "What is the average duration of taxi rides that start between midnight and 6am?")            > Entering new SQLDatabaseChain chain...    What is the average duration of taxi rides that start between midnight and 6am?    SQLQuery:SELECT AVG(UNIX_TIMESTAMP(tpep_dropoff_datetime) - UNIX_TIMESTAMP(tpep_pickup_datetime)) as avg_duration    FROM trips    WHERE HOUR(tpep_pickup_datetime) >= 0 AND HOUR(tpep_pickup_datetime) < 6    SQLResult: [(987.8122786304605,)]    Answer:The average duration of taxi rides that start between midnight and 6am is 987.81 seconds.    > Finished chain.    'The average duration of taxi rides that start between midnight and 6am is 987.81 seconds.'SQL Database Agent exampleâ€‹This example demonstrates the use of the SQL Database Agent for answering questions over a Databricks database.from langchain.agents import create_sql_agentfrom langchain.agents.agent_toolkits import


database.from langchain.agents import create_sql_agentfrom langchain.agents.agent_toolkits import SQLDatabaseToolkittoolkit = SQLDatabaseToolkit(db=db, llm=llm)agent = create_sql_agent(llm=llm, toolkit=toolkit, verbose=True)agent.run("What is the longest trip distance and how long did it take?")            > Entering new AgentExecutor chain...    Action: list_tables_sql_db    Action Input:     Observation: trips    Thought:I should check the schema of the trips table to see if it has the necessary columns for trip distance and duration.    Action: schema_sql_db    Action Input: trips    Observation:     CREATE TABLE trips (        tpep_pickup_datetime TIMESTAMP,         tpep_dropoff_datetime TIMESTAMP,         trip_distance FLOAT,         fare_amount FLOAT,         pickup_zip INT,         dropoff_zip INT    ) USING DELTA        /*    3 rows from trips table:    tpep_pickup_datetime    tpep_dropoff_datetime   trip_distance   fare_amount pickup_zip  dropoff_zip    2016-02-14 16:52:13+00:00   2016-02-14 17:16:04+00:00   4.94    19.0    10282   10171    2016-02-04 18:44:19+00:00   2016-02-04


18:44:19+00:00   2016-02-04 18:46:00+00:00   0.28    3.5 10110   10110    2016-02-17 17:13:57+00:00   2016-02-17 17:17:55+00:00   0.7 5.0 10103   10023    */    Thought:The trips table has the necessary columns for trip distance and duration. I will write a query to find the longest trip distance and its duration.    Action: query_checker_sql_db    Action Input: SELECT trip_distance, tpep_dropoff_datetime - tpep_pickup_datetime as duration FROM trips ORDER BY trip_distance DESC LIMIT 1    Observation: SELECT trip_distance, tpep_dropoff_datetime - tpep_pickup_datetime as duration FROM trips ORDER BY trip_distance DESC LIMIT 1    Thought:The query is correct. I will now execute it to find the longest trip distance and its duration.    Action: query_sql_db    Action Input: SELECT trip_distance, tpep_dropoff_datetime - tpep_pickup_datetime as duration FROM trips ORDER BY trip_distance DESC LIMIT 1    Observation: [(30.6, '0 00:43:31.000000000')]    Thought:I now know the final answer.    Final Answer: The longest trip distance is 30.6 miles and it took 43 minutes and 31 seconds.        > Finished chain.    'The longest trip distance is 30.6 miles and it took 43 minutes and 31 seconds.'PreviousC TransformersNextDatadog TracingInstallation and SetupConnecting to


minutes and 31 seconds.'PreviousC TransformersNextDatadog TracingInstallation and SetupConnecting to DatabricksSyntaxRequired ParametersOptional ParametersExamplesSQL Chain exampleSQL Database Agent exampleCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


OpenLLM | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerOpenLLMOn this pageOpenLLMThis page demonstrates how to use OpenLLM


with LangChain.OpenLLM is an open platform for operating large language models (LLMs) in
production. It enables developers to easily run inference with any open-source
LLMs, deploy to the cloud or on-premises, and build powerful AI apps.Installation and Setupâ€‹Install the OpenLLM package via PyPI:pip install openllmLLMâ€‹OpenLLM supports a wide range of open-source LLMs as well as serving users' own
fine-tuned LLMs. Use openllm model command to see all available models that
are pre-optimized for OpenLLM.Wrappersâ€‹There is a OpenLLM Wrapper which supports loading LLM in-process or accessing a
remote OpenLLM server:from langchain.llms import OpenLLMWrapper for OpenLLM serverâ€‹This wrapper supports connecting to an OpenLLM server via HTTP or gRPC. The
OpenLLM server can run either locally or on the cloud.To try it out locally, start an OpenLLM server:openllm start flan-t5Wrapper usage:from langchain.llms import OpenLLMllm = OpenLLM(server_url='http://localhost:3000')llm("What is the difference between a duck and a goose? And why there are so many Goose in Canada?")Wrapper for Local Inferenceâ€‹You can also use the OpenLLM wrapper to load LLM in current Python process for
running inference.from langchain.llms import OpenLLMllm = OpenLLM(model_name="dolly-v2", model_id='databricks/dolly-v2-7b')llm("What is the difference between a duck and a goose? And why there are so many Goose in Canada?")Usageâ€‹For a more detailed walkthrough of the OpenLLM Wrapper, see the


example notebookPreviousOpenAINextOpenSearchInstallation and SetupLLMWrappersWrapper for OpenLLM serverWrapper for Local InferenceUsageCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


ModelScope | ğŸ¦œï¸�ğŸ”— Langchain


Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesGrouped by providerWandB TracingAI21 LabsAimAirbyteAirtableAleph AlphaAlibaba Cloud OpensearchAmazon API GatewayAnalyticDBAnnoyAnyscaleApifyArangoDBArgillaArthurArxivAtlasDBAwaDBAWS S3 DirectoryAZLyricsAzure Blob StorageAzure Cognitive SearchAzure OpenAIBananaBasetenBeamBedrockBiliBiliBlackboardBrave SearchCassandraCerebriumAIChaindeskChromaClarifaiClearMLCnosDBCohereCollege ConfidentialCometConfluenceC TransformersDatabricksDatadog TracingDatadog LogsDataForSEODeepInfraDeep LakeDiffbotDiscordDocugamiDuckDBElasticsearchEverNoteFacebook ChatFigmaFlyteForefrontAIGitGitBookGoldenGoogle BigQueryGoogle Cloud StorageGoogle DriveGoogle SearchGoogle SerperGooseAIGPT4AllGraphsignalGrobidGutenbergHacker NewsHazy ResearchHeliconeHologresHugging FaceiFixitIMSDbInfinoJinaLanceDBLangChain Decorators âœ¨Llama.cppMarqoMediaWikiDumpMetalMicrosoft OneDriveMicrosoft PowerPointMicrosoft WordMilvusMLflow AI GatewayMLflowModalModelScopeModern TreasuryMomentoMotherduckMyScaleNLPCloudNotion DBObsidianOpenAIOpenLLMOpenSearchOpenWeatherMapPetalsPGVectorPineconePipelineAIPortkeyPredibasePrediction GuardPromptLayerPsychicQdrantRay ServeRebuffRedditRedisReplicateRoamRocksetRunhouseRWKV-4SageMaker EndpointSearxNG Search APISerpAPIShale


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerModelScopeOn this pageModelScopeThis page covers how to use the modelscope ecosystem within LangChain.


It is broken into two parts: installation and setup, and then references to specific modelscope wrappers.Installation and Setupâ€‹Install the Python SDK with pip install modelscopeWrappersâ€‹Embeddingsâ€‹There exists a modelscope Embeddings wrapper, which you can access with from langchain.embeddings import ModelScopeEmbeddingsFor a more detailed walkthrough of this, see this notebookPreviousModalNextModern TreasuryInstallation and SetupWrappersEmbeddingsCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Arthur | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerArthurArthurArthur is a model monitoring and observability platform.The following guide shows how to run a registered chat LLM with the Arthur callback handler to automatically log model inferences to Arthur.If you do not have a model currently onboarded to Arthur, visit our onboarding guide for generative text models. For more information about how to use the Arthur SDK, visit our docs.from langchain.callbacks import ArthurCallbackHandlerfrom langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandlerfrom langchain.chat_models import ChatOpenAIfrom langchain.schema import HumanMessagePlace Arthur credentials herearthur_url = "https://app.arthur.ai"arthur_login = "your-arthur-login-username-here"arthur_model_id = "your-arthur-model-id-here"Create Langchain LLM with Arthur callback handlerdef make_langchain_chat_llm(chat_model=):    return ChatOpenAI(        streaming=True,        temperature=0.1,        callbacks=[            StreamingStdOutCallbackHandler(),            ArthurCallbackHandler.from_credentials(                arthur_model_id,                 arthur_url=arthur_url,


arthur_login=arthur_login)        ])chatgpt = make_langchain_chat_llm()    Please enter password for admin: Â·Â·Â·Â·Â·Â·Â·Â·Running the chat LLM with this run function will save the chat history in an ongoing list so that the conversation can reference earlier messages and log each response to the Arthur platform. You can view the history of this model's inferences on your model dashboard page.Enter q to quit the run loopdef run(llm):    history = []    while True:        user_input = input("\n>>> input >>>\n>>>: ")        if user_input == "q":            break        history.append(HumanMessage(content=user_input))        history.append(llm(history))run(chatgpt)        >>> input >>>    >>>: What is a callback handler?    A callback handler, also known as a callback function or callback method, is a piece of code that is executed in response to a specific event or condition. It is commonly used in programming languages that support event-driven or asynchronous programming paradigms.        The purpose of a callback handler is to provide a way for developers to define custom behavior that should be executed when a certain event occurs. Instead of waiting for a result or blocking the execution, the program registers a callback function and continues with other tasks. When the event is triggered, the callback function is invoked, allowing the program to respond accordingly.        Callback handlers are commonly used in various scenarios, such as handling user input, responding to network requests,


Callback handlers are commonly used in various scenarios, such as handling user input, responding to network requests, processing asynchronous operations, and implementing event-driven architectures. They provide a flexible and modular way to handle events and decouple different components of a system.    >>> input >>>    >>>: What do I need to do to get the full benefits of this    To get the full benefits of using a callback handler, you should consider the following:        1. Understand the event or condition: Identify the specific event or condition that you want to respond to with a callback handler. This could be user input, network requests, or any other asynchronous operation.        2. Define the callback function: Create a function that will be executed when the event or condition occurs. This function should contain the desired behavior or actions you want to take in response to the event.        3. Register the callback function: Depending on the programming language or framework you are using, you may need to register or attach the callback function to the appropriate event or condition. This ensures that the callback function is invoked when the event occurs.        4. Handle the callback: Implement the necessary logic within the callback function to handle the event or condition. This could involve updating the user interface, processing data, making further requests, or triggering other actions.        5. Consider error handling: It's important to handle any potential errors or exceptions that may occur within the callback function. This ensures that your program can gracefully handle unexpected situations and prevent crashes or undesired behavior.        6. Maintain code readability and modularity: As your codebase grows, it's crucial to keep your callback handlers organized and maintainable. Consider using design patterns or architectural principles to structure your code in a modular and scalable way.


Consider using design patterns or architectural principles to structure your code in a modular and scalable way.        By following these steps, you can leverage the benefits of callback handlers, such as asynchronous and event-driven programming, improved responsiveness, and modular code design.    >>> input >>>    >>>: qPreviousArgillaNextArxivCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Facebook Chat | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerFacebook ChatOn this pageFacebook ChatMessenger is an American proprietary instant messaging app and


platform developed by Meta Platforms. Originally developed as Facebook Chat in 2008, the company revamped its
messaging service in 2010.Installation and Setupâ€‹First, you need to install pandas python package.pip install pandasDocument Loaderâ€‹See a usage example.from langchain.document_loaders import FacebookChatLoaderPreviousEverNoteNextFigmaInstallation and SetupDocument LoaderCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Hugging Face | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerHugging FaceOn this pageHugging FaceThis page covers how to use the Hugging Face ecosystem (including the Hugging Face Hub) within LangChain.


It is broken into two parts: installation and setup, and then references to specific Hugging Face wrappers.Installation and Setupâ€‹If you want to work with the Hugging Face Hub:Install the Hub client library with pip install huggingface_hubCreate a Hugging Face account (it's free!)Create an access token and set it as an environment variable (HUGGINGFACEHUB_API_TOKEN)If you want work with the Hugging Face Python libraries:Install pip install transformers for working with models and tokenizersInstall pip install datasets for working with datasetsWrappersâ€‹LLMâ€‹There exists two Hugging Face LLM wrappers, one for a local pipeline and one for a model hosted on Hugging Face Hub.
Note that these wrappers only work for models that support the following tasks: text2text-generation, text-generationTo use the local pipeline wrapper:from langchain.llms import HuggingFacePipelineTo use a the wrapper for a model hosted on Hugging Face Hub:from langchain.llms import HuggingFaceHubFor a more detailed walkthrough of the Hugging Face Hub wrapper, see this notebookEmbeddingsâ€‹There exists two Hugging Face Embeddings wrappers, one for a local model and one for a model hosted on Hugging Face Hub.
Note that these wrappers only work for sentence-transformers models.To use the local pipeline wrapper:from langchain.embeddings import HuggingFaceEmbeddingsTo use a the wrapper for a model hosted on Hugging Face Hub:from langchain.embeddings import HuggingFaceHubEmbeddingsFor a more detailed walkthrough of this, see this notebookTokenizerâ€‹There are several places you can use tokenizers available through the transformers package.


By default, it is used to count tokens for all LLMs.You can also use it to count tokens when splitting documents with from langchain.text_splitter import CharacterTextSplitterCharacterTextSplitter.from_huggingface_tokenizer(...)For a more detailed walkthrough of this, see this notebookDatasetsâ€‹The Hugging Face Hub has lots of great datasets that can be used to evaluate your LLM chains.For a detailed walkthrough of how to use them to do so, see this notebookPreviousHologresNextiFixitInstallation and SetupWrappersLLMEmbeddingsTokenizerDatasetsCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Alibaba Cloud Opensearch | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerAlibaba Cloud OpensearchOn this pageAlibaba Cloud OpensearchAlibaba Cloud Opensearch OpenSearch is a one-stop platform to develop intelligent search services. OpenSearch was built based on the large-scale distributed search engine developed by Alibaba. OpenSearch serves more than 500 business cases in Alibaba Group and thousands of Alibaba Cloud customers. OpenSearch helps develop search services in different search scenarios, including e-commerce, O2O, multimedia, the content industry, communities and forums, and big data query in enterprises.OpenSearch helps you develop high quality, maintenance-free, and high performance intelligent search services to provide your users with high search efficiency and accuracy. OpenSearch provides the vector search feature. In specific scenarios, especially test question search and image search scenarios, you can use the vector search feature together with the multimodal search feature to improve the accuracy of search results. This topic describes the syntax and usage notes of vector indexes.Purchase an instance and configure itâ€‹Purchase OpenSearch Vector Search Edition from Alibaba Cloud and configure the instance according to the help documentation.Alibaba Cloud Opensearch Vector Store Wrappersâ€‹supported functions:add_textsadd_documentsfrom_textsfrom_documentssimilarity_searchasimilarity_searchsimilarity_search_by_vectorasimilarity_search_by_vectorsimilarity_search_with_relevance_scoresFor a more detailed walk through of the Alibaba Cloud OpenSearch wrapper, see this notebookIf you encounter any problems during use, please feel free to contact


OpenSearch wrapper, see this notebookIf you encounter any problems during use, please feel free to contact xingshaomin.xsm@alibaba-inc.com , and we will do our best to provide you with assistance and support.PreviousAleph AlphaNextAmazon API GatewayPurchase an instance and configure itAlibaba Cloud Opensearch Vector Store WrappersCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Slack | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerSlackOn this pageSlackSlack is an instant messaging program.Installation and Setupâ€‹There isn't any special setup for it.Document Loaderâ€‹See a usage example.from langchain.document_loaders import SlackDirectoryLoaderPreviousscikit-learnNextspaCyInstallation and SetupDocument LoaderCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


AWS S3 Directory | ğŸ¦œï¸�ğŸ”— Langchain


Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesGrouped by providerWandB TracingAI21 LabsAimAirbyteAirtableAleph AlphaAlibaba Cloud OpensearchAmazon API GatewayAnalyticDBAnnoyAnyscaleApifyArangoDBArgillaArthurArxivAtlasDBAwaDBAWS S3 DirectoryAZLyricsAzure Blob StorageAzure Cognitive SearchAzure OpenAIBananaBasetenBeamBedrockBiliBiliBlackboardBrave SearchCassandraCerebriumAIChaindeskChromaClarifaiClearMLCnosDBCohereCollege ConfidentialCometConfluenceC TransformersDatabricksDatadog TracingDatadog LogsDataForSEODeepInfraDeep LakeDiffbotDiscordDocugamiDuckDBElasticsearchEverNoteFacebook ChatFigmaFlyteForefrontAIGitGitBookGoldenGoogle BigQueryGoogle Cloud StorageGoogle DriveGoogle SearchGoogle SerperGooseAIGPT4AllGraphsignalGrobidGutenbergHacker NewsHazy ResearchHeliconeHologresHugging FaceiFixitIMSDbInfinoJinaLanceDBLangChain Decorators âœ¨Llama.cppMarqoMediaWikiDumpMetalMicrosoft OneDriveMicrosoft PowerPointMicrosoft WordMilvusMLflow AI GatewayMLflowModalModelScopeModern TreasuryMomentoMotherduckMyScaleNLPCloudNotion DBObsidianOpenAIOpenLLMOpenSearchOpenWeatherMapPetalsPGVectorPineconePipelineAIPortkeyPredibasePrediction GuardPromptLayerPsychicQdrantRay ServeRebuffRedditRedisReplicateRoamRocksetRunhouseRWKV-4SageMaker EndpointSearxNG Search APISerpAPIShale


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerAWS S3 DirectoryOn this pageAWS S3 DirectoryAmazon Simple Storage Service (Amazon S3) is an object storage service.AWS S3 DirectoryAWS S3 BucketsInstallation and Setupâ€‹pip install boto3Document Loaderâ€‹See a usage example for S3DirectoryLoader.See a usage example for S3FileLoader.from langchain.document_loaders import S3DirectoryLoader, S3FileLoaderPreviousAwaDBNextAZLyricsInstallation and SetupDocument LoaderCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


SearxNG Search API | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerSearxNG Search APIOn this pageSearxNG Search APIThis page covers how to use the SearxNG search API within LangChain.


It is broken into two parts: installation and setup, and then references to the specific SearxNG API wrapper.Installation and Setupâ€‹While it is possible to utilize the wrapper in conjunction with  public searx
instances these instances frequently do not permit API
access (see note on output format below) and have limitations on the frequency
of requests. It is recommended to opt for a self-hosted instance instead.Self Hosted Instance:â€‹See this page for installation instructions.When you install SearxNG, the only active output format by default is the HTML format.


You need to activate the json format to use the API. This can be done by adding the following line to the settings.yml file:search:    formats:        - html        - jsonYou can make sure that the API is working by issuing a curl request to the API endpoint:curl -kLX GET --data-urlencode q='langchain' -d format=json http://localhost:8888This should return a JSON object with the results.Wrappersâ€‹Utilityâ€‹To use the wrapper we need to pass the host of the SearxNG instance to the wrapper with:1. the named parameter `searx_host` when creating the instance.2. exporting the environment variable `SEARXNG_HOST`.You can use the wrapper to get results from a SearxNG instance. from langchain.utilities import SearxSearchWrappers = SearxSearchWrapper(searx_host="http://localhost:8888")s.run("what is a large language model?")Toolâ€‹You can also load this wrapper as a Tool (to use with an Agent).You can do this with:from langchain.agents import load_toolstools = load_tools(["searx-search"],                    searx_host="http://localhost:8888",                    engines=["github"])Note that we could optionally pass custom engines to use.If you want to obtain results with metadata as json you can use:tools = load_tools(["searx-search-results-json"],                    searx_host="http://localhost:8888",                    num_results=5)Quickly creating toolsâ€‹This examples showcases a quick way to create multiple tools from the same


wrapper.from langchain.tools.searx_search.tool import SearxSearchResultswrapper = SearxSearchWrapper(searx_host="**")github_tool = SearxSearchResults(name="Github", wrapper=wrapper,                            kwargs = {                                "engines": ["github"],                                })arxiv_tool = SearxSearchResults(name="Arxiv", wrapper=wrapper,                            kwargs = {                                "engines": ["arxiv"]                                })For more information on tools, see this page.PreviousSageMaker EndpointNextSerpAPIInstallation and SetupSelf Hosted Instance:WrappersUtilityToolCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Telegram | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerTelegramOn this pageTelegramTelegram Messenger is a globally accessible freemium, cross-platform, encrypted, cloud-based and centralized instant messaging service. The application also provides optional end-to-end encrypted chats and video calling, VoIP, file sharing and several other features.Installation and Setupâ€‹See setup instructions.Document Loaderâ€‹See a usage example.from langchain.document_loaders import TelegramChatFileLoaderfrom langchain.document_loaders import TelegramChatApiLoaderPreviousTairNextTigrisInstallation and SetupDocument LoaderCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Google Cloud Storage | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerGoogle Cloud StorageOn this pageGoogle Cloud StorageGoogle Cloud Storage is a managed service for storing unstructured data.Installation and Setupâ€‹First, you need to install google-cloud-bigquery python package.pip install google-cloud-storageDocument Loaderâ€‹There are two loaders for the Google Cloud Storage: the Directory and the File loaders.See a usage example.from langchain.document_loaders import GCSDirectoryLoaderSee a usage example.from langchain.document_loaders import GCSFileLoaderPreviousGoogle BigQueryNextGoogle DriveInstallation and SetupDocument LoaderCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Hacker News | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerHacker NewsOn this pageHacker NewsHacker News (sometimes abbreviated as HN) is a social news


website focusing on computer science and entrepreneurship. It is run by the investment fund and startup
incubator Y Combinator. In general, content that can be submitted is defined as "anything that gratifies
one's intellectual curiosity."Installation and Setupâ€‹There isn't any special setup for it.Document Loaderâ€‹See a usage example.from langchain.document_loaders import HNLoaderPreviousGutenbergNextHazy ResearchInstallation and SetupDocument LoaderCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Prediction Guard | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerPrediction GuardOn this pagePrediction GuardThis page covers how to use the Prediction Guard ecosystem within LangChain.


It is broken into two parts: installation and setup, and then references to specific Prediction Guard wrappers.Installation and Setupâ€‹Install the Python SDK with pip install predictionguardGet an Prediction Guard access token (as described here) and set it as an environment variable (PREDICTIONGUARD_TOKEN)LLM Wrapperâ€‹There exists a Prediction Guard LLM wrapper, which you can access with from langchain.llms import PredictionGuardYou can provide the name of the Prediction Guard model as an argument when initializing the LLM:pgllm = PredictionGuard(model="MPT-7B-Instruct")You can also provide your access token directly as an argument:pgllm = PredictionGuard(model="MPT-7B-Instruct", token="<your access token>")Finally, you can provide an "output" argument that is used to structure/ control the output of the LLM:pgllm = PredictionGuard(model="MPT-7B-Instruct", output={"type": "boolean"})Example usageâ€‹Basic usage of the controlled or guarded LLM wrapper:import osimport predictionguard as pgfrom langchain.llms import PredictionGuardfrom langchain import PromptTemplate, LLMChain# Your Prediction Guard API key. Get one at predictionguard.comos.environ["PREDICTIONGUARD_TOKEN"] = "<your Prediction Guard access token>"# Define a prompt templatetemplate = """Respond to the following query based on the context.Context: EVERY comment, DM + email suggestion has led us to this EXCITING announcement! ğŸ�‰ We have officially added TWO new candle subscription box options! ğŸ“¦Exclusive Candle Box - $80 Monthly Candle Box - $45 (NEW!)Scent of The Month Box - $28 (NEW!)Head to stories to get ALLL the deets on each box! ğŸ‘† BONUS: Save 50%


the deets on each box! ğŸ‘† BONUS: Save 50% on your first box with code 50OFF! ğŸ�‰Query: {query}Result: """prompt = PromptTemplate(template=template, input_variables=["query"])# With "guarding" or controlling the output of the LLM. See the # Prediction Guard docs (https://docs.predictionguard.com) to learn how to # control the output with integer, float, boolean, JSON, and other types and# structures.pgllm = PredictionGuard(model="MPT-7B-Instruct",                         output={                                "type": "categorical",                                "categories": [                                    "product announcement",                                     "apology",                                     "relational"                                    ]


})pgllm(prompt.format(query="What kind of post is this?"))Basic LLM Chaining with the Prediction Guard wrapper:import osfrom langchain import PromptTemplate, LLMChainfrom langchain.llms import PredictionGuard# Optional, add your OpenAI API Key. This is optional, as Prediction Guard allows# you to access all the latest open access models (see https://docs.predictionguard.com)os.environ["OPENAI_API_KEY"] = "<your OpenAI api key>"# Your Prediction Guard API key. Get one at predictionguard.comos.environ["PREDICTIONGUARD_TOKEN"] = "<your Prediction Guard access token>"pgllm = PredictionGuard(model="OpenAI-text-davinci-003")template = """Question: {question}Answer: Let's think step by step."""prompt = PromptTemplate(template=template, input_variables=["question"])llm_chain = LLMChain(prompt=prompt, llm=pgllm, verbose=True)question = "What NFL team won the Super Bowl in the year Justin Beiber was born?"llm_chain.predict(question=question)PreviousPredibaseNextPromptLayerInstallation and SetupLLM WrapperExample usageCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Beam | ğŸ¦œï¸�ğŸ”— Langchain


Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesGrouped by providerWandB TracingAI21 LabsAimAirbyteAirtableAleph AlphaAlibaba Cloud OpensearchAmazon API GatewayAnalyticDBAnnoyAnyscaleApifyArangoDBArgillaArthurArxivAtlasDBAwaDBAWS S3 DirectoryAZLyricsAzure Blob StorageAzure Cognitive SearchAzure OpenAIBananaBasetenBeamBedrockBiliBiliBlackboardBrave SearchCassandraCerebriumAIChaindeskChromaClarifaiClearMLCnosDBCohereCollege ConfidentialCometConfluenceC TransformersDatabricksDatadog TracingDatadog LogsDataForSEODeepInfraDeep LakeDiffbotDiscordDocugamiDuckDBElasticsearchEverNoteFacebook ChatFigmaFlyteForefrontAIGitGitBookGoldenGoogle BigQueryGoogle Cloud StorageGoogle DriveGoogle SearchGoogle SerperGooseAIGPT4AllGraphsignalGrobidGutenbergHacker NewsHazy ResearchHeliconeHologresHugging FaceiFixitIMSDbInfinoJinaLanceDBLangChain Decorators âœ¨Llama.cppMarqoMediaWikiDumpMetalMicrosoft OneDriveMicrosoft PowerPointMicrosoft WordMilvusMLflow AI GatewayMLflowModalModelScopeModern TreasuryMomentoMotherduckMyScaleNLPCloudNotion DBObsidianOpenAIOpenLLMOpenSearchOpenWeatherMapPetalsPGVectorPineconePipelineAIPortkeyPredibasePrediction GuardPromptLayerPsychicQdrantRay ServeRebuffRedditRedisReplicateRoamRocksetRunhouseRWKV-4SageMaker EndpointSearxNG Search APISerpAPIShale


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerBeamOn this pageBeamThis page covers how to use Beam within LangChain.


It is broken into two parts: installation and setup, and then references to specific Beam wrappers.Installation and Setupâ€‹Create an accountInstall the Beam CLI with curl https://raw.githubusercontent.com/slai-labs/get-beam/main/get-beam.sh -sSfL | shRegister API keys with beam configureSet environment variables (BEAM_CLIENT_ID) and (BEAM_CLIENT_SECRET)Install the Beam SDK pip install beam-sdkWrappersâ€‹LLMâ€‹There exists a Beam LLM wrapper, which you can access withfrom langchain.llms.beam import BeamDefine your Beam app.â€‹This is the environment youâ€™ll be developing against once you start the app.
It's also used to define the maximum response length from the model.llm = Beam(model_name="gpt2",           name="langchain-gpt2-test",           cpu=8,           memory="32Gi",           gpu="A10G",           python_version="python3.8",           python_packages=[               "diffusers[torch]>=0.10",               "transformers",               "torch",               "pillow",               "accelerate",               "safetensors",               "xformers",],           max_length="50",           verbose=False)Deploy your Beam appâ€‹Once defined, you can deploy your Beam app by calling your model's _deploy() method.llm._deploy()Call your Beam appâ€‹Once a beam model is deployed, it can be called by callying your model's _call() method.


This returns the GPT2 text response to your prompt.response = llm._call("Running machine learning on a remote GPU")An example script which deploys the model and calls it would be:from langchain.llms.beam import Beamimport timellm = Beam(model_name="gpt2",           name="langchain-gpt2-test",           cpu=8,           memory="32Gi",           gpu="A10G",           python_version="python3.8",           python_packages=[               "diffusers[torch]>=0.10",               "transformers",               "torch",               "pillow",               "accelerate",               "safetensors",               "xformers",],           max_length="50",           verbose=False)llm._deploy()response = llm._call("Running machine learning on a remote GPU")print(response)PreviousBasetenNextBedrockInstallation and SetupWrappersLLMDefine your Beam app.Deploy your Beam appCall your Beam appCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


WhatsApp | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerWhatsAppOn this pageWhatsAppWhatsApp (also called WhatsApp Messenger) is a freeware, cross-platform, centralized instant messaging (IM) and voice-over-IP (VoIP) service. It allows users to send text and voice messages, make voice and video calls, and share images, documents, user locations, and other content.Installation and Setupâ€‹There isn't any special setup for it.Document Loaderâ€‹See a usage example.from langchain.document_loaders import WhatsAppChatLoaderPreviousWeaviateNextWhyLabsInstallation and SetupDocument LoaderCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Yeager.ai | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerYeager.aiOn this pageYeager.aiThis page covers how to use Yeager.ai to generate LangChain tools and agents.What is Yeager.ai?â€‹Yeager.ai is an ecosystem designed to simplify the process of creating AI agents and tools. It features yAgents, a No-code LangChain Agent Builder, which enables users to build, test, and deploy AI solutions with ease. Leveraging the LangChain framework, yAgents allows seamless integration with various language models and resources, making it suitable for developers, researchers, and AI enthusiasts across diverse applications.yAgentsâ€‹Low code generative agent designed to help you build, prototype, and deploy Langchain tools with ease. How to use?â€‹pip install yeagerai-agentyeagerai-agentGo to http://127.0.0.1:7860This will install the necessary dependencies and set up yAgents on your system. After the first run, yAgents will create a .env file where you can input your OpenAI API key. You can do the same directly from the Gradio interface under the tab "Settings".OPENAI_API_KEY=<your_openai_api_key_here>We recommend using GPT-4,. However, the tool can also work with GPT-3 if the problem is broken down sufficiently.Creating and Executing Tools with yAgentsâ€‹yAgents makes it easy to create and execute AI-powered tools. Here's a brief overview of the process:Create a


easy to create and execute AI-powered tools. Here's a brief overview of the process:Create a tool: To create a tool, provide a natural language prompt to yAgents. The prompt should clearly describe the tool's purpose and functionality. For example:


create a tool that returns the n-th prime numberLoad the tool into the toolkit: To load a tool into yAgents, simply provide a command to yAgents that says so. For example:
load the tool that you just created it into your toolkitExecute the tool: To run a tool or agent, simply provide a command to yAgents that includes the name of the tool and any required parameters. For example:
generate the 50th prime numberYou can see a video of how it works here.As you become more familiar with yAgents, you can create more advanced tools and agents to automate your work and enhance your productivity.For more information, see yAgents' Github or our docsPreviousWriterNextYouTubeWhat is Yeager.ai?yAgentsHow to use?Creating and Executing Tools with yAgentsCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


StochasticAI | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerStochasticAIOn this pageStochasticAIThis page covers how to use the StochasticAI ecosystem within LangChain.


It is broken into two parts: installation and setup, and then references to specific StochasticAI wrappers.Installation and Setupâ€‹Install with pip install stochasticxGet an StochasticAI api key and set it as an environment variable (STOCHASTICAI_API_KEY)Wrappersâ€‹LLMâ€‹There exists an StochasticAI LLM wrapper, which you can access with from langchain.llms import StochasticAIPreviousStarRocksNextStripeInstallation and SetupWrappersLLMCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


RWKV-4 | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerRWKV-4On this pageRWKV-4This page covers how to use the RWKV-4 wrapper within LangChain.


It is broken into two parts: installation and setup, and then usage with an example.Installation and Setupâ€‹Install the Python package with pip install rwkvInstall the tokenizer Python package with pip install tokenizerDownload a RWKV model and place it in your desired directoryDownload the tokens fileUsageâ€‹RWKVâ€‹To use the RWKV wrapper, you need to provide the path to the pre-trained model file and the tokenizer's configuration.from langchain.llms import RWKV# Test the model```pythondef generate_prompt(instruction, input=None):    if input:        return f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.# Instruction:{instruction}# Input:{input}# Response:"""    else:        return f"""Below is an instruction that describes a task. Write a response that appropriately completes the request.# Instruction:{instruction}# Response:"""model = RWKV(model="./models/RWKV-4-Raven-3B-v7-Eng-20230404-ctx4096.pth", strategy="cpu fp32", tokens_path="./rwkv/20B_tokenizer.json")response = model(generate_prompt("Once upon a time, "))Model Fileâ€‹You can find links to model file downloads at the RWKV-4-Raven repository.Rwkv-4 models -> recommended VRAMâ€‹RWKV VRAMModel | 8bit | bf16/fp16 | fp3214B   | 16GB | 28GB      | >50GB7B    | 8GB  | 14GB      | 28GB3B    | 2.8GB| 6GB       |


| 2.8GB| 6GB       | 12GB1b5   | 1.3GB| 3GB       | 6GBSee the rwkv pip page for more information about strategies, including streaming and cuda support.PreviousRunhouseNextSageMaker EndpointInstallation and SetupUsageRWKVModel FileRwkv-4 models -> recommended VRAMCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Argilla | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerArgillaOn this pageArgillaArgilla is an open-source data curation platform for LLMs.


Using Argilla, everyone can build robust language models through faster data curation
using both human and machine feedback. We provide support for each step in the MLOps cycle,
from data labeling to model monitoring.Installation and Setupâ€‹First, you'll need to install the  argilla Python package as follows:pip install argilla --upgradeIf you already have an Argilla Server running, then you're good to go; but if
you don't, follow the next steps to install it.If you don't you can refer to Argilla - ğŸš€ Quickstart to deploy Argilla either on HuggingFace Spaces, locally, or on a server.Trackingâ€‹See a usage example of ArgillaCallbackHandler.from langchain.callbacks import ArgillaCallbackHandlerPreviousArangoDBNextArthurInstallation and SetupTrackingCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Wikipedia | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerWikipediaOn this pageWikipediaWikipedia is a multilingual free online encyclopedia written and maintained by a community of volunteers, known as Wikipedians, through open collaboration and using a wiki-based editing system called MediaWiki. Wikipedia is the largest and most-read reference work in history.Installation and Setupâ€‹pip install wikipediaDocument Loaderâ€‹See a usage example.from langchain.document_loaders import WikipediaLoaderRetrieverâ€‹See a usage example.from langchain.retrievers import WikipediaRetrieverPreviousWhyLabsNextWolfram AlphaInstallation and SetupDocument LoaderRetrieverCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Grobid | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerGrobidOn this pageGrobidThis page covers how to use the Grobid to parse articles for LangChain.


It is separated into two parts: installation and running the serverInstallation and Setupâ€‹#Ensure You have Java installed
!apt-get install -y openjdk-11-jdk -q
!update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java#Clone and install the Grobid Repo
import os
!git clone https://github.com/kermitt2/grobid.git
os.environ["JAVA_HOME"] = "/usr/lib/jvm/java-11-openjdk-amd64"
os.chdir('grobid')
!./gradlew clean install#Run the server,
get_ipython().system_raw('nohup ./gradlew run > grobid.log 2>&1 &')You can now use the GrobidParser to produce documentsfrom langchain.document_loaders.parsers import GrobidParserfrom langchain.document_loaders.generic import GenericLoader#Produce chunks from article paragraphsloader = GenericLoader.from_filesystem(    "/Users/31treehaus/Desktop/Papers/",    glob="*",    suffixes=[".pdf"],    parser= GrobidParser(segment_sentences=False))docs = loader.load()#Produce chunks from article sentencesloader = GenericLoader.from_filesystem(    "/Users/31treehaus/Desktop/Papers/",    glob="*",    suffixes=[".pdf"],    parser= GrobidParser(segment_sentences=True))docs = loader.load()Chunk metadata will include bboxes although these are a bit funky to parse, see https://grobid.readthedocs.io/en/latest/Coordinates-in-PDF/PreviousGraphsignalNextGutenbergInstallation and SetupCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Predibase | ğŸ¦œï¸�ğŸ”— Langchain


Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesGrouped by providerWandB TracingAI21 LabsAimAirbyteAirtableAleph AlphaAlibaba Cloud OpensearchAmazon API GatewayAnalyticDBAnnoyAnyscaleApifyArangoDBArgillaArthurArxivAtlasDBAwaDBAWS S3 DirectoryAZLyricsAzure Blob StorageAzure Cognitive SearchAzure OpenAIBananaBasetenBeamBedrockBiliBiliBlackboardBrave SearchCassandraCerebriumAIChaindeskChromaClarifaiClearMLCnosDBCohereCollege ConfidentialCometConfluenceC TransformersDatabricksDatadog TracingDatadog LogsDataForSEODeepInfraDeep LakeDiffbotDiscordDocugamiDuckDBElasticsearchEverNoteFacebook ChatFigmaFlyteForefrontAIGitGitBookGoldenGoogle BigQueryGoogle Cloud StorageGoogle DriveGoogle SearchGoogle SerperGooseAIGPT4AllGraphsignalGrobidGutenbergHacker NewsHazy ResearchHeliconeHologresHugging FaceiFixitIMSDbInfinoJinaLanceDBLangChain Decorators âœ¨Llama.cppMarqoMediaWikiDumpMetalMicrosoft OneDriveMicrosoft PowerPointMicrosoft WordMilvusMLflow AI GatewayMLflowModalModelScopeModern TreasuryMomentoMotherduckMyScaleNLPCloudNotion DBObsidianOpenAIOpenLLMOpenSearchOpenWeatherMapPetalsPGVectorPineconePipelineAIPortkeyPredibasePrediction GuardPromptLayerPsychicQdrantRay ServeRebuffRedditRedisReplicateRoamRocksetRunhouseRWKV-4SageMaker EndpointSearxNG Search APISerpAPIShale


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerPredibaseOn this pagePredibaseLearn how to use LangChain with models on Predibase. Setupâ€‹Create a Predibase account and API key.Install the Predibase Python client with pip install predibaseUse your API key to authenticateLLMâ€‹Predibase integrates with LangChain by implementing LLM module. You can see a short example below or a full notebook under LLM > Integrations > Predibase. import osos.environ["PREDIBASE_API_TOKEN"] = "{PREDIBASE_API_TOKEN}"from langchain.llms import Predibasemodel =  Predibase(model = 'vicuna-13b', predibase_api_key=os.environ.get('PREDIBASE_API_TOKEN'))response = model("Can you recommend me a nice dry wine?")print(response)Previouslogging_tracing_portkeyNextPrediction GuardSetupLLMCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright Â© 2023 LangChain, Inc.


Ray Serve | ğŸ¦œï¸�ğŸ”— Langchain


EndpointSearxNG Search APISerpAPIShale ProtocolSingleStoreDBscikit-learnSlackspaCySpreedlyStarRocksStochasticAIStripeTairTelegramTigris2MarkdownTrelloTruLensTwitterTypesenseUnstructuredVectaraVespaWeights & BiasesWeatherWeaviateWhatsAppWhyLabsWikipediaWolfram AlphaWriterYeager.aiYouTubeZepZillizIntegrationsGrouped by providerRay ServeOn this pageRay ServeRay Serve is a scalable model serving library for building online inference APIs. Serve is particularly well suited for system composition, enabling you to build a complex inference service consisting of multiple chains and business logic all in Python code. Goal of this notebookâ€‹This notebook shows a simple example of how to deploy an OpenAI chain into production. You can extend it to deploy your own self-hosted models where you can easily define amount of hardware resources (GPUs and CPUs) needed to run your model in production efficiently. Read more about available options including autoscaling in the Ray Serve documentation.Setup Ray Serveâ€‹Install ray with pip install ray[serve]. General Skeletonâ€‹The general skeleton for deploying a service is the following:# 0: Import ray serve and request from starlettefrom ray import servefrom starlette.requests import Request# 1: Define a Ray Serve deployment.@serve.deploymentclass LLMServe:    def __init__(self) -> None:        # All the initialization code goes here        pass    async def __call__(self, request: Request) -> str:        # You can parse the request here        # and return a response        return "Hello World"# 2: Bind the model to deploymentdeployment = LLMServe.bind()# 3: Run