delayedkarma/langchain-issues huggingface dataset:
Problem using HuggingFacePipeline by passing pipeline in directly
Labels: name: area: embeddings, name: auto:bug

### System Info

langchain 0.0.242
python 3.11.4

### Who can help?

@hwchase17
@hwchase17

### Information

- [X] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [X] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

I try using a local LLM from HuggingFace: 

1. Using from_model_id works perfectly: 
llm = HuggingFacePipeline.from_model_id(
    model_id="TheBloke/wizardLM-7B-HF",
    task="text-generation",
    pipeline_kwargs={"max_new_tokens": 1200, "temperature": 0.3, "top_p": 0.95, "repetition_penalty": 1.15,},
    device=0,
)

print(llm)
Params: {'model_id': 'TheBloke/wizardLM-7B-HF', 'model_kwargs': {}, 'pipeline_kwargs': {'max_new_tokens': 1200, 'temperature': 0.3, 'top_p': 0.95, 'repetition_penalty': 1.15}}

2. Now the problem is when **passing pipeline directly**: 
I just followed the example given in Langchain.

from langchain.llms import HuggingFacePipeline
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import transformers

model_id  = "TheBloke/wizardLM-7B-HF"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)

pipe = pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    device_map="auto",
    max_new_tokens = 1200,
    temperature = 0.3,
    top_p = 0.95,
    repetition_penalty = 1.15,
)
hf = HuggingFacePipeline(pipeline=pipe)
print(hf)
### Now I get this:  Params: {'model_id': 'gpt2', 'model_kwargs': None, 'pipeline_kwargs': None}

### Expected behavior

What is the matter? 
Why are the paramters that I set not taken? 
Why does it use the default ones? 

I tried it now over and over and over again, but I can't get it work. 
Sb has any idea why? I am a bit desperate, cause I need to pass pipeline directly. 

Official langchain documentation: 
Example passing pipeline in directly:

    from langchain.llms import HuggingFacePipeline
    from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

    model_id = "gpt2"
    tokenizer = AutoTokenizer.from_pretrained(model_id)
    model = AutoModelForCausalLM.from_pretrained(model_id)
    pipe = pipeline(
        "text-generation", model=model, tokenizer=tokenizer, max_new_tokens=10
    )
    hf = HuggingFacePipeline(pipeline=pipe)
devcontainer in vscode is not working
Labels: name: auto:bug

### System Info

Macos 13.5, vscode 1.80.1

### Who can help?

@hwchase17 @agola11 

### Information

- [X] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

As mentioned in the readme if .devcontainer
1. Clone locally
2. In Vscode select Build and open in dev container

### Expected behavior

The Devcontainer is working well, Building and running 
![image](https://github.com/langchain-ai/langchain/assets/2066836/25054f29-4928-4256-aba3-eab37d8b4a8e)
 but the mounted folder is incorrect and empty, so the vscode file explorer is empty 
![image](https://github.com/langchain-ai/langchain/assets/2066836/8a9c58fa-ffb9-49ba-bfca-90fc2469f068)

![image](https://github.com/langchain-ai/langchain/assets/2066836/37093dbb-8a8c-40b5-bd0d-438ee37a2928)

Maybe due to the devcontainer.json file, referring to a FolderBaseName variable 
![image](https://github.com/langchain-ai/langchain/assets/2066836/8eea662b-3d31-41d7-89e4-660205c1d260)
Add api cross ref linking
Labels: name: auto:documentation

Example of how it would show up in our python docs:

![image](https://github.com/langchain-ai/langchain/assets/13333726/0f0a88cc-ba4a-4778-bc47-118c66807f15)


Examples added to the reference docs:
https://api.python.langchain.com/en/wfh-api_crosslink/vectorstores/langchain.vectorstores.chroma.Chroma.html#langchain.vectorstores.chroma.Chroma

![image](https://github.com/langchain-ai/langchain/assets/13333726/dcd150de-cb56-4d42-b49a-a76a002a5a52)
Fix the mangling issue on several VectorStores child classes.
Labels: name: area: vector store, name: auto:bug


  - Description: Fix mangling issue affecting a couple of VectorStore classes including Redis.
  - Issue: https://github.com/langchain-ai/langchain/issues/8185
  - @rlancemartin 
  
This is a simple issue but I lack of some context in the original implementation.
My changes perhaps are not the definitive fix but to start a quick discussion.

  @hinthornw Tagging you since one of your changes introduced this [here.](https://github.com/langchain-ai/langchain/commit/c38965fcba42eadb3bc72754defbedef100f6ed0) I do not like my fix, the best option will be just using a single "_" in the parent class method, but I do not the reasons behind the original implementation.
Issue:  LLM makes up new QAs after answering question in a QA chains
Labels: name: area: agent, name: auto:bug, name: auto:documentation

### Issue you'd like to raise.

Hi, it's my first issue in github. And the first thing I want to say is that LangChain is awesome!

I'm not quite so sure is that a bug or just a little issue of config.So I list it as a other issue.

I built a agent and built some RetrievalQA chains as tools for agent.However,when I ask a question,agent answer my question in a sentence and make up some new QAs, which easily misdirected agent and made final answer quite irrelevant with my original question.

So is that my problem in config of agent or LLM(temperture/prompt), or do i need to adjust my agent?(But I have tried to add  `early_stopping_method` and `max_execution_time` to limit  the agent generate redundant content.And turns out it didn't work well)

### Suggestion:

Maybe add some solution in document?
not enough values to unpack (expected 2, got 1) while LabeledPairwiseStringEvalChain with evaluate_string_pairs
Labels: name: area: agent, name: auto:bug

### System Info

platform = mac m2
python = 3.11

### Who can help?

@hwchase17 

### Information

- [X] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

```
prompt_template = PromptTemplate.from_template(
            """Given the input context and the reference, analyze and determine which prediction, A or B, aligns most closely with the reference label.
Consider the following factors while analyzing:
- Relevance to the input context
- Semantic similarity with the reference label
- Consistency with any specifics mentioned in the input
The DATA for this decision are as follows:
Input Context: {input}
Reference Label: {reference}
Option A: {prediction}
Option B: {prediction_b}
After analyzing, provide the reasoning for your selection, and finally, respond with either [[A]] or [[B]] on its own line. In the case that both options are equally similar, default to option [[A]].
---
Reasoning:
"""
        )

  evalutionChain = LabeledPairwiseStringEvalChain.from_llm(
      llm=llm, prompt=prompt_template
  )

  result = evalutionChain.evaluate_string_pairs(
      input=self.currentQuery,
      prediction=response1,
      prediction_b=response2,
      reference=self.formatSourcesStructure(sourcedocs),
  )
```

sometime it gives error like
```
not enough values to unpack (expected 2, got 1)
```

it like every 3-4 request, 1 request failing with this request,
and when request failed, on next request it gives the response

### Expected behavior

There will be no error, and should return valid response
Support loading files from Dropbox
Labels: name: area: doc loader, name: auto:enhancement

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: a description of the change, 
  - Issue: the issue # it fixes (if applicable),
  - Dependencies: any dependencies required for this change,
  - Tag maintainer: for a quicker response, tag the relevant maintainer (see below),
  - Twitter handle: we announce bigger features on Twitter. If your PR gets announced and you'd like a mention, we'll gladly shout you out!

Please make sure you're PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @baskaryan
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @baskaryan
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @hinthornw
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the same people again.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->

## Description
This commit introduces the `DropboxLoader` class, a new document loader that allows loading files from Dropbox into the application. The loader relies on a Dropbox app, which requires creating an app on Dropbox, obtaining the necessary scope permissions, and generating an access token. Additionally, the dropbox Python package is required.

The `DropboxLoader` class is designed to be used as a document loader for processing various file types, including text files, PDFs, and Dropbox Paper files.

## Dependencies
`pip install dropbox` and `pip install unstructured` for PDF reading.

## Tag maintainer
@rlancemartin, @eyurtsev (from Data Loaders). I'd appreciate some feedback here 🙏 .

## Social Networks
https://github.com/rubenbarragan
https://www.linkedin.com/in/rgbarragan/
https://twitter.com/RubenBarraganP
similarity_search on nested fields not returning results
Labels: name: area: vector store, name: auto:bug, name: auto:question

Hi , I am using an existing open search vector store and trying to perform below queries using langchain and python. But i am unable to see the documents returned.

Queries: 
docs = result.similarity_search(
    "show me results for rest API throwing 500 exceptions", search_type="painless_scripting",space_type="cosinesimil",
    vector_field="listOfMessages.vectorEmbeddings",
    text_field="listOfMessages.messageContent"
  )

Note: 
1. even if i use other search_type or not pass search_type also i am not getting any results.
2. Here my fields are nested fields.

Someone please help me on how to resolve this issue.
Azure search extra fields
Labels: name: area: vector store, name: auto:improvement

  - Description: Added ability to make metadata filterable and retrievable,
  - Issue:  #6134 #7154 
  - Dependencies: None,
  - Tag maintainer:  @rlancemartin, @eyurtsev,,
  - Twitter handle: @AkhilSivanand

Example usage
```metadatas = [{'doc_id':'1', 'text_block_id':'23'}]
azure_search_endpoint=os.getenv("VECTOR_STORE_ADDRESS")
azure_search_key=os.getenv("VECTOR_STORE_PASSWORD")
metadata_fields = ['doc_id', 'text_block_id']
vector_store: AzureSearch = AzureSearch(
    azure_search_endpoint=azure_search_endpoint,
    azure_search_key=azure_search_key,
    index_name=index_name,
    embedding_function=embeddings.embed_query,
    search_type="similarity",
    metadata_fields=metadata_fields
)
result = vector_store.add_texts(texts = texts, metadatas=metadatas, metadata_fields=metadata_fields)
```



An additional field 'metadata_fields' is used to define if metadata should be made filterable and searchable. It is defined as **kwargs. So If we want to use it in the old format, we can just omit 'metadata_fields'during the function call.
If we are using the metadata_fields, the format of the index will be as shown below

![image](https://github.com/langchain-ai/langchain/assets/32809324/a180fccd-b653-4ba2-a01d-d99c32ddcba5)
Issue: LLMChain throwing abstract class BasePromptTemplate error, even when the prompt templates used are not abstract.
Labels: name: auto:bug

### Issue you'd like to raise.

I am trying to instantiate 2 LLMChains, each of which should use a SystemMessagePromptTemplate to specify the way that it should communicate. Both are using the same LLM from the HF pipeline. 

The following code gives the error "ValidationError: 1 validation error for LLMChain prompt Can't instantiate abstract class BasePromptTemplate with abstract methods format, format_prompt (type=type_error)" at the instantiation of the LLMChain. 
```
llm = HuggingFacePipeline.from_model_id(
model_id="microsoft/DialoGPT-medium",
task="text-generation",
model_kwargs={"temperature": 0, "max_length": 100},
)

ai_bot_template = "You are an AI chatbot that interacts with humans. You will also be interacting with a Therapist with the goal of improving the safety, trustworthiness, and ethics of your communication. There will also be a moderator that checks in throughout your interactions with the therapist and the human."
ai_therapist_template = "You are an AI therapist that interacts with AI chat bots. Your goal is to help the chat bot improve the safety, trustworthiness, and ethics of its interactions with humans."

ai_bot_prompt = SystemMessagePromptTemplate.from_template(ai_bot_template)
ai_therapist_prompt = SystemMessagePromptTemplate.from_template(ai_therapist_template)

therapist_chain = LLMChain(prompt=ai_therapist_prompt, llm=llm)
ai_bot_chain = LLMChain(prompt=ai_bot_prompt, llm=llm)
```

### Suggestion:

_No response_
with agent type STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION, failed to add chat memory if input format is json or dict 
Labels: name: area: memory, name: area: agent, name: auto:bug

### System Info

Latest langchain version 0.0.240

with agent type STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION and memory, it failed to add chat memory if input format is json or dict.

For example 

    agent_chain = initialize_agent(tools
                                    , chat
                                    , agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION
                                    , verbose=True
                                    , memory=memory
                                    )
agent_chain.run(input={'query':'How is the patient responding to the current medications', 'filter':'04c3a6bcfcc821d7b7ac722713f4bf7c'})

if failed at self.chat_memory.add_user_message(input_str) in chat_memory.py 

    def save_context(self, inputs: Dict[str, Any], outputs: Dict[str, str]) -> None:
        """Save context from this conversation to buffer."""
        input_str, output_str = self._get_input_output(inputs, outputs)
        self.chat_memory.add_user_message(input_str)
        self.chat_memory.add_ai_message(output_str)

because input_str is {'query':'How is the patient responding to the current medications', 'filter':'04c3a6bcfcc821d7b7ac722713f4bf7c'}

if I modify this function, add query_value = input_str['query'], then it works 

        # Extract the value of the 'query' key
        query_value = input_str['query']
        #self.chat_memory.add_user_message(input_str)
        self.chat_memory.add_user_message(query_value)


### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [X] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

1) Create agent with STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION type
2) use memory option
3) input as json input 

    agent_chain = initialize_agent(tools
                                    , chat
                                    , agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION
                                    , verbose=True
                                    , memory=memory
                                    )
agent_chain.run(input={'query':'How is the patient responding to the current medications', 'filter':'04c3a6bcfcc821d7b7ac722713f4bf7c'})

### Expected behavior

agent_chain.run(input={'query':'How is the patient responding to the current medications', 'filter':'04c3a6bcfcc821d7b7ac722713f4bf7c'}) completes successfully
langchain.graph RDFGraph does not read OWL 
Labels: name: area: doc loader, name: auto:bug

### System Info

langchain verion: 0.0.237
python version: 3.11.4

### Who can help?


@hwchase17 

When loading an OWL graph in the following code, an exception occurs that says: "Exception has occurred: KeyError 'op'". It appears that RFGraph class is having trouble with the owl standard specifically.

```from langchain.graphs import RdfGraph

graph = RdfGraph(
    source_file="example.ttl",
    serialization="ttl",
    standard="owl"
)
```

I found this issue when using RDFGraph within the GraphSparqlQAChain class

Thank you very much for your help.

### Information

- [X] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [X] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

Steps to reproduce:

1. Use the following code

```from langchain.chat_models import ChatOpenAI
from langchain.chains import GraphSparqlQAChain
from langchain.graphs import RdfGraph

graph = RdfGraph(
    source_file="example.ttl",
    serialization="ttl",
    standard="owl"
)

graph.load_schema()

print(graph.get_schema)```
```

2. Use the following graph

```
@prefix : <http://example.org/pump-ontology#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://example.org/test-ontology> .

<http://example.org/test-ontology> rdf:type owl:Ontology .

:hasTopping rdf:type owl:ObjectProperty .
:Object rdf:type owl:Class .
:Pizza rdf:type owl:Class ;
       rdfs:subClassOf :Object .
:Topping rdf:type owl:Class ;
         rdfs:subClassOf :Object ,
                         [ rdf:type owl:Restriction ;
                           owl:onProperty :hasTopping ;
                           owl:someValuesFrom :Topping
                         ] .
```


### Expected behavior

For the graph to load and for graph.get_schema to produce the classes (Pizza and Topping) and object property (hasTopping) in the class.
Retrying langchain.embeddings.openai.embed_with_retry
Labels: name: area: embeddings, name: area: vector store, name: auto:bug

### System Info

Here is my code:
```from langchain.vectorstores import Chroma
from langchain.embeddings.openai import OpenAIEmbeddings
persist_directory = 'docs/chroma/'
embedding = OpenAIEmbeddings(request_timeout=60)
vectordb = Chroma(persist_directory=persist_directory, embedding_function=embedding)
question = "What are major topics for this class?"
docs = vectordb.similarity_search(question,k=3)
len(docs)
```

Here is the issue:
`Retrying langchain.embeddings.openai.embed_with_retry.<locals>._embed_with_retry in 4.0 seconds as it raised APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/engines/text-embedding-ada-002/embeddings (Caused by ProxyError('Unable to connect to proxy', SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)')))).`

I have tried my apikey with other code and it works just fine. First time it happens when I use `embedding = OpenAIEmbeddings()` with another group of codes and then I change it to `embedding = OpenAIEmbeddings(request_timeout=60)` and it works. But this time, even if I increase the request_timeout to 120 and it still doesn't work. Any thought on this?

### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [X] LLMs/Chat Models
- [X] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

```
import os
import openai
import sys
sys.path.append('../..')

import panel as pn  # GUI
pn.extension()

from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv()) # read local .env file

openai.api_key  = os.environ['OPENAI_API_KEY']
import datetime
current_date = datetime.datetime.now().date()
if current_date < datetime.date(2023, 9, 2):
    llm_name = "gpt-3.5-turbo-0301"
else:
    llm_name = "gpt-3.5-turbo"
print(llm_name)
from langchain.vectorstores import Chroma
from langchain.embeddings.openai import OpenAIEmbeddings
persist_directory = 'docs/chroma/'
embedding = OpenAIEmbeddings(request_timeout=60)
vectordb = Chroma(persist_directory=persist_directory, embedding_function=embedding)
question = "What are major topics for this class?"
docs = vectordb.similarity_search(question,k=3)
len(docs)
```


### Expected behavior

How can I make it work stably instead of having this occasionally?
add guide notebook
Labels: name: area: doc loader, name: auto:documentation

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: a description of the change, 
  - Issue: the issue # it fixes (if applicable),
  - Dependencies: any dependencies required for this change,
  - Tag maintainer: for a quicker response, tag the relevant maintainer (see below),
  - Twitter handle: we announce bigger features on Twitter. If your PR gets announced and you'd like a mention, we'll gladly shout you out!

Please make sure you're PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @baskaryan
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @baskaryan
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @hinthornw
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the same people again.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->