delayedkarma/langchain-issues huggingface dataset:
GitHubIssuesLoader Custom API URL Support 
Labels: name: lgtm, name: area: doc loader, name: auto:improvement

  - **Description:** Adds support for custom API URL in the GitHubIssuesLoader. This allows it to be used with Github enterprise instances. 
  
  
<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** Adds support for custom API URL in the GitHubIssuesLoader. This allows it to be used with Github enterprise instances. 
  - **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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
How to change the system message of qa chain?
Labels: name: auto:question, name: area: models

### Issue you'd like to raise.

I have applied RetrievalQA's chain_type to map_reduce in my application and would like to customize its system message.

### Suggestion:

There is a way to modify the map_reduce_prompt code in the question answering, but I would like to know how to change it to the argument value of RetrievalQA.from_chain_type.
Fix ConversationSummaryBufferMemory to flush old interactions with th…
Labels: name: area: memory, name: auto:improvement

…e maximum tokens of the buffer

- **Issue:** #3072 
- **Relate to:** #3345 
- **Description:** I've found same issue in my project with langchain and also read the related PR.
However, I thought that instead of actually pruning the messages, just getting the small size buffer is more appropriate.
So, this is what I've done.

<!-- Thank you for contributing to LangChain!

Replace this entire 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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Issue: Open AI embedding dose not returning results for some times
Labels: name: area: embeddings, name: auto:bug

### Issue you'd like to raise.

I am having python REST API which calls to Open AI using following code for embedding.

`openai.Embedding.create(input=text, engine='text-embedding-ada-002')['data'][0]['embedding']`

I am having text length below the 8191 (max token size for text-embedding-ada-002).

When I am calling it, some times it doesn't return any results or exceptions. (execution get blocks after the calling this. But it is giving result on 2nd or 3rd attempts  for same input text. It is happening time to time and not consistence.

Kindly help me to resolve this issue.

Thanks
Nuwan

### Suggestion:

_No response_
rupd
Labels: name: auto:improvement

<!-- Thank you for contributing to LangChain!

Replace this entire 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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
RAG - TypeError: unhashable type: 'list'
Labels: name: area: vector store, name: auto:bug, name: area: models

### System Info

I running code in Google Colab:
LangChain version: 0.0.306
Python 3.10.12
Transformers library 4.34.0

### Who can help?

_No response_

### 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
- [X] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [X] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

Hello! I have encountered the following error when trying to develop HuggingFace question answering models:

tokenizer = AutoTokenizer.from_pretrained("/content/flan-t5-large")
model = AutoModelForSeq2SeqLM.from_pretrained("/content/flan-t5-large")
pipe = pipeline("text2text-generation", model=model, tokenizer=tokenizer)
llm = HuggingFacePipeline(
    pipeline = pipeline,
    model_kwargs={"temperature": 0, "max_length": 512},
)


chain = load_qa_chain(llm, chain_type="stuff")
query = "My question?"
docs = db.similarity_search(query)

chain.run(input_documents=docs, question=query)

But the output is:

TypeError                                 Traceback (most recent call last)
[<ipython-input-34-226234bd6dea>](https://localhost:8080/#) in <cell line: 1>()
----> 1 chain.run(input_documents=docs, question=query)

15 frames
[/usr/local/lib/python3.10/dist-packages/transformers/pipelines/__init__.py](https://localhost:8080/#) in pipeline(task, model, config, tokenizer, feature_extractor, image_processor, framework, revision, use_fast, token, device, device_map, torch_dtype, trust_remote_code, model_kwargs, pipeline_class, **kwargs)
    773 
    774     # Retrieve the task
--> 775     if task in custom_tasks:
    776         normalized_task = task
    777         targeted_task, task_options = clean_custom_task(custom_tasks[task])

TypeError: unhashable type: 'list'

### Expected behavior

I just wanna find solution, I didn't find nothing about this in the Google.
Issue: Limit Memory Access on LangChain Bot
Labels: name: area: memory, name: auto:question, name: area: models

### Issue you'd like to raise.

I'm creating a langchain chatbot (Conversationl-ReACT-description) with zep long term memory and that bot has access to real-time data. How do I prevent use the memory when same query asked again few minutes later?

### Suggestion:

_No response_
send single batch of generations
Labels: name: auto:improvement

<!-- Thank you for contributing to LangChain!

Replace this entire 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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Wfh/eval max concurrency
Labels: name: auto:improvement

<!-- Thank you for contributing to LangChain!

Replace this entire 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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Issue: differences between tool and llm
Labels: name: area: agent, name: auto:question, name: area: models

### Issue you'd like to raise.

Hi, I want to clarify some questions about tool and llm usage.

If an agent is initialized with multiple llm and tools, 
1. how does the agent choose which llm or tool to use to answer the prompt? 
2. How is llm different from tools? Can you give some examples of each category? 
3. Can the agent use multiple tools/llm? If the agent can use multiple tools, what happen if the output generated by such tools/llm conflict with each other? In that case, which result will be returned to user?

for example, in the code beloew (cited from langchain doc), the agent is initialized with both 'llm_chain=llm_chain' (where llm_chain is OpenAI)and 'tools=tools' (where tool is google search engine). Which one is used to generate the result?

```search = GoogleSearchAPIWrapper()
tools = [
    Tool(
        name="Search",
        func=search.run,
        description="useful for when you need to answer questions about current events",
    )
]

prefix = """Have a conversation with a human, answering the following questions as best you can. You have access to the following tools:"""
suffix = """Begin!"

{chat_history}
Question: {input}
{agent_scratchpad}"""

prompt = ZeroShotAgent.create_prompt(
    tools,
    prefix=prefix,
    suffix=suffix,
    input_variables=["input", "chat_history", "agent_scratchpad"],
)
memory = ConversationBufferMemory(memory_key="chat_history")

llm_chain = LLMChain(llm=OpenAI(temperature=0), prompt=prompt)
agent = ZeroShotAgent(llm_chain=llm_chain, tools=tools, verbose=True)
agent_chain = AgentExecutor.from_agent_and_tools(
    agent=agent, tools=tools, verbose=True, memory=memory
)

agent_chain.run(input="How many people live in canada?")
agent_chain.run(input="what is their national anthem called?")```
chore: add kotlin code splitter
Labels: name: lgtm, name: auto:improvement

<!-- Thank you for contributing to LangChain!

Replace this entire 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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->

- **Description:** Adds Kotlin language to `TextSplitter`
Solves unicode [codec can't decode byte] traceback error.
Labels: name: area: doc loader, name: auto:bug

Following up on #11359

  - **Description:** a description of the change, 

privateGPT/ingest.py crashes when parsing a txt file with unexpected unicode.

  - **Issue:** the issue # it fixes (if applicable),

Problem solved:

Traceback (most recent call last):
File "C:\Program Files\Python3\Lib\site-packages\langchain\document_loaders\text.py", line 41, in load text = f.read()
^^^^^^^^
File "", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa7 in position 549: invalid start byte

  - **Dependencies:** any dependencies required for this change,

none

  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),

No idea.

  - **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!

@DigitalVisor
added interactive login for azure cognitive search vector store
Labels: name: lgtm, name: area: vector store, name: auto:improvement

 **Description:** Previously if the access to Azure Cognitive Search was not done via an API key, the default credential was called which doesn't allow to use an interactive login. I simply added the option to use "INTERACTIVE" as a key name, and this will launch a login window upon initialisation of the AzureSearch object.
Issue: Fixed unicode decode byte error
Labels: name: area: doc loader, name: auto:bug, name: auto:question

### Issue you'd like to raise.

Trying to submit a code update. This would be a first. Help a non software eng out. :)

Here's a manual diff of the intended change:
```
langchain\libs\langchain\langchain\document_loaders\text.py
<<[41]             with open(self.file_path, encoding=self.encoding) as f:
>>[41]            with open(self.file_path, encoding=self.encoding, errors='replace') as f:
```

The COMMIT_EDITMSG file:
"""
Solves unicode [codec can't decode byte] traceback error:

Traceback (most recent call last):
  File "C:\Program Files\Python3\Lib\site-packages\langchain\document_loaders\text.py", line 41, in load
    text = f.read()
           ^^^^^^^^
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa7 in position 549: invalid start byte
"""

The general flow used:
PS C:\dev\github\langchain\libs\langchain\langchain\document_loaders> notepad .\text.py
PS C:\dev\github\langchain\libs\langchain\langchain\document_loaders> git add text.py
PS C:\dev\github\langchain\libs\langchain\langchain\document_loaders> git checkout -b unicode_replace_fix
Switched to a new branch 'unicode_replace_fix'
PS C:\dev\github\langchain\libs\langchain\langchain\document_loaders> git commit -m "Solves unicode [codec can't decode byte] traceback error."
... // had to update user.name/email
PS C:\dev\github\langchain\libs\langchain\langchain\document_loaders> git commit --amend --reset-author
hint: Waiting for your editor to close the file... unix2dos: converting file C:/Dev/Github/langchain/.git/COMMIT_EDITMSG to DOS format...
dos2unix: converting file C:/Dev/Github/langchain/.git/COMMIT_EDITMSG to Unix format...
[unicode_replace_fix 09c9cb77e] Solves unicode [codec can't decode byte] traceback error:
 1 file changed, 1 insertion(+), 1 deletion(-)

// below, I got a github auth popup, went through, succeeded - then denied?
PS C:\dev\github\langchain\libs\langchain\langchain\document_loaders> git push origin unicode_replace_fix
info: please complete authentication in your browser...
remote: Permission to langchain-ai/langchain.git denied to hackedpassword.
fatal: unable to access 'https://github.com/langchain-ai/langchain/': The requested URL returned error: 403

// denied but no diff?
PS C:\dev\github\langchain> git diff HEAD
PS C:\dev\github\langchain> git status
On branch unicode_replace_fix
nothing to commit, working tree clean
PS C:\dev\github\langchain> git diff
PS C:\dev\github\langchain>

Maybe I'm up against a repo push permission issue?

### Suggestion:

_No response_
BedrockChat Error
Labels: name: auto:bug, name: area: models

### Feature request

Chatbot using prompt template (Langchain) gives proper response to first prompt "Hi there!" but gives below error to second prompt "Give me a few tips on how to start a new garden."
_```
ValueError: Error: Prompt must alternate between '

Human:' and '

Assistant:'.

### Motivation

Yes its a problem being raised by my customer who is blocked currently

### Your contribution

NA
![ErrorCapture](https://github.com/langchain-ai/langchain/assets/146884181/818ac5bf-1344-4d29-aa62-8da194cfd8a9)
[Error-Test.ipynb.txt](https://github.com/langchain-ai/langchain/files/12796468/Error-Test.ipynb.txt)
Improve type hints and interface for SQL execution functionality.
Labels: name: auto:improvement

The previous API of the `_execute()` function had a few rough edges that this PR addresses:
- The `fetch` argument was type-hinted as being able to take any string, but any string other than `"all"` or `"one"` would `raise ValueError`. The new type hints explicitly declare that only those values are supported.
- The return type was type-hinted as `Sequence` but using `fetch = "one"` would actually return a single result item. This was incorrectly suppressed using `# type: ignore`. We now always return a list.
- Using `fetch = "one"` would return a single item if data was found, or an empty *list* if no data was found. This was confusing, and we now always return a list to simplify.
- The return type was `Sequence[Any]` which was a bit difficult to use since it wasn't clear what one could do with the returned rows. I'm making the new type `Dict[str, Any]` that corresponds to the column names and their values in the query.

I've updated the use of this method elsewhere in the file to match the new behavior.
Use an enum for configurable_alternatives to make the generated json schema nicer
Labels: name: auto:improvement



<!-- Thank you for contributing to LangChain!

Replace this entire 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 your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

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. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Conversational Chain Error 429
Labels: name: auto:bug, name: area: models

### System Info

Today, all of a sudden I'm getting a error status code 429 using the Conversation chain. Nothing has changed, expect the day I've run the script. Any ideas?
It works with the normal LLM chain, so it must be to do with the Conversation Chain not working or the memories.

Using Flowise.
Chrome

@hwchase17
@agola11

### 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
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

Request failed with status code 429 and body {"error":{"message":"Rate limit reached for 10KTPM-200RPM in organization org-ByeURhCRRujcKf7u7QrlrudH on tokens per min. Limit: 10000 / min. Please try again in 6ms. Contact us through our help center at help.openai.com if you continue to have issues.","type":"tokens","param":null,"code":"rate_limit_exceeded"}}



### Expected behavior

I expect the LLM chain to write the content.
Missing 1 required positional argument for function that has `self` argument.
Labels: name: area: agent, name: auto:bug

### System Info

langchain==0.0.286



### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [X] 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
- [X] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

``` python
def add_product(self, input: str):
        print(f"🟢 Add product {input}")
```

``` python
tools = [
       Tool(
            name="AddProduct",
            func=add_product,
            description="""
                Add product to order.

                Input of this tool must be a single string JSON format:

                For example: '{{"name":"Nike Pegasus 40"}}'
            """
        )
]
```

``` python
agent = initialize_agent(
        tools=tools, 
        llm=__gpt4, 
        agent=AgentType.OPENAI_FUNCTIONS, 
        verbose=True,
        prompt=prompt
)
```

### Expected behavior

Error:

```
TypeError: add_product() missing 1 required positional argument: 'input'
```

Expected: 
```
Function `add_product` called with correct input.
```