delayedkarma/langchain-issues huggingface dataset:
Azure OpenAI with deployment_id is not working.

### System Info

It seems that the library is only supported when the deployment type on AzureOpenAI is an engine. When I try to use a deployment_id which is the new way to deploy models on Azure I can't make it work. 

This code works well outside of long-chain. Note that I am not using an engine here, but the deployment_id :
```
openai.api_type = "azure"
openai.api_key = "MYAPIHERE"
openai.api_base = "https://eastus.api.cognitive.microsoft.com/"
openai.api_version = "2023-05-15"

response = openai.ChatCompletion.create(
    deployment_id="gpt35",
    model="gpt-3.5",
    messages=[
        {"role": "system", "content": "Assistant is a large language model trained by OpenAI."},
        {"role": "user", "content": "Tell me a Joke."}
    ],
    temperature=0.0,
    max_tokens=4000,
    api_key="MYAPIHERE",
    request_timeout=15,
)

print(response['choices'][0]['message']['content'])
```

When I try to use that on langchain AzureOpenAI it doesn't work. I don't know if me doing something wrong or if its the library that doesn't support that. 

Here is the code I am using to test langchain on and that doesn't work:

```
from langchain.llms import AzureOpenAI

import os

os.environ["OPENAI_API_TYPE"] = "azure"
os.environ["OPENAI_API_VERSION"] = "2023-03-15"
os.environ["OPENAI_API_BASE"] = "https://eastus.api.cognitive.microsoft.com/"
os.environ["OPENAI_API_KEY"] = "MYAPIKEYHERE"
# Create an instance of Azure OpenAI


# Replace the deployment name with your own
llm = AzureOpenAI(
    model_name="gpt-3.5",
    deployment_id = "gpt35"
)

print(llm("Tell me a joke"))

```

The error is:
```
Exception has occurred: InvalidRequestError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
Resource not found
```

Thanks in advance.

### Who can help?

@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've sent the code in the question to reproduce the error.

### Expected behavior

I would expect the code to return the response but all I have is an error.
DOC:  CSS for the left panel seems broken

### Issue with current documentation:

In the left panel,  can't list all sub-topics properly
![image](https://github.com/hwchase17/langchain/assets/17263036/ce0b8737-8044-41cf-b390-51e2ffe89745)

I am using https://python.langchain.com/docs/modules/model_io/prompts/example_selectors/,   it was correct at least 24H ago, but now it doesn't work for me


### Idea or request for content:

_No response_
error in AWS Lambda when importing langchain library

### System Info

Versions of the libs:
langchain               0.0.202
langchainplus-sdk       0.0.10
numpy                   1.24.3

In the lambda I have python 3.10 running

I have imported langchain i an AWS lambda function and I get this error, hay anyone encoutered the same issue when running lanchgain in lambda?

[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda-XXX': 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:


The Python version is: Python3.10 from "/var/lang/bin/python3.10"
The NumPy version is: "1.24.3"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy.core._multiarray_umath'

Traceback (most recent call last):**

### 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

as soon as you import langchain in an aws lambda (deployed as a Zip) the error appears
"""
import langchain
"""

### Expected behavior

there should be no error and should be able to import the library correctly
fix links to prompt templates and example selectors
Labels: name: lgtm

<!--
Thank you for contributing to LangChain! Your PR will appear in our release under the title you set. Please make sure it highlights your valuable contribution.

Replace this with a description of the change, the issue it fixes (if applicable), and relevant context. List any dependencies required for this change.

After you're done, someone will review your PR. They may suggest improvements. If no one reviews your PR within a few days, feel free to @-mention the same people again, as notifications can get lost.

Finally, we'd love to show appreciation for your contribution - if you'd like us to shout you out on Twitter, please also include your handle!
-->

<!-- Remove if not applicable -->

Fixes # 
links to prompt templates and example selectors on the [Prompts](https://python.langchain.com/docs/modules/model_io/prompts/) page are invalid.

#### Before submitting
Just a small note that I tried to run `make docs_clean` and other related commands before PR written [here](https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md#build-documentation-locally), it gives me an error:
```bash
langchain % make docs_clean
Traceback (most recent call last):
  File "/Users/masafumi/Downloads/langchain/.venv/bin/make", line 5, in <module>
    from scripts.proto import main
ModuleNotFoundError: No module named 'scripts'
make: *** [docs_clean] Error 1
# Poetry (version 1.5.1)
# Python 3.9.13
```
I couldn't figure out how to fix this, so I didn't run those command. But links should work.

#### Who can review?

Tag maintainers/contributors who might be interested:
@hwchase17

Similar issue #6323
Cannot instantiate a GPT4All integration in LangChain

### System Info

LangChain: `langchain==0.0.202`
GPT4All: `gpt4all==0.3.4`

Python version: `Python 3.11.3`
OS: Windows 11

### Who can help?

@hwchase17 @agola11 

### 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
- [X] Callbacks/Tracing
- [ ] Async

### Reproduction

Steps to replicate this error:

1. Create a virtual environment
2. Install the following packages
    - `langchain==0.0.202`
    - `gpt4all==0.3.4`
3. Download the `ggml-mpt-7b-base.bin` model from [gpt4all.io](https://gpt4all.io/index.html) under Model Explorer in a folder called `models`
3. Run the following snippet (taken from LangChain [GPT4All documentation](https://python.langchain.com/docs/modules/model_io/models/llms/integrations/gpt4all))
```python
from langchain.llms import GPT4All
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler

import os

local_path = os.path.join("models", "ggml-mpt-7b-base.bin")

callbacks = [StreamingStdOutCallbackHandler()]
llm = GPT4All(model=local_path, callbacks=callbacks, verbose=True, backend="mpt")
```

### Expected behavior

A ValidationError raised with a traceback similar to the following

```python
Traceback (most recent call last):
  File "D:\kranthi\langchain-playground\gpt4_all.py", line 9, in <module>
    llm = GPT4All(model=local_path, callbacks=callbacks, verbose=True, backend="mpt")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\kranthi\langchain-playground\langchain\Lib\site-packages\langchain\load\serializable.py", line 61, in __init__
    super().__init__(**kwargs)
  File "pydantic\main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for GPT4All
__root__
  Failed to retrieve model (type=value_error)
```
format_tool_to_openai_function includes title and description, when it is not necessary 

### System Info

Langchain version langchain==0.0.201 

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [X] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

I understand the `format_tool_to_openai_function` function was added very recently. Thank you very much for that. 

As an example for this ticket: When `format_tool_to_openai_function` is used like this 

```
from langchain.tools import FileSearchTool
from langchain.tools import format_tool_to_openai_function

format_tool_to_openai_function(FileSearchTool())
```

On a FileSearchTool it generates this 

```
{'name': 'file_search',
  'description': 'Recursively search for files in a subdirectory that match the regex pattern',
  'parameters': {'title': 'FileSearchInput',
   'description': 'Input for FileSearchTool.',
   'type': 'object',
   'properties': {'dir_path': {'title': 'Dir Path',
     'description': 'Subdirectory to search in.',
     'default': '.',
     'type': 'string'},
    'pattern': {'title': 'Pattern',
     'description': 'Unix shell regex, where * matches everything.',
     'type': 'string'}},
   'required': ['pattern']}}
```

This includes some unnecessary fields like `title` and `description` for the `parameters` and `title` for the `parameters.properties`

I do not know whether this is a correctness issue yet with the OpenAI functions api. But at least this should cause wasted tokens. 

### Expected behavior

```
{'name': 'file_search',
  'description': 'Recursively search for files in a subdirectory that match the regex pattern',
  'parameters': {
   'type': 'object',
   'properties': {'dir_path': {
     'description': 'Subdirectory to search in.',
     'default': '.',
     'type': 'string'},
    'pattern': {
     'description': 'Unix shell regex, where * matches everything.',
     'type': 'string'}},
   'required': ['pattern']}}
   ```
The openai_info.py does not have gpt-35-turbo which is the underlying Azure Open AI model name

Since this model name is not there in the list MODEL_COST_PER_1K_TOKENS, when we use get_openai_callback(), for gpt 3.5 model in Azure AI, we do not get the cost of the tokens. This will fix this issue


#### Who can review?
 @hwchase17
 @agola11
Improve the performance of add_texts interface and upgrade the AwaDB from 0.3.2 to 0.3.3

1. Changed the implementation of add_texts interface for the AwaDB vector store in order to improve the performance
2. Upgrade the AwaDB from 0.3.2 to 0.3.3

  resolved the conflict(https://github.com/hwchase17/langchain/pull/6295)
  @dev2049
StreamlitCallbackHandler
Labels: name: enhancement, name: callbacks

A new implementation of `StreamlitCallbackHandler`. It formats Agent thoughts into Streamlit expanders.

You can see the handler in action here: https://langchain-mrkl.streamlit.app/

Per a discussion with Harrison, we'll be adding a `StreamlitCallbackHandler` implementation to an upcoming [Streamlit](https://github.com/streamlit/streamlit) release as well, and will be updating it as we add new LLM- and LangChain-specific features to Streamlit. 

The idea with this PR is that the LangChain `StreamlitCallbackHandler` will "auto-update" in a way that keeps it forward- (and backward-) compatible with Streamlit. If the user has an older Streamlit version installed, the LangChain `StreamlitCallbackHandler` will be used; if they have a newer Streamlit version that has an updated `StreamlitCallbackHandler`, that implementation will be used instead.

(I'm opening this as a draft to get the conversation going and make sure we're on the same page. We're really excited to land this into LangChain!)

#### Who can review?

@agola11, @hwchase17
Enabled Azure Active Directory token-based auth access to OpenAI completions

With AzureOpenAI openai_api_type defaulted to "azure" the logic in utils' get_from_dict_or_env() function triggered by the root validator never looks to environment for the user's runtime openai_api_type values. This inhibits folks using token-based auth, or really any auth model other than "azure."

By removing the "default" value, this allows environment variables to be pulled at runtime for the openai_api_type and thus enables the other api_types which are expected to work.
Be able to use Codey models on Vertex AI

Added the functionality to leverage 3 new Codey models from Vertex AI:
- code-bison - Code generation using the existing LLM integration
- code-gecko - Code completion using the existing LLM integration
- codechat-bison - Code chat using the existing chat_model integration


Tag maintainers/contributors who might be interested:

  - @hwchase17
  - @agola11
Add support to pinecone vectorstore for similarity_score_threshold
Labels: name: area: vector store, name: auto:improvement

At the moment pinecone vectorStore does not support similarity_score_threshold search type in RetrievalQA. 
It extends VectorStore. VectorStore has a function called similarity_search_with_relevance_scores. This function calls the function _similarity_search_with_relevance_scores which is expected to be implemented by child classes. 
However this is not implemented in pinecone. 

In this PR I implement it. After this PR is merged similarity_score_threshold search type in RetrievalQA works perfect

I have also included a test. 

#### Who can review?

Tag maintainers/contributors who might be interested:

@dev2049
Office365 Tool
Labels: name: enhancement

#### Background
With the development of [structured tools](https://blog.langchain.dev/structured-tools/), the LangChain team expanded the platform's functionality to meet the needs of new applications. The GMail tool, empowered by structured tools, now supports multiple arguments and powerful search capabilities, demonstrating LangChain's ability to interact with dynamic data sources like email servers.

#### Challenge
The current GMail tool only supports GMail, while users often utilize other email services like Outlook in Office365. Additionally, the proposed calendar tool in PR https://github.com/hwchase17/langchain/pull/652 only works with Google Calendar, not Outlook.

#### Changes
This PR implements an Office365 integration for LangChain, enabling seamless email and calendar functionality with a single authentication process.

#### Future Work
With the core Office365 integration complete, future work could include integrating other Office365 tools such as Tasks and Address Book.

#### Who can review?
@hwchase17 or @vowelparrot can review this PR

#### Appendix
@janscas, I utilized your [O365](https://github.com/O365/python-o365) library extensively. Given the rising popularity of LangChain and similar AI frameworks, the convergence of libraries like O365 and tools like this one is likely. So, I wanted to keep you updated on our progress.
Loader for OpenCityData and minor cleanups to Pandas, Airtable loaders
Labels: name: enhancement, name: area: doc loader

Many cities have open data portals for events like crime, traffic, etc.

Socrata provides an API for many, including SF (e.g., see [here](https://dev.socrata.com/foundry/data.sfgov.org/tmnf-yvry)).

This is a new data loader for city data that uses Socrata API.
docs `retrievers` fixes
Labels: name: lgtm

Fixed several inconsistencies:
- file names and notebook titles should be similar otherwise ToC on the [retrievers page](https://python.langchain.com/en/latest/modules/indexes/retrievers.html) and on the left ToC tab are different. For example, now, `Self-querying with Chroma` is not correctly alphabetically sorted because its file named `chroma_self_query.ipynb`
- `Stringing compressors and document transformers...` demoted from `#` to `##`. Otherwise, it appears in Toc.
- several formatting problems

#### Who can review?

@hwchase17 
@dev2049
Qdrant from LangChain failed

### System Info

langchain==0.0.202
qdrant-client==1.2.0

### Who can help?

_No response_

### 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
- [X] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

```
#pip install qdrant-client

from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import Qdrant
from langchain.document_loaders import TextLoader

loader = TextLoader('../../../state_of_the_union.txt')
documents = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
docs = text_splitter.split_documents(documents)
payload = {
    'openai_api_base': 'https://xxxxx',
    'openai_api_key': 'xxxx',
    'model': 'text-embedding-ada-002',
}
embeddings = OpenAIEmbeddings(**payload)
qdrant = Qdrant.from_documents(
    docs, embeddings,
    path="./vectorstores/qdrant/storage",
    collection_name="MyCollection",
)
```

get errors:
<img width="1722" alt="image" src="https://github.com/hwchase17/langchain/assets/42615243/2148b8b6-a5a5-487f-8498-8f3d92bd9457">


### Expected behavior

I thought it would be fine, but this error report makes me wonder how to debug
- Fix pass system_message argument in new feature openai_functions_agent
Labels: name: lgtm

can't pass system_message argument, the prompt always show default message "System: You are a helpful AI assistant."
```
system_message = SystemMessage(
    content="You are an AI that provides information to Human regarding documentation."
)
agent = initialize_agent(
    tools,
    llm=openai_llm_chat,
    agent=AgentType.OPENAI_FUNCTIONS,
    system_message=system_message,
    agent_kwargs={
        "system_message": system_message,
    },
    verbose=False,
)
```

#### Who can review?

Tag maintainers/contributors who might be interested:

<!-- For a quicker response, figure out the right person to tag with @

  @hwchase17 - project lead

  Tracing / Callbacks
  - @agola11

  Async
  - @agola11

  DataLoaders
  - @eyurtsev

  Models
  - @hwchase17
  - @agola11

  Agents / Tools / Toolkits
  - @hwchase17

  VectorStores / Retrievers / Memory
  - @dev2049

 -->
Langchain running on 8000 port (and colliding with my API server)

### System Info

Version: 0.0.170
Platform: Ubuntu 20.04
Python: 3.8.10

### Who can help?

@agol

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

### Reproduction

1) Start a uvicorn server at `127.0.0.1:8000` (with your langchain python endpoint).

2) Initialize an agent via the following:
```
agent_chain = initialize_agent(
            tools,
            self.llm,
            agent="conversational-react-description",
            verbose=True,
            memory=self.memory,
            return_intermediate_steps=True,
        )
```

3) Call the agent via `agent_chain(inputs={"input": "sample text"})` through the aforementioned endpoint.

4) The agent gets stuck and never responds back. I have not defined a time out.

5) Upon examination, it seems it got stuck inside `_load_session()` in `LangChainTracerV1()` in `/langchain/callbacks/tracers/langchain_v1.py`. It seems the port for localhost being sent by `get_endpoint()` is `8000` (which collides with our `localhost`)?

### Expected behavior

An output from the agent
[FEATURE] Cassandra-based Vector Store

### Feature request

This adds support for Apache Cassandra's vector search capabilities
(see [CEP-30](https://cwiki.apache.org/confluence/display/CASSANDRA/CEP-30%3A+Approximate+Nearest+Neighbor(ANN)+Vector+Search+via+Storage-Attached+Indexes).

### Motivation

The importance of Vector Search in nowaday's AI/LLM landscape cannot be overstated. As Cassandra is a first-class database and now offers this feature, it is important to allow Cassandra users to be able to integrate seamlessly with LangChain without having to leave their database (and the associated benefits).

### Your contribution

I can happily develop the extension and provide a PR. As a matter of fact, I already have most of it. This is why I'd like to self-assign :)
Making principal agent stick to a personality (while also robustly selecting tools)

### Issue you'd like to raise.

**BACKGROUND:**
We want to assign a personality to the agent. We simultaneously want this agent to be capable of running/selecting/using multiple tools. We tried passing the personality in the "PREFIX". We tried using prompt template. 

It didn't really work - it wouldn't stick to the personality for long.

However, when we passed the personality string to the "system" role (through OpenAI's API call), it stuck to the personality much longer. 

To pass the personality to the system role, we override your class called OpenAIChat(), like so:

```
class MyOverriddenOpenAIChat(OpenAIChat):
    system_message: str = ""

    def _default_params(self) -> Dict[str, Any]:
        """Get the default parameters for calling OpenAI API."""
        return self.model_kwargs

    def _get_chat_params(
        self, prompts: List[str], stop: Optional[List[str]] = None
    ) -> Tuple:
        if len(prompts) > 1:
            raise ValueError(
                f"MyOverriddenOpenAIChat currently only supports single prompt, got {prompts}"
            )

        # Use the system message here.
        messages = [{"role": "system", "content": self.system_message}] + \
                   self.prefix_messages + [{"role": "user", "content": prompts[0]}]

        params: Dict[str, Any] = {**{"model": self.model_name}, **self._default_params()}  # Invoking the method here
        if stop is not None:
            if "stop" in params:
                raise ValueError("`stop` found in both the input and default params.")
            params["stop"] = stop
        if params.get("max_tokens") == -1:
            # for ChatGPT api, omitting max_tokens is equivalent to having no limit
            del params["max_tokens"]
        return messages, params

```

**PROBLEM:** 
Since you're not supporting the class OpenAIChat() in later versions (and we do want to upgrade to your latest version), how do we achieve passing a personality to the `system` role via your langchain latest version(s)? 

If there is no easy way to pass the personality string to the `system` role via your latest langchain version - what is an alternative route to make a principal agent stick to a personality? 

Please advise.

### Suggestion:

_No response_