id stringlengths 14 15 | text stringlengths 17 2.72k | source stringlengths 47 115 |
|---|---|---|
4c0d27e9caef-0 | GPT4All
GitHub:nomic-ai/gpt4all an ecosystem of open-source chatbots trained on a massive collections of clean assistant data including code, stories and dialogue.
This example goes over how to use LangChain to interact with GPT4All models.
%pip install gpt4all > /dev/null
Note: you may need to restart the kernel to us... | https://python.langchain.com/docs/integrations/llms/gpt4all.html |
6e16ed72272b-0 | This example shows how one can track the following while calling OpenAI models via LangChain and Infino:
# Set your key here.
# os.environ["OPENAI_API_KEY"] = "YOUR_API_KEY"
# Create callback handler. This logs latency, errors, token usage, prompts as well as prompt responses to Infino.
handler = InfinoCallbackHandler... | https://python.langchain.com/docs/integrations/callbacks/infino.html |
6e16ed72272b-1 | # We send the question to OpenAI API, with Infino callback.
llm_result = llm.generate([question], callbacks=[handler])
print(llm_result)
In what country is Normandy located?
generations=[[Generation(text='\n\nNormandy is located in France.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'to... | https://python.langchain.com/docs/integrations/callbacks/infino.html |
6e16ed72272b-2 | Who was the Norse leader?
generations=[[Generation(text='\n\nThe most famous Norse leader was the legendary Viking king Ragnar Lodbrok. He is believed to have lived in the 9th century and is renowned for his exploits in England and France.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'to... | https://python.langchain.com/docs/integrations/callbacks/infino.html |
6e16ed72272b-3 | What is France a region of?
generations=[[Generation(text='\n\nFrance is a region of Europe.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 16, 'completion_tokens': 9, 'prompt_tokens': 7}, 'model_name': 'text-davinci-003'} run=RunInfo(run_id=UUID('6943880b-b... | https://python.langchain.com/docs/integrations/callbacks/infino.html |
6e16ed72272b-4 | Who was the duke in the battle of Hastings?
generations=[[Generation(text='\n\nThe Duke of Normandy, William the Conqueror, was the leader of the Norman forces at the Battle of Hastings in 1066.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 39, 'completion_... | https://python.langchain.com/docs/integrations/callbacks/infino.html |
6e16ed72272b-5 | # Extract x and y values from the data
timestamps = [item["time"] for item in data]
dates = [dt.datetime.fromtimestamp(ts) for ts in timestamps]
y = [item["value"] for item in data]
plt.rcParams["figure.figsize"] = [6, 4]
plt.subplots_adjust(bottom=0.2)
plt.xticks(rotation=25)
ax = plt.gca()
xfmt = md.DateFormatter("%... | https://python.langchain.com/docs/integrations/callbacks/infino.html |
dd125dadb684-0 | Jina
Let's load the Jina Embedding class.
from langchain.embeddings import JinaEmbeddings
embeddings = JinaEmbeddings(
jina_auth_token=jina_auth_token, model_name="ViT-B-32::openai"
)
text = "This is a test document."
query_result = embeddings.embed_query(text)
doc_result = embeddings.embed_documents([text])
In the abo... | https://python.langchain.com/docs/integrations/text_embedding/jina.html |
4f608164445d-0 | This notebook shows how to use functionality related to the LanceDB vector database based on the Lance data format.
We want to use OpenAIEmbeddings so we have to get the OpenAI API Key.
import lancedb
db = lancedb.connect("/tmp/lancedb")
table = db.create_table(
"my_table",
data=[
{
"vector": embeddings.embed_query("... | https://python.langchain.com/docs/integrations/vectorstores/lancedb.html |
4f608164445d-1 | I ask Democrats and Republicans alike: Pass my budget and keep our neighborhoods safe.
And I will keep doing everything in my power to crack down on gun trafficking and ghost guns you can buy online and make at home—they have no serial numbers and can’t be traced.
And I ask Congress to pass proven measures to reduc... | https://python.langchain.com/docs/integrations/vectorstores/lancedb.html |
4f608164445d-2 | We’ve set up joint patrols with Mexico and Guatemala to catch more human traffickers.
We’re putting in place dedicated immigration judges so families fleeing persecution and violence can have their cases heard faster. | https://python.langchain.com/docs/integrations/vectorstores/lancedb.html |
942409fd9239-0 | Llama.cpp
llama-cpp-python is a Python binding for llama.cpp.
It supports inference for many LLMs, which can be accessed on HuggingFace.
This notebook goes over how to run llama-cpp-python within LangChain.
Note: new versions of llama-cpp-python use GGUF model files (see here).
This is a breaking change.
To convert ex... | https://python.langchain.com/docs/integrations/llms/llamacpp.html |
942409fd9239-1 | CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1 pip install --upgrade --force-reinstall llama-cpp-python --no-cache-dir
Installation with Windows
It is stable to install the llama-cpp-python library by compiling from the source. You can follow most of the instructions in the repository itself but there are some windows sp... | https://python.langchain.com/docs/integrations/llms/llamacpp.html |
942409fd9239-2 | Answer: Let's work this out in a step by step way to be sure we have the right answer."""
prompt = PromptTemplate(template=template, input_variables=["question"])
# Callbacks support token-wise streaming
callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
CPU
Example using a LLaMA 2 7B model
# Make... | https://python.langchain.com/docs/integrations/llms/llamacpp.html |
942409fd9239-3 | llama_print_timings: load time = 358.60 ms
llama_print_timings: sample time = 172.55 ms / 256 runs ( 0.67 ms per token, 1483.59 tokens per second)
llama_print_timings: prompt eval time = 613.36 ms / 16 tokens ( 38.33 ms per token, 26.09 tokens per second)
llama_print_timings: eval time = 10151.17 ms / 255 runs ( 39.81 ... | https://python.langchain.com/docs/integrations/llms/llamacpp.html |
942409fd9239-4 | 1. First, find out when Justin Bieber was born.
2. We know that Justin Bieber was born on March 1, 1994.
3. Next, we need to look up when the Super Bowl was played in that year.
4. The Super Bowl was played on January 28, 1995.
5. Finally, we can use this information to answer the question. The NFL team that won the Su... | https://python.langchain.com/docs/integrations/llms/llamacpp.html |
942409fd9239-5 | # Make sure the model path is correct for your system!
llm = LlamaCpp(
model_path="/Users/rlm/Desktop/Code/llama.cpp/models/openorca-platypus2-13b.gguf.q4_0.bin",
n_gpu_layers=n_gpu_layers,
n_batch=n_batch,
callback_manager=callback_manager,
verbose=True, # Verbose is required to pass to the callback manager
)
llm_chai... | https://python.langchain.com/docs/integrations/llms/llamacpp.html |
942409fd9239-6 | "\n\n1. Identify Justin Bieber's birth date: Justin Bieber was born on March 1, 1994.\n\n2. Find the Super Bowl winner of that year: The NFL season of 1993 with the Super Bowl being played in January or of 1994.\n\n3. Determine which team won the game: The Dallas Cowboys faced the Buffalo Bills in Super Bowl XXVII on J... | https://python.langchain.com/docs/integrations/llms/llamacpp.html |
942409fd9239-7 | ggml_metal_init: allocating
ggml_metal_init: using MPS
...
You also could check Activity Monitor by watching the GPU usage of the process, the CPU usage will drop dramatically after turn on n_gpu_layers=1.
For the first call to the LLM, the performance may be slow due to the model compilation in Metal GPU.
Grammars
W... | https://python.langchain.com/docs/integrations/llms/llamacpp.html |
942409fd9239-8 | llama_print_timings: load time = 357.51 ms
llama_print_timings: sample time = 1213.30 ms / 144 runs ( 8.43 ms per token, 118.68 tokens per second)
llama_print_timings: prompt eval time = 356.78 ms / 9 tokens ( 39.64 ms per token, 25.23 tokens per second)
llama_print_timings: eval time = 3947.16 ms / 143 runs ( 27.60 ms... | https://python.langchain.com/docs/integrations/llms/llamacpp.html |
e8f4185592b7-0 | Marqo
This notebook shows how to use functionality related to the Marqo vectorstore.
Marqo is an open-source vector search engine. Marqo allows you to store and query multimodal data such as text and images. Marqo creates the vectors for you using a huge selection of opensource models, you can also provide your own fin... | https://python.langchain.com/docs/integrations/vectorstores/marqo.html |
e8f4185592b7-1 | Tonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service.
One of the most serious constitutional responsibilities a President ... | https://python.langchain.com/docs/integrations/vectorstores/marqo.html |
e8f4185592b7-2 | # incase the demo is re-run
try:
client.delete_index(index_name)
except Exception:
print(f"Creating {index_name}")
# This index could have been created by another system
settings = {"treat_urls_and_pointers_as_images": True, "model": "ViT-L/14"}
client.create_index(index_name, **settings)
client.index(index_name).add_... | https://python.langchain.com/docs/integrations/vectorstores/marqo.html |
e8f4185592b7-3 | # This index could have been created by another system
client.create_index(index_name)
client.index(index_name).add_documents(
[
{
"Title": "Smartphone",
"Description": "A smartphone is a portable computer device that combines mobile telephone "
"functions and computing functions into one unit.",
},
{
"Title": "Telepho... | https://python.langchain.com/docs/integrations/vectorstores/marqo.html |
e8f4185592b7-4 | print(doc_results[0].page_content)
This is a document that is about elephants
Weighted Queries
We also expose marqos weighted queries which are a powerful way to compose complex semantic searches.
query = {"communications devices": 1.0}
doc_results = docsearch.similarity_search(query)
print(doc_results[0].page_content... | https://python.langchain.com/docs/integrations/vectorstores/marqo.html |
d051e6cf211c-0 | Llama-cpp
This notebook goes over how to use Llama-cpp embeddings within LangChain
pip install llama-cpp-python
from langchain.embeddings import LlamaCppEmbeddings
llama = LlamaCppEmbeddings(model_path="/path/to/model/ggml-model-q4_0.bin")
text = "This is a test document."
query_result = llama.embed_query(text)
doc_res... | https://python.langchain.com/docs/integrations/text_embedding/llamacpp.html |
6a46a93df997-0 | This notebook shows how to use functionality related to the Weaviatevector database.
We want to use OpenAIEmbeddings so we have to get the OpenAI API Key.
Weaviate instances have authentication enabled by default. You can use either a username/password combination or API key.
Sometimes we might want to perform the sea... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-1 | (Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d like to honor someone who has dedicated his life to serve this country: Justic... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-2 | -0.0008389079, 0.0053696632, -0.0024644958, -0.016582303, 0.0066720927, -0.005036711, -0.035514854, 0.002942706, 0.02958701, 0.032825127, 0.015694432, -0.019846536, -0.024520919, -0.021974817, -0.0063293483, -0.01081114, -0.0084282495, 0.003025944, -0.010210521, 0.008780787, 0.014793505, -0.006486031, 0.011966679, 0.01... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-3 | 0.0046482678, 0.0023241339, -0.005826656, 0.0072531262, 0.015498579, -0.0077819317, -0.011953622, -0.028934162, -0.033974137, -0.01574666, 0.0086306315, -0.029299757, 0.030213742, -0.0033148287, 0.013448641, -0.013474754, 0.015851116, 0.0076578907, -0.037421167, -0.015185213, 0.010719741, -0.014636821, 0.0001918757, 0.... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-4 | -0.01340947, 0.00091643346, 0.014884903, -0.02314994, -0.024468692, 0.0004859627, 0.018828096, 0.012906778, 0.027941836, 0.027550127, -0.015028529, 0.018606128, 0.03449641, -0.017757427, -0.016020855, -0.012142947, 0.025304336, 0.00821281, -0.0025461016, -0.01902395, -0.635507, -0.030083172, 0.0177052, -0.0104912445, 0... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-5 | -0.01298512, -0.0015350056, 0.009982024, -0.024207553, -0.003332782, 0.006283649, 0.01868447, -0.010732798, -0.00876773, -0.0075273216, -0.016530076, 0.018175248, 0.016020855, -0.00067284, 0.013461698, -0.0065904865, -0.017809656, -0.014741276, 0.016582303, -0.0088526, 0.0046482678, 0.037473395, -0.02237958, 0.01011259... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-6 | 0.0011832844, 0.0065023527, -0.027053965, 0.009198609, 0.022079272, -0.027785152, 0.005846241, 0.013500868, 0.016699815, 0.010445545, -0.025265165, -0.004396922, 0.0076774764, 0.014597651, -0.009851455, -0.03637661, 0.0004745379, -0.010112594, -0.009205136, 0.01578583, 0.015211326, -0.0011653311, -0.0015847852, 0.01489... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-7 | 0.029482553, -0.0046547963, -0.015955571, -0.018397218, -0.0102431625, 0.020577725, 0.016190596, -0.02038187, 0.030030945, -0.01115062, 0.0032560725, -0.014819618, 0.005647123, -0.0032560725, 0.0038909658, 0.013311543, 0.024285894, -0.0045699263, -0.010112594, 0.009237779, 0.008728559, 0.0423828, 0.010909067, 0.0422522... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-8 | 0.02966535, 0.006495824, 0.0011008625, -0.00024318536, -0.007011573, -0.002746852, -0.004298995, 0.007710119, 0.03407859, -0.008898299, -0.008565348, 0.030527107, -0.0003027576, 0.025082368, 0.0405026, 0.03867463, 0.0014117807, -0.024076983, 0.003933401, -0.009812284, 0.00829768, -0.0074293944, 0.0061530797, -0.0166475... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-9 | -0.021504767, -0.012834964, 0.009009283, -0.0029198565, -0.014349569, -0.020434098, 0.009838398, -0.005993132, -0.013618381, -0.031597774, -0.019206747, 0.00086583785, 0.15835446, 0.033765227, 0.00893747, 0.015119928, -0.019128405, 0.0079582, -0.026270548, -0.015877228, 0.014153715, -0.011960151, 0.007853745, 0.0069724... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-10 | -0.007031158, 0.015825002, -0.013076518, 0.00736411, -0.00075689406, 0.0076578907, -0.019337315, -0.0024187965, -0.0110331075, -0.01187528, 0.0013048771, 0.0009711094, -0.027863493, -0.020616895, -0.0024481746, -0.0040802914, 0.014571536, -0.012306159, -0.037630077, 0.012652168, 0.009068039, -0.0018263385, 0.0371078, -... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-11 | 0.017561574, -0.024847344, 0.04115545, -0.00036457402, -0.0061400225, 0.013037347, -0.005480647, 0.005947433, 0.020799693, 0.014702106, 0.03272067, 0.026701428, -0.015550806, -0.036193814, -0.021126116, -0.005412098, -0.013076518, 0.027080078, 0.012900249, -0.0073379963, -0.015119928, -0.019781252, 0.0062346854, -0.032... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-12 | 0.00372449, 0.022914914, -0.0018981516, 0.031545546, -0.01051083, 0.013801178, -0.006296706, -0.00025052988, -0.01795328, -0.026296662, 0.0017659501, 0.021883417, 0.0028937424, 0.00495837, -0.011888337, -0.008950527, -0.012058077, 0.020316586, 0.00804307, -0.0068483613, -0.0038387382, 0.019715967, -0.025069311, -0.0007... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-13 | 0.02796795, -0.039118566, 0.0023975791, -0.010608757, 0.00093438674, 0.0017382042, -0.02047327, 0.026283605, -0.020799693, 0.005947433, -0.014349569, 0.009890626, -0.022719061, -0.017248206, 0.0042565595, 0.022327352, -0.015681375, -0.013840348, 6.502964e-05, 0.015485522, -0.002678303, -0.0047984226, -0.012182118, -0.0... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-14 | 0.000769951, -0.002312709, -0.025095424, -0.010621814, 0.013207087, 0.013944804, -0.0070899143, -0.022183727, -0.0028088724, -0.011424815, 0.026087752, -0.0058625625, -0.020186016, -0.010217049, 0.015315781, -0.012580355, 0.01374895, 0.004948577, -0.0021854038, 0.023215225, 0.00207442, 0.029639237, 0.01391869, -0.01581... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-15 | -0.015106871, -0.03225062, -0.010073422, 0.007285768, 0.0056079524, -0.009002754, -0.014362626, 0.010909067, 0.009779641, -0.02796795, 0.013246258, 0.025474075, -0.001247753, 0.02442952, 0.012802322, -0.032276735, 0.0029802448, 0.014179829, 0.010321504, 0.0053337566, -0.017156808, -0.010439017, 0.034444187, -0.01039331... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-16 | -0.015028529, 0.0097469995, 0.016281994, 0.0047135525, -0.011294246, 0.011477043, 0.015485522, 0.03426139, 0.014323455, 0.011052692, -0.008362965, -0.037969556, -0.00252162, -0.013709779, -0.0030292084, -0.016569246, -0.013879519, 0.0011849166, -0.0016925049, 0.009753528, 0.008349908, -0.008245452, 0.033007924, -0.0035... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-17 | 0.0058233915, -0.0056405943, -0.009381405, 0.0064044255, 0.013905633, -0.011228961, -0.0013481282, -0.014023146, 0.00016239559, -0.0051901303, 0.0025265163, 0.023619989, -0.021517823, 0.024703717, -0.025643816, 0.040189236, 0.016295051, -0.0040411204, -0.0113595305, 0.0029981981, -0.015589978, 0.026479458, 0.0067439056... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-18 | -0.004638475, -0.012495484, 0.022836573, -0.022719061, -0.031284407, -0.022405695, -0.017352663, 0.021113059, -0.03494035, 0.002772966, 0.025643816, -0.0064240107, -0.009897154, 0.0020711557, -0.16409951, 0.009688243, 0.010393318, 0.0033262535, 0.011059221, -0.012919835, 0.0014493194, -0.021857304, -0.0075730206, -0.00... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-19 | -0.011424815, 0.007181313, 0.017600743, -0.0030226798, -0.014192886, 0.0128937205, -0.009975496, 0.0051444313, -0.0044654706, -0.008826486, 0.004158633, 0.004971427, -0.017835768, 0.025017083, -0.021792019, 0.013657551, -0.01872364, 0.009100681, -0.0079582, -0.011640254, -0.01093518, -0.0147543335, -0.005000805, 0.0234... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-20 | 0.013305014, -0.007690533, 0.058808424, -0.0016859764, -0.0044622063, -0.0037734534, 0.01578583, -0.0018459238, -0.1196015, -0.0007075225, 0.0030341048, 0.012306159, -0.0068483613, 0.01851473, 0.015315781, 0.031388864, -0.015563863, 0.04776226, -0.008199753, -0.02591801, 0.00546759, -0.004915935, 0.0050824108, 0.002701... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-21 | -0.033060152, 0.011248547, -0.0019797573, -0.007181313, 0.0018867267, 0.0070899143, 0.004077027, 0.0055328747, -0.014245113, -0.021217514, -0.006750434, -0.038230695, 0.013233202, 0.014219, -0.017692143, 0.024742888, -0.008833014, -0.00753385, -0.026923396, -0.0021527617, 0.013135274, -0.018070793, -0.013500868, -0.001... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-22 | 0.0010535312, -0.017940223, 0.0012159267, -0.011065749, 0.008258509, -0.018527785, -0.022797402, 0.012377972, -0.002087477, 0.010791554, 0.022288183, 0.0048604426, -0.032590102, 0.013709779, 0.004922463, 0.020055447, -0.0150677, -0.0057222005, -0.036246043, 0.0021364405, 0.021387255, -0.013435584, 0.010732798, 0.007553... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-23 | 0.0062640635, -0.016242823, -0.0007785196, -0.0007213955, 0.018971723, 0.021687564, 0.0039464575, -0.01574666, 0.011783881, -0.0019797573, -0.013383356, -0.002706049, 0.0037734534, 0.020394927, -0.00021931567, 0.0041814824, 0.025121538, -0.036246043, -0.019428715, -0.023802789, 0.014845733, 0.015420238, 0.019650683, 0.... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-24 | 0.00025726235, 0.008016956, -0.0042565595, 0.008447835, 0.0038191527, -0.014702106, 0.02196176, 0.0052097156, -0.010869896, 0.0051640165, 0.030840475, -0.041468814, 0.009250836, -0.018997835, 0.020107675, 0.008421721, -0.016373392, 0.004602568, 0.0327729, -0.00812794, 0.001581521, 0.019350372, 0.016112253, 0.02132197, ... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
6a46a93df997-25 | 0.8154189703772676)
Anything uploaded to weaviate is automatically persistent into the database. You do not need to call any specific method or pass any param for this to happen.
In addition to using similarity search in the retriever object, you can also use mmr.
This section goes over how to do question-answering wit... | https://python.langchain.com/docs/integrations/vectorstores/weaviate.html |
7cf27979b8ef-0 | Microsoft OneDrive
Microsoft OneDrive (formerly SkyDrive) is a file hosting service operated by Microsoft.
This notebook covers how to load documents from OneDrive. Currently, only docx, doc, and pdf files are supported.
Prerequisites
Register an application with the Microsoft identity platform instructions.
When regi... | https://python.langchain.com/docs/integrations/document_loaders/microsoft_onedrive.html |
7cf27979b8ef-1 | os.environ['O365_CLIENT_SECRET'] = "YOUR CLIENT SECRET"
This loader uses an authentication called on behalf of a user. It is a 2 step authentication with user consent. When you instantiate the loader, it will call will print a url that the user must visit to give consent to the app on the required permissions. The user... | https://python.langchain.com/docs/integrations/document_loaders/microsoft_onedrive.html |
7cf27979b8ef-2 | loader = OneDriveLoader(drive_id="YOUR DRIVE ID")
Once the authentication has been done, the loader will store a token (o365_token.txt) at ~/.credentials/ folder. This token could be used later to authenticate without the copy/paste steps explained earlier. To use this token for authentication, you need to change the a... | https://python.langchain.com/docs/integrations/document_loaders/microsoft_onedrive.html |
37db0a21ec16-0 | Wolfram Alpha
This notebook goes over how to use the wolfram alpha component.
First, you need to set up your Wolfram Alpha developer account and get your APP ID:
Go to wolfram alpha and sign up for a developer account here
Create an app and get your APP ID
pip install wolframalpha
Then we will need to set some environm... | https://python.langchain.com/docs/integrations/tools/wolfram_alpha.html |
7de5702ca3f7-0 | Page Not Found
We 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. | https://python.langchain.com/docs/integrations/modules/models/llms/integrations/xinference.ipynb |
56225e5700f1-0 | Page Not Found
We 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. | https://python.langchain.com/docs/integrations/modules/data_connection/text_embedding/integrations/xinference.ipynb |
26195c1bdb32-0 | Zilliz
Zilliz Cloud is a fully managed service on cloud for LF AI Milvus®,
This notebook shows how to use functionality related to the Zilliz Cloud managed vector database.
To run, you should have a Zilliz Cloud instance up and running. Here are the installation instructions
We want to use OpenAIEmbeddings so we have t... | https://python.langchain.com/docs/integrations/vectorstores/zilliz.html |
26195c1bdb32-1 | embeddings = OpenAIEmbeddings()
vector_db = Milvus.from_documents(
docs,
embeddings,
connection_args={
"uri": ZILLIZ_CLOUD_URI,
"user": ZILLIZ_CLOUD_USERNAME,
"password": ZILLIZ_CLOUD_PASSWORD,
# "token": ZILLIZ_CLOUD_API_KEY, # API key, for serverless clusters which can be used as replacements for user and password
"s... | https://python.langchain.com/docs/integrations/vectorstores/zilliz.html |
96df077506e6-0 | Spreedly
Spreedly is a service that allows you to securely store credit cards and use them to transact against any number of payment gateways and third party APIs. It does this by simultaneously providing a card tokenization/vault service as well as a gateway and receiver integration service. Payment methods tokenized ... | https://python.langchain.com/docs/integrations/document_loaders/spreedly.html |
96df077506e6-1 | index = VectorstoreIndexCreator().from_loaders([spreedly_loader])
spreedly_doc_retriever = index.vectorstore.as_retriever()
Using embedded DuckDB without persistence: data will be transient
# Test the retriever
spreedly_doc_retriever.get_relevant_documents("CRC")
[Document(page_content='installment_grace_period_duratio... | https://python.langchain.com/docs/integrations/document_loaders/spreedly.html |
96df077506e6-2 | Document(page_content='BG\nBH\nBI\nBJ\nBM\nBN\nBO\nBR\nBS\nBT\nBW\nBY\nBZ\nCA\nCC\nCF\nCH\nCK\nCL\nCM\nCN\nCO\nCR\nCV\nCX\nCY\nCZ\nDE\nDJ\nDK\nDO\nDZ\nEC\nEE\nEG\nEH\nES\nET\nFI\nFJ\nFK\nFM\nFO\nFR\nGA\nGB\nGD\nGE\nGF\nGG\nGH\nGI\nGL\nGM\nGN\nGP\nGQ\nGR\nGT\nGU\nGW\nGY\nHK\nHM\nHN\nHR\nHT\nHU\nID\nIE\nIL\nIM\nIN\nIO\nI... | https://python.langchain.com/docs/integrations/document_loaders/spreedly.html |
96df077506e6-3 | WorldPay', metadata={'source': 'https://core.spreedly.com/v1/gateways_options.json'}), | https://python.langchain.com/docs/integrations/document_loaders/spreedly.html |
96df077506e6-4 | Document(page_content='gateway_specific_fields: receipt_email\nradar_session_id\nskip_radar_rules\napplication_fee\nstripe_account\nmetadata\nidempotency_key\nreason\nrefund_application_fee\nrefund_fee_amount\nreverse_transfer\naccount_id\ncustomer_id\nvalidate\nmake_default\ncancellation_reason\ncapture_method\nconfir... | https://python.langchain.com/docs/integrations/document_loaders/spreedly.html |
96df077506e6-5 | Document(page_content='mdd_field_57\nmdd_field_58\nmdd_field_59\nmdd_field_60\nmdd_field_61\nmdd_field_62\nmdd_field_63\nmdd_field_64\nmdd_field_65\nmdd_field_66\nmdd_field_67\nmdd_field_68\nmdd_field_69\nmdd_field_70\nmdd_field_71\nmdd_field_72\nmdd_field_73\nmdd_field_74\nmdd_field_75\nmdd_field_76\nmdd_field_77\nmdd... | https://python.langchain.com/docs/integrations/document_loaders/spreedly.html |
f2a2f4cc04ec-0 | This notebook covers how to load data from the Stripe REST API into a format that can be ingested into LangChain, along with example usage for vectorization.
The Stripe API requires an access token, which can be found inside of the Stripe dashboard.
This document loader also requires a resource option which defines wha... | https://python.langchain.com/docs/integrations/document_loaders/stripe.html |
2e6d724da170-0 | Tair
Tair is a cloud native in-memory database service developed by Alibaba Cloud. It provides rich data models and enterprise-grade capabilities to support your real-time online scenarios while maintaining full compatibility with open source Redis. Tair also introduces persistent memory-optimized instances that are ba... | https://python.langchain.com/docs/integrations/vectorstores/tair.html |
2e6d724da170-1 | RuntimeError: Error loading ../../../state_of_the_union.txt
Connect to Tair using the TAIR_URL environment variable
export TAIR_URL="redis://{username}:{password}@{tair_address}:{tair_port}"
or the keyword argument tair_url.
Then store documents and embeddings into Tair.
tair_url = "redis://localhost:6379"
# drop fir... | https://python.langchain.com/docs/integrations/vectorstores/tair.html |
2e6d724da170-2 | vector_store = Tair.from_documents(docs, embeddings, tair_url=tair_url, index_params={"lexical_algorithm":"bm25"})
Tair Hybrid Search
query = "What did the president say about Ketanji Brown Jackson"
# hybrid_ratio: 0.5 hybrid search, 0.9999 vector search, 0.0001 text search
kwargs = {"TEXT" : query, "hybrid_ratio" : 0.... | https://python.langchain.com/docs/integrations/vectorstores/tair.html |
3f0854d1e778-0 | Tencent Cloud VectorDB
Tencent Cloud VectorDB is a fully managed, self-developed, enterprise-level distributed database service designed for storing, retrieving, and analyzing multi-dimensional vector data. The database supports multiple index types and similarity calculation methods. A single index can support a vecto... | https://python.langchain.com/docs/integrations/vectorstores/tencentvectordb.html |
0bc2eda5deb7-0 | Telegram
Telegram 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.
This notebook covers how to load data from ... | https://python.langchain.com/docs/integrations/document_loaders/telegram.html |
db1e1a4d1903-0 | Trello
Trello is a web-based project management and collaboration tool that allows individuals and teams to organize and track their tasks and projects. It provides a visual interface known as a "board" where users can create lists and cards to represent their tasks and activities.
The TrelloLoader allows you to load c... | https://python.langchain.com/docs/integrations/document_loaders/trello.html |
db1e1a4d1903-1 | print(documents[0].page_content)
print(documents[0].metadata)
Review Tech partner pages
Comments:
{'title': 'Review Tech partner pages', 'id': '6475357890dc8d17f73f2dcc', 'url': 'https://trello.com/c/b0OTZwkZ/1-review-tech-partner-pages', 'labels': ['Demand Marketing'], 'list': 'Done', 'closed': False, 'due_date': ''}
... | https://python.langchain.com/docs/integrations/document_loaders/trello.html |
c8c795b27ad9-0 | 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.
def get_github_docs(repo_owner, repo_name):
with tempfile.TemporaryDirectory() as d:
subprocess.check_call(
f"git clone --depth 1 https://github.com/{r... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_text_generation |
c8c795b27ad9-1 | 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)
Now that we have the documentation content in chunks, let's put all this information in a vector index for easy r... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_text_generation |
c8c795b27ad9-2 | [{'text': '\n\nWhen it comes to running Deno CLI tasks, environment variables can be a powerful tool for customizing the behavior of your tasks. With the Deno Task Definition interface, you can easily configure environment variables to be set when executing your tasks.\n\nThe Deno Task Definition interface is configure... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_text_generation |
c8c795b27ad9-3 | '\n\nEnvironment variables are a powerful tool for developers, allowing them to store and access data without hard-coding it into their applications. Deno, the secure JavaScript and TypeScript runtime, offers built-in support for environment variables with the `Deno.env` API.\n\nUsing `Deno.env` is simple. It has gette... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_text_generation |
b8c0e39964b9-0 | This notebook is based on the chat_vector_db notebook, but using Vectara as the vector database.
import os
from langchain.vectorstores import Vectara
from langchain.vectorstores.vectara import VectaraRetriever
from langchain.llms import OpenAI
from langchain.chains import ConversationalRetrievalChain
Load in documents.... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_chat |
b8c0e39964b9-1 | qa = ConversationalRetrievalChain.from_llm(llm, retriever, memory=memory)
query = "What did the president say about Ketanji Brown Jackson"
result = qa({"question": query})
" The president said that Ketanji Brown Jackson is one of the nation's top legal minds and a former top litigator in private practice, and that she ... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_chat |
b8c0e39964b9-2 | result["source_documents"][0]
Document(page_content='Justice Breyer, thank you for your service. One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji B... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_chat |
b8c0e39964b9-3 | chain = ConversationalRetrievalChain(
retriever=vectorstore.as_retriever(),
question_generator=question_generator,
combine_docs_chain=doc_chain,
)
chat_history = []
query = "What did the president say about Ketanji Brown Jackson"
result = chain({"question": query, "chat_history": chat_history})
" The president said tha... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_chat |
b8c0e39964b9-4 | question_generator = LLMChain(llm=llm, 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 ... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_chat |
c69838be90d9-0 | This notebook is based on the chat_vector_db notebook, but using Vectara as the vector database.
import os
from langchain.vectorstores import Vectara
from langchain.vectorstores.vectara import VectaraRetriever
from langchain.llms import OpenAI
from langchain.chains import ConversationalRetrievalChain
Load in documents.... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_chat.html |
c69838be90d9-1 | qa = ConversationalRetrievalChain.from_llm(llm, retriever, memory=memory)
query = "What did the president say about Ketanji Brown Jackson"
result = qa({"question": query})
" The president said that Ketanji Brown Jackson is one of the nation's top legal minds and a former top litigator in private practice, and that she ... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_chat.html |
c69838be90d9-2 | result["source_documents"][0]
Document(page_content='Justice Breyer, thank you for your service. One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji B... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_chat.html |
c69838be90d9-3 | chain = ConversationalRetrievalChain(
retriever=vectorstore.as_retriever(),
question_generator=question_generator,
combine_docs_chain=doc_chain,
)
chat_history = []
query = "What did the president say about Ketanji Brown Jackson"
result = chain({"question": query, "chat_history": chat_history})
" The president said tha... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_chat.html |
c69838be90d9-4 | question_generator = LLMChain(llm=llm, 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 ... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_chat.html |
55ecca71a3f1-0 | 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.
def get_github_docs(repo_owner, repo_name):
with tempfile.TemporaryDirectory() as d:
subprocess.check_call(
f"git clone --depth 1 https://github.com/{r... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_text_generation.html |
55ecca71a3f1-1 | 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)
Now that we have the documentation content in chunks, let's put all this information in a vector index for easy r... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_text_generation.html |
55ecca71a3f1-2 | [{'text': '\n\nWhen it comes to running Deno CLI tasks, environment variables can be a powerful tool for customizing the behavior of your tasks. With the Deno Task Definition interface, you can easily configure environment variables to be set when executing your tasks.\n\nThe Deno Task Definition interface is configure... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_text_generation.html |
55ecca71a3f1-3 | '\n\nEnvironment variables are a powerful tool for developers, allowing them to store and access data without hard-coding it into their applications. Deno, the secure JavaScript and TypeScript runtime, offers built-in support for environment variables with the `Deno.env` API.\n\nUsing `Deno.env` is simple. It has gette... | https://python.langchain.com/docs/integrations/providers/vectara/vectara_text_generation.html |
9fa683f1ae00-0 | logging_tracing_portkey
Log, Trace, and Monitor Langchain LLM Calls
When building apps or agents using Langchain, you end up making multiple API calls to fulfill a single user request. However, these requests are not chained when you want to analyse them. With Portkey, all the embeddings, completion, and other requests... | https://python.langchain.com/docs/integrations/providers/portkey/logging_tracing_portkey |
9fa683f1ae00-1 | # Let's test it out!
agent.run(
"What was the high temperature in SF yesterday in Fahrenheit? What is that number raised to the .023 power?"
)
How Logging & Tracing Works on Portkey
Logging
Sending your request through Portkey ensures that all of the requests are logged by default
Each request log contains timestamp, ... | https://python.langchain.com/docs/integrations/providers/portkey/logging_tracing_portkey |
9ac5e665f0ef-0 | Psychic
This notebook covers how to load documents from Psychic. See here for more details.
Prerequisites
Follow the Quick Start section in this document
Log into the Psychic dashboard and get your secret key
Install the frontend react library into your web app and have a user authenticate a connection. The connection... | https://python.langchain.com/docs/integrations/document_loaders/psychic.html |
507164237436-0 | PromptLayer ChatOpenAI
This example showcases how to connect to PromptLayer to start recording your ChatOpenAI requests.
Install PromptLayer
The promptlayer package is required to use PromptLayer with OpenAI. Install promptlayer using pip.
Imports
import os
from langchain.chat_models import PromptLayerChatOpenAI
from... | https://python.langchain.com/docs/integrations/chat/promptlayer_chatopenai.html |
5da393ee57c7-0 | Qdrant
Qdrant (read: quadrant ) is a vector similarity search engine. It provides a production-ready service with a convenient API to store, search, and manage points - vectors with an additional payload. Qdrant is tailored to extended filtering support. It makes it useful for all sorts of neural network or semantic-ba... | https://python.langchain.com/docs/integrations/vectorstores/qdrant.html |
5da393ee57c7-1 | embeddings = OpenAIEmbeddings()
Connecting to Qdrant from LangChain
Local mode
Python client allows you to run the same code in local mode without running the Qdrant server. That's great for testing things out and debugging or if you plan to store just a small amount of vectors. The embeddings might be fully kepy in ... | https://python.langchain.com/docs/integrations/vectorstores/qdrant.html |
5da393ee57c7-2 | prefer_grpc=True,
api_key=api_key,
collection_name="my_documents",
)
Recreating the collection
Both Qdrant.from_texts and Qdrant.from_documents methods are great to start using Qdrant with Langchain. In the previous versions the collection was recreated every time you called any of them. That behaviour has changed. Cu... | https://python.langchain.com/docs/integrations/vectorstores/qdrant.html |
5da393ee57c7-3 | Tonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service.
One of the most serious constitutional responsibilities a President ... | https://python.langchain.com/docs/integrations/vectorstores/qdrant.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.