debate example fail to work with gemini

**Bug description**
debate example throws error with gemini-pro 1.5.
Websearch works with gemini-pro

**Bug solved method**

**Environment information**
Python 3.9
Conda

- LLM type and model name: Gemini-Pro
- System version:
- Python version: 3.9

**Screenshots or logs**
python3 debate.py "Talk about Artificial General Intelligence"
2024-03-25 17:57:01.666 | INFO     | metagpt.const:get_metagpt_package_root:29 - Package root set to /Users/samsaha2
2024-03-25 17:57:03.800 | INFO     | metagpt.team:invest:90 - Investment: $3.0.
2024-03-25 17:57:03.801 | INFO     | __main__:_act:63 - Biden(Democrat): to do SpeakAloud(SpeakAloud)
2024-03-25 17:57:06.072 | WARNING  | metagpt.utils.common:wrapper:572 - There is a exception in role's execution, in order to resume, we delete the newest role communication message in the role's memory.
2024-03-25 17:57:06.081 | ERROR    | metagpt.utils.common:wrapper:554 - Exception occurs, start to serialize the project, exp:
Traceback (most recent call last):
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/metagpt/utils/common.py", line 563, in wrapper
    return await func(self, *args, **kwargs)
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/metagpt/roles/role.py", line 558, in run
    rsp = await self.react()
ValueError: The `response.text` quick accessor only works for simple (single-`Part`) text responses. This response is not simple text.Use the `result.parts` accessor or the full `result.candidates[index].content.parts` lookup instead.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/metagpt/utils/common.py", line 549, in wrapper
    result = await func(self, *args, **kwargs)
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/metagpt/team.py", line 134, in run
    await self.env.run()
Exception: Traceback (most recent call last):
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/metagpt/utils/common.py", line 563, in wrapper
    return await func(self, *args, **kwargs)
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/metagpt/roles/role.py", line 558, in run
    rsp = await self.react()
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/metagpt/roles/role.py", line 525, in react
    rsp = await self._react()
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/metagpt/roles/role.py", line 471, in _react
    rsp = await self._act()
  File "/Users/samsaha2/debate.py", line 70, in _act
    rsp = await todo.run(context=context, name=self.name, opponent_name=self.opponent_name)
  File "/Users/samsaha2/debate.py", line 41, in run
    rsp = await self._aask(prompt)
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/metagpt/actions/action.py", line 93, in _aask
    return await self.llm.aask(prompt, system_msgs)
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/metagpt/provider/base_llm.py", line 89, in aask
    rsp = await self.acompletion_text(message, stream=stream, timeout=timeout)
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped
    return await fn(*args, **kwargs)
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/tenacity/_asyncio.py", line 47, in __call__
    do = self.iter(retry_state=retry_state)
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/tenacity/__init__.py", line 314, in iter
    return fut.result()
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/tenacity/_asyncio.py", line 50, in __call__
    result = await fn(*args, **kwargs)
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/metagpt/provider/google_gemini_api.py", line 147, in acompletion_text
    return await self._achat_completion_stream(messages)
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/metagpt/provider/google_gemini_api.py", line 127, in _achat_completion_stream
    content = chunk.text
  File "/Users/samsaha2/miniconda3/envs/metagpt/lib/python3.9/site-packages/google/generativeai/types/generation_types.py", line 328, in text
    raise ValueError(
ValueError: The `response.text` quick accessor only works for simple (single-`Part`) text responses. This response is not simple text.Use the `result.parts` accessor or the full `result.candidates[index].content.parts` lookup instead.

{'base_commit': '12948a5482bf4c6c79fb4c84f89bbad3600942e4', 'files': [{'path': 'metagpt/provider/google_gemini_api.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [4, 13], 'mod': [6]}, "('GeminiLLM', '_achat_completion_stream', 138)": {'add': [152], 'mod': [144]}}}, {'path': 'requirements.txt', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [63]}}}]}


When I set up everything and  python3 startup.py "Write a cli snake game", I get this error.

    """,
    "Logic Analysis": [
        ["main.py","Contains the main game loop and user input handling"],
        ["game.py","Contains the game logic, including the snake and food classes"],
        ["snake.py","Contains the Snake class and its methods for moving and eating food"],
        ["food.py","Contains the Food class and its method for generating new food"]
    ],
    "Task list": [
        "main.py",
        "game.py",
        "snake.py",
        "food.py"
    ],
    "Shared Knowledge": """
        'game.py' contains the Game class, which manages the game state and controls the snake and food.
        'snake.py' contains the Snake class, which represents the snake and its movements.
        'food.py' contains the Food class, which represents the food and generates new food when eaten by the snake.
    """,
    "Anything UNCLEAR": "We need to decide on the game's width and height, which will be specified in the API request when starting a new game."
}
[END]
```
Traceback (most recent call last):
  File "/home/user/anaconda3/envs/py11/lib/python3.11/site-packages/tenacity/_asyncio.py", line 50, in __call__
    result = await fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/cx/qianwen/MetaGPT-main/metagpt/actions/action.py", line 78, in _aask_v1
    parsed_data = CustomDecoder(strict=False).decode(content)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/cx/qianwen/MetaGPT-main/metagpt/utils/custom_decoder.py", line 297, in decode
    return super().decode(s)
           ^^^^^^^^^^^^^^^^^
  File "/home/user/anaconda3/envs/py11/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/anaconda3/envs/py11/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/cx/qianwen/MetaGPT-main/startup.py", line 72, in <module>
    fire.Fire(main)
  File "/home/user/anaconda3/envs/py11/lib/python3.11/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/anaconda3/envs/py11/lib/python3.11/site-packages/fire/core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
                                ^^^^^^^^^^^^^^^^^^^^
  File "/home/user/anaconda3/envs/py11/lib/python3.11/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/cx/qianwen/MetaGPT-main/startup.py", line 68, in main
    asyncio.run(startup(idea, investment, n_round, code_review, run_tests, implement))
  File "/home/user/anaconda3/envs/py11/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/home/user/anaconda3/envs/py11/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/anaconda3/envs/py11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/user/cx/qianwen/MetaGPT-main/startup.py", line 47, in startup
    await company.run(n_round=n_round)
  File "/home/user/cx/qianwen/MetaGPT-main/metagpt/software_company.py", line 60, in run
    await self.environment.run()
  File "/home/user/cx/qianwen/MetaGPT-main/metagpt/environment.py", line 67, in run
    await asyncio.gather(*futures)
  File "/home/user/cx/qianwen/MetaGPT-main/metagpt/roles/role.py", line 240, in run
    rsp = await self._react()
          ^^^^^^^^^^^^^^^^^^^
  File "/home/user/cx/qianwen/MetaGPT-main/metagpt/roles/role.py", line 209, in _react
    return await self._act()
           ^^^^^^^^^^^^^^^^^
  File "/home/user/cx/qianwen/MetaGPT-main/metagpt/roles/role.py", line 168, in _act
    response = await self._rc.todo.run(self._rc.important_memory)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/cx/qianwen/MetaGPT-main/metagpt/actions/project_management.py", line 184, in run
    rsp = await self._aask_v1(prompt, "task", OUTPUT_MAPPING, format=format)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/anaconda3/envs/py11/lib/python3.11/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/anaconda3/envs/py11/lib/python3.11/site-packages/tenacity/_asyncio.py", line 47, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/anaconda3/envs/py11/lib/python3.11/site-packages/tenacity/__init__.py", line 326, in iter
    raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x7faeafc5ffd0 state=finished raised JSONDecodeError>]


Tweaks not passing into Text Input Components via API

### Bug Description

For example flow with multiple text inputs, passing tweaks via API doesn't pass in the variables correctly to the component and flow.
Flow Json: [Multi-input flow test.json](https://github.com/user-attachments/files/18242439/Multi-input.flow.test.json)
API Request Body:
{
    "output_type": "text",
    "input_type": "text",
    "tweaks": {
  "TextInput-fDJCN": {
    "input_value": "Elon Musk"
  },
  "TextInput-GHYWO": {
    "input_value": "June 28, 1971"
  }
}}
Response: [tweaks-api-response.json](https://github.com/user-attachments/files/18242442/tweaks-api-response.json)

Fails only on dev/local, seems to work on DataStax Langflow/cloud (https://astra.datastax.com/langflow/) with the same flow json and api request body.

### Reproduction

1. Clone/Fork latest code from https://github.com/langflow-ai/langflow or via cli (uv pip install langflow)
2. Run langflow with make init from codebase or cli (uv run langflow run)
3. Create new flow and import Flow Json above which has 2 text input components - make sure to set OpenAI API key so flow runs without failure
4. Invoke flow via API and use tweaks, setting the following tweaks for the text input components input_value: "TextInput-ABC": {
    "input_value": "Elon Musk"
  },
  "TextInput-XYZ": {
    "input_value": "June 28, 1971"
  }

Expected Results:
AI Response provides a Christmas greeting for Elon and mentions his Birthday

Actual Response:
Prompt asks to provide the name and birthday or uses placeholders

### Expected behavior

AI Response provides a Christmas greeting for Elon and mentions his Birthday

### Who can help?

@italojohnny , @oga

### Operating System

Mac OS 15.2

### Langflow Version

1.1.1

### Python Version

3.11

### Screenshot

Local/Dev API Response:

DataStax Langflow / Cloud API Response:

### Flow File

[Multi-input flow test.json](https://github.com/user-attachments/files/18242478/Multi-input.flow.test.json)

{'base_commit': '0d1c2914a4a601217fb59316e4bfd600b57fd655', 'files': [{'path': 'src/backend/base/langflow/api/v1/endpoints.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [91], 'mod': [11, 30, 45, 47]}, "(None, 'validate_input_and_tweaks', 70)": {'mod': [75, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]}, "(None, 'simple_run_flow', 93)": {'mod': [101, 102, 113, 114, 115, 116, 117, 118, 119]}}}, {'path': 'src/backend/tests/unit/test_endpoints.py', 'status': 'modified', 'Loc': {"(None, 'test_successful_run_no_payload', 275)": {'mod': [290]}, "(None, 'test_successful_run_with_output_type_text', 303)": {'mod': [321]}, "(None, 'test_successful_run_with_output_type_any', 334)": {'mod': [353]}, "(None, 'test_successful_run_with_output_type_debug', 366)": {'mod': [386]}}}]}


Langflow not loading all required Environment variable mentioned in LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT

**Describe the bug**
Trying to load 3 global variables from Environment. only the first variable is loaded and not the second

**Browser and Version**
 - Browser: Edge
 - Version: 126.0.2592.81

**To Reproduce**
Steps to reproduce the behavior:
1. my .env file: includes the lines:

```python

LANGFLOW_STORE_ENVIRONMENT_VARIABLES = true
LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT='["default_gcp_project", "default_gcp_location", "default_gcp_dataset"]'
```
2. launch Langflow: `python -m langflow run  --components-path /src_backend_platform/ --env-file /env/.env`
3. Only the first variable is loaded in Langflow: `default_gcp_project`

**Screenshots**

![image](https://github.com/langflow-ai/langflow/assets/36305975/cd106870-c6e1-4e92-bb20-be1394c14621)


Unable to upload file to folder

**Describe the bug**
Unable to upload file to folder due to key error when selecting `folder_name` from the `flow. I see that a recent commit has made it such that each flow will have a default folder name, if none exists, but this not backwards-compatible with existing flows made in <=v1.0.0a38. Also - I would have expected the payload to send _my_ folder that I want the flow created in, not for it to create a folder in my store.

(EDIT: I see that that recent change was just for making sure the flow was _in_ a folder, but does not export that folder name in the json, so that's an invalid concern. Seems we just may need to pass the selected folder to the /folders/upload endpoint)

https://github.com/langflow-ai/langflow/blob/543e8d52afbb8e64ae22255909f4453484b2bb07/src/backend/base/langflow/api/v1/folders.py#L194

**Browser and Version**
 - Browser [e.g. chrome, safari] firefox
 - Version [e.g. 22] v1.0.0a38

**To Reproduce**
Steps to reproduce the behavior:
1. pip install
2. run
3. create folder
4. upload a flow
5. see logs

**logs**

```
                             │ langflow/.venv/lib/python3.11/site-packages/langflow/api/v1/folders.py:209 in upload_file                                  │
                             │                                                                                │
                             │   206 │                                                                                │
                             │   207 │   folder_results = session.exec(                                                                                │
                             │   208 │   │   select(Folder).where(                                                                                │
                             │ ❱ 209 │   │   │   Folder.name == data["folder_name"],                                                                                │
                             │   210 │   │   │   Folder.user_id == current_user.id,                                                                                │
                             │   211 │   │   )                                                                                │
                             │   212 │   )                                                                                │
                             ╰──────────────────────────────────────────────────────────
                             KeyError: 'folder_name'
```

**Fix(?)**
* Pass currently selected folder to payload when uploading
* Use that as the folder name in `/folders/upload`
* Add test for `/folders/upload`

{'base_commit': '395c2d7372dffcf1d4f9577f623a2966183595d9', 'files': [{'path': 'src/frontend/src/components/sidebarComponent/components/sideBarFolderButtons/index.tsx', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [126]}}}]}


Traces not being captured anymore

### Bug Description

Hello there,

The recent changes on the build process caused `end_all_traces` to no longer being called, as a result the final call to send the traces for langwatch, langfuse etc are not being called:

https://github.com/langflow-ai/langflow/pull/5940#issuecomment-2685617499

### Reproduction

1. Set up LANGWATCH_API_KEY
2. Traces are not arriving to langwatch
3. Add print statements on `end_all_traces`
4. Verify it's not being called

### Expected behavior

`end_all_traces` should be called during executions on the langflow canvas, playground and api

### Who can help?

@edwinjosechittilappilly @ogabrielluiz @italojohnny

### Operating System

Mac OSX

### Langflow Version

15.3

### Python Version

3.11

### Screenshot

_No response_

### Flow File

_No response_

{'base_commit': '9c69d134c9a4a34865d44e6f37a2c513c3a49969', 'files': [{'path': 'src/backend/base/langflow/api/build.py', 'status': 'modified', 'Loc': {"(None, 'generate_flow_events', 145)": {'add': [427]}}}]}


Langflow traces are not well reflected in Langfuse

### Bug Description

Not able to see Langflow components inputs and outputs in Langfuse tracing.
For instance, for a given component, you will see the component python code instead of the input data. And the Output is completely empty.

See screenshot below.

### Reproduction

1. create a simple flow with chat input, prompt, and a chat output! flow example [reproduce _error_langfuse (1).json](https://github.com/user-attachments/files/17446337/reproduce._error_langfuse.1.json)
2. connect to Langfuse, and see trace.
3. notice that components input are tracking the python code of the component and not the data inputted
4. notice that the component output is empty

see screenshow:
![image](https://github.com/user-attachments/assets/9461c3f1-cf90-430a-8d38-54ab61418e99)

### Expected behavior

I'm expecting to see input data (not the python code) and output data of each components.

### Who can help?

@italojohnny

### Operating System

Ubuntu

### Langflow Version

1.0.19

### Python Version

3.10

### Screenshot

![image](https://github.com/user-attachments/assets/9461c3f1-cf90-430a-8d38-54ab61418e99)

### Flow File

[reproduce _error_langfuse (1).json](https://github.com/user-attachments/files/17446337/reproduce._error_langfuse.1.json)

{'base_commit': 'b1a552fa9ed7d4c4eabb90642f4b81f24775f676', 'files': [{'path': 'src/backend/base/langflow/api/utils.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [144], 'mod': [20]}, "(None, 'build_graph_from_data', 145)": {'add': [146]}}}, {'path': 'src/backend/base/langflow/api/v1/chat.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [13], 'mod': [45]}, "(None, 'build_graph_and_get_order', 161)": {'mod': [169]}}}, {'path': 'src/backend/base/langflow/custom/custom_component/component.py', 'status': 'modified', 'Loc': {"('Component', 'get_trace_as_inputs', 798)": {'mod': [804, 805, 806]}}}, {'path': 'src/backend/base/langflow/services/tracing/langwatch.py', 'status': 'modified', 'Loc': {"('LangWatchTracer', '__init__', 26)": {'add': [43]}}}, {'path': 'src/backend/base/langflow/services/tracing/service.py', 'status': 'modified', 'Loc': {"('TracingService', '_end_traces', 174)": {'add': [186]}, "('TracingService', '_end_all_traces', 188)": {'add': [194]}, "('TracingService', 'end', 196)": {'mod': [198]}, "('TracingService', '_end_and_reset', 235)": {'mod': [239]}}}, {'path': 'src/backend/tests/unit/events/test_event_manager.py', 'status': 'modified', 'Loc': {"('TestEventManager', None, 11)": {'mod': [39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52]}, "('TestEventManager', 'test_handling_large_number_of_events', 72)": {'mod': [73]}, "('TestEventManager', 'test_performance_impact_frequent_registrations', 136)": {'mod': [137]}}}]}


**Describe the bug**
I'm getting a column size error when using MySQL.
It seems to executed when initial setup starter_projects

```
sqlalchemy.exc.DataError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
                             (pymysql.err.DataError) (1406, "Data too long for column 'description' at row 1")
                             [SQL: INSERT INTO flow (name, description, icon, icon_bg_color, is_component, updated_at, folder, id, data, user_id) VALUES (%(name)s, %(description)s, %(icon)s,
                             %(icon_bg_color)s, %(is_component)s, %(updated_at)s, %(folder)s, %(id)s, %(data)s, %(user_id)s)]
                             [parameters: {'name': 'Basic Prompting (Hello, World)', 'description': 'This flow will get you experimenting with the basics of the UI, the Chat and the Prompt component.
                             \n\nTry changing the Template in it to see how the ... (26 characters truncated) ... change it to this and a Text Input into the `type_of_person` variable : "Answer the
                             user as if you were a pirate.\n\nUser: {user_input}\n\nAnswer: " ', 'icon': '', 'icon_bg_color': None, 'is_component': 0, 'updated_at': datetime.datetime(2024, 5, 14, 9,
                             36, 35, 63929, tzinfo=datetime.timezone.utc), 'folder': 'Starter Projects', 'id': '5d216c873f0f4c5a98ec1c85438a90f4', 'data': '{"nodes": [{"id": "Prompt-uxBqP", "type":
                             "genericNode", "position": {"x": 53.588791333410654, "y": -107.07318910019967}, "data": {"type": "Prompt",  ... (24099 characters truncated) ...
                             153Text\\u0153],\\u0153type\\u0153:\\u0153str\\u0153}"}], "viewport": {"x": 260.58251815500563, "y": 318.2261172111936, "zoom": 0.43514115784696294}}', 'user_id': None}]
                             (Background on this error at: https://sqlalche.me/e/20/9h9h)
```
**Screenshots**

**Additional context**
plz help

{'base_commit': '06ea6c408bd5da392aa3650f9d04be0804742525', 'files': [{'path': 'src/backend/base/langflow/services/database/models/flow/model.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [13]}, "('FlowBase', None, 26)": {'mod': [28]}}}, {'path': 'src/backend/base/langflow/services/database/models/folder/model.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [4, 5]}, "('FolderBase', None, 14)": {'mod': [16]}}}]}


Trivial focused PRs

### Duplicates

- [X] I have searched the existing issues

### Summary 💡

There are many trivial PRs which are harmless and focused enough, so it's good to make them merged in a batch to reduce the backlog. These are ALL minor mergeable fixes at the moment (2023-04-10T10:57Z)

### Examples 🌈

- #33 - The oldest open PR. Now made focused, only adds documentation strings, with very minor extra whitespace
- #115 - Better error messages if OpenAI keys are missing from the config. A single check at the startup. Safe and focused.
- #126 - Just a typo in Readme. 3 chars diff, 1 line
- #179 - Windows beginners don't like $ in the commandline example. 2 chars 1 line diff.
- #226 - Just a single COPY Dockerfile instruction people repeat in PRs over and over. 1 line added diff
- #317 - A trivial improvement of the Readme.
- #338 - A trivial safety warning in the Readme. 1 line diff
- #378 - A trivial typo (and the file ending change is ok, some editors correctly keep fixing it)
- #421 - Documentation for 2 classes. Minor extra whitespace fixes, can be merged IMO
- #457 - A pretty small addition of the debug option
- #579 - A trivial link mistake. 5 char diff
- #590 - The whitespace fixes everybody keeps repeating.
- #611 - A single line addition to .gitignore everybody keeps repeating
- #615 - A single line 7 character fix to Windows setx invocation in the Readme
- #649 - A minor fixup to already merged #575. 10 chars on one line.

### Motivation 🔦

We need to improve the backlog by merging as many PRs a day as possible. Many PRs were bad but thanks to our efforts are pinpointed now. Also, big changes tend to include these small fixes, so by applying the small ones we will improve the big ones too.

{'base_commit': 'da6c0240de37725780f59eb8da7c36a9e810ae5c', 'files': [{'path': 'scripts/agent_manager.py', 'status': 'modified', 'Loc': {"(None, 'create_agent', 9)": {'add': [9]}, "(None, 'message_agent', 34)": {'add': [34]}, "(None, 'list_agents', 54)": {'add': [54]}, "(None, 'delete_agent', 61)": {'add': [61]}}}, {'path': 'scripts/ai_config.py', 'status': 'modified', 'Loc': {"('AIConfig', None, 5)": {'add': [5, 6, 29, 34]}, "('AIConfig', 'load', 15)": {'mod': [16]}}}, {'path': 'scripts/ai_functions.py', 'status': 'modified', 'Loc': {"(None, 'evaluate_code', 10)": {'add': [10]}, "(None, 'improve_code', 22)": {'add': [22]}, "(None, 'write_tests', 36)": {'add': [36]}}}, {'path': 'scripts/browse.py', 'status': 'modified', 'Loc': {"(None, 'scrape_text', 8)": {'add': [8]}, "(None, 'extract_hyperlinks', 35)": {'add': [35]}, "(None, 'format_hyperlinks', 42)": {'add': [42]}, "(None, 'scrape_links', 49)": {'add': [49]}, "(None, 'split_text', 66)": {'add': [66]}, "(None, 'create_message', 84)": {'add': [84]}, "(None, 'summarize_text', 90)": {'add': [90]}}}, {'path': 'scripts/call_ai_function.py', 'status': 'modified', 'Loc': {"(None, 'call_ai_function', 8)": {'add': [8]}}}, {'path': 'scripts/chat.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [10], 'mod': [7]}, "(None, 'chat_with_ai', 44)": {'add': [50]}}}, {'path': 'scripts/commands.py', 'status': 'modified', 'Loc': {"(None, 'get_command', 27)": {'add': [27]}, "(None, 'execute_command', 55)": {'add': [55]}, "(None, 'get_datetime', 120)": {'add': [120]}, "(None, 'google_search', 125)": {'add': [125]}, "(None, 'google_official_search', 132)": {'add': [132]}, "(None, 'browse_website', 167)": {'add': [167]}, "(None, 'get_text_summary', 180)": {'add': [180]}, "(None, 'get_hyperlinks', 186)": {'add': [186]}, "(None, 'commit_memory', 191)": {'add': [191]}, "(None, 'delete_memory', 197)": {'add': [197]}, "(None, 'overwrite_memory', 208)": {'add': [208]}, "(None, 'shutdown', 234)": {'add': [234]}, "(None, 'start_agent', 239)": {'add': [239]}, "(None, 'message_agent', 262)": {'add': [262]}, "(None, 'list_agents', 280)": {'add': [280]}, "(None, 'delete_agent', 284)": {'add': [284]}}}, {'path': 'scripts/config.py', 'status': 'modified', 'Loc': {"('Singleton', None, 9)": {'add': [16]}, "('Config', None, 28)": {'add': [33, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115]}}}, {'path': 'scripts/data.py', 'status': 'modified', 'Loc': {"(None, 'load_prompt', 4)": {'add': [4]}}}, {'path': 'scripts/execute_code.py', 'status': 'modified', 'Loc': {"(None, 'execute_python_file', 5)": {'add': [5]}}}, {'path': 'scripts/file_operations.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [6]}, "(None, 'safe_join', 11)": {'add': [11]}, "(None, 'read_file', 21)": {'add': [21]}, "(None, 'write_to_file', 31)": {'add': [31]}, "(None, 'append_to_file', 44)": {'add': [44]}, "(None, 'delete_file', 54)": {'add': [54]}}}, {'path': 'scripts/json_parser.py', 'status': 'modified', 'Loc': {"(None, 'fix_and_parse_json', 29)": {'add': [32]}, "(None, 'fix_json', 74)": {'add': [74]}}}, {'path': 'scripts/llm_utils.py', 'status': 'modified', 'Loc': {"(None, 'create_chat_completion', 8)": {'add': [8]}}}, {'path': 'scripts/main.py', 'status': 'modified', 'Loc': {"(None, 'print_to_console', 21)": {'add': [27]}, "(None, 'print_assistant_thoughts', 48)": {'add': [48]}, "(None, 'construct_prompt', 161)": {'add': [161]}, "(None, 'prompt_user', 189)": {'add': [189]}, "(None, 'parse_arguments', 241)": {'add': [241]}, "(None, 'load_variables', 107)": {'mod': [108]}}}, {'path': 'scripts/speak.py', 'status': 'modified', 'Loc': {"(None, 'eleven_labs_speech', 17)": {'add': [17]}}}, {'path': 'scripts/spinner.py', 'status': 'modified', 'Loc': {"('Spinner', None, 7)": {'add': [7, 8, 15, 22, 27]}}}]}


Ver 0.4, and still get the error of "This model's maximum context length is 4097 tokens"

### ⚠ Search for existing issues first ⚠

- [X] I have searched the existing issues, and there is no existing issue for my problem

### Which Operating System are you using?

Windows

### Which version of Auto-GPT are you using?

Latest Release

### Do you use OpenAI GPT-3 or GPT-4?

GPT-3.5

### Which area covers your issue best?

Commands

### Describe your issue.

AutoGPT crashes in the same scenario as v0.3.1 when working with "large" local files.

### Upload Activity Log Content

_No response_

### Upload Error Log Content

Traceback (most recent call last):   File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main     return _run_code(code, main_globals, None,   File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code     exec(code, run_globals)   File "/workspace/Auto-GPT/autogpt/__main__.py", line 5, in <module>     autogpt.cli.main()   File "/home/vscode/.local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__     return self.main(*args, **kwargs)   File "/home/vscode/.local/lib/python3.10/site-packages/click/core.py", line 1055, in main     rv = self.invoke(ctx)   File "/home/vscode/.local/lib/python3.10/site-packages/click/core.py", line 1635, in invoke     rv = super().invoke(ctx)   File "/home/vscode/.local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke     return ctx.invoke(self.callback, **ctx.params)   File "/home/vscode/.local/lib/python3.10/site-packages/click/core.py", line 760, in invoke     return __callback(*args, **kwargs)   File "/home/vscode/.local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func     return f(get_current_context(), *args, **kwargs)   File "/workspace/Auto-GPT/autogpt/cli.py", line 96, in main     run_auto_gpt(   File "/workspace/Auto-GPT/autogpt/main.py", line 197, in run_auto_gpt     agent.start_interaction_loop()   File "/workspace/Auto-GPT/autogpt/agent/agent.py", line 130, in start_interaction_loop     assistant_reply = chat_with_ai(   File "/workspace/Auto-GPT/autogpt/llm/chat.py", line 112, in chat_with_ai     new_summary_message, trimmed_messages = agent.history.trim_messages(   File "/workspace/Auto-GPT/autogpt/memory/message_history.py", line 79, in trim_messages     new_summary_message = self.update_running_summary(   File "/workspace/Auto-GPT/autogpt/memory/message_history.py", line 194, in update_running_summary     self.summary = create_chat_completion(prompt)   File "/workspace/Auto-GPT/autogpt/llm/utils/__init__.py", line 53, in metered_func     return func(*args, **kwargs)   File "/workspace/Auto-GPT/autogpt/llm/utils/__init__.py", line 87, in _wrapped     return func(*args, **kwargs)   File "/workspace/Auto-GPT/autogpt/llm/utils/__init__.py", line 235, in create_chat_completion     response = api_manager.create_chat_completion(   File "/workspace/Auto-GPT/autogpt/llm/api_manager.py", line 61, in create_chat_completion     response = openai.ChatCompletion.create(   File "/home/vscode/.local/lib/python3.10/site-packages/openai/api_resources/chat_completion.py", line 25, in create     return super().create(*args, **kwargs)   File "/home/vscode/.local/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create     response, _, api_key = requestor.request(   File "/home/vscode/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 226, in request     resp, got_stream = self._interpret_response(result, stream)   File "/home/vscode/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 619, in _interpret_response     self._interpret_response_line(   File "/home/vscode/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 682, in _interpret_response_line     raise self.handle_error_response( openai.error.InvalidRequestError: This model's maximum context length is 4097 tokens. However, your messages resulted in 4904 tokens. Please reduce the length of the messages. Press any key to continue...


Move to a single source of truth for docs — Remove duplicate info from readme

autogpt_platform\\backend\\README.advanced.md and autogpt_platform\\backend\\README.md. We should just point people to the docs directory (docs/platform/advanced_setup|getting-started) in these. Check the content is all in that file, and the normal getting started, then remove these two files and replace with a link to the docs site — the dev-docs.agpt.co and docs.agpt.co. Call out both and their branch match for released master vs dev branch


Not creating pinecone index

### Duplicates

- [X] I have searched the existing issues

### Steps to reproduce 🕹

I by mistake deleted my pinecone index.  When i fire up auto-gpt it does not make me a new one but functions correctly.  I have tried starting fresh, but same issue. Works fine but is not triggering pinecone.

### Current behavior 😯

i download a fresh copy and fill in the .env and it starts but does not create a pinecone index.

### Expected behavior 🤔

Every other time ive loaded it it creates the index and then communicates with it.

### Your prompt 📝

```yaml
# Paste your prompt here
```

{'base_commit': 'f9d8f728fa3c60dba80cc1c69dfef8bf748eaec4', 'files': [{'path': '.env.template', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [19]}}}, {'path': 'README.md', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [232]}}}]}


Pinecone Error

### Duplicates

- [X] I have searched the existing issues

### Steps to reproduce 🕹

`
Traceback (most recent call last):
  File "scripts/main.py", line 286, in <module>
    memory = PineconeMemory()
  File "/Users/areebpasha/Desktop/Auto GPT copy/Auto-GPT/scripts/config.py", line 17, in __call__
    cls._instances[cls] = super(
  File "/Users/areebpasha/Desktop/Auto GPT copy/Auto-GPT/scripts/memory.py", line 30, in __init__
    if table_name not in pinecone.list_indexes():
  File "/opt/anaconda3/lib/python3.8/site-packages/pinecone/manage.py", line 185, in list_indexes
    response = api_instance.list_indexes()
  File "/opt/anaconda3/lib/python3.8/site-packages/pinecone/core/client/api_client.py", line 776, in __call__
    return self.callable(self, *args, **kwargs)
  File "/opt/anaconda3/lib/python3.8/site-packages/pinecone/core/client/api/index_operations_api.py", line 1132, in __list_indexes
    return self.call_with_http_info(**kwargs)
  File "/opt/anaconda3/lib/python3.8/site-packages/pinecone/core/client/api_client.py", line 838, in call_with_http_info
    return self.api_client.call_api(
  File "/opt/anaconda3/lib/python3.8/site-packages/pinecone/core/client/api_client.py", line 413, in call_api
    return self.__call_api(resource_path, method,
  File "/opt/anaconda3/lib/python3.8/site-packages/pinecone/core/client/api_client.py", line 200, in __call_api
    response_data = self.request(
  File "/opt/anaconda3/lib/python3.8/site-packages/pinecone/core/client/api_client.py", line 439, in request
    return self.rest_client.GET(url,
  File "/opt/anaconda3/lib/python3.8/site-packages/pinecone/core/client/rest.py", line 236, in GET
    return self.request("GET", url,
  File "/opt/anaconda3/lib/python3.8/site-packages/pinecone/core/client/rest.py", line 202, in request
    r = self.pool_manager.request(method, url,
  File "/opt/anaconda3/lib/python3.8/site-packages/urllib3/request.py", line 74, in request
    return self.request_encode_url(
  File "/opt/anaconda3/lib/python3.8/site-packages/urllib3/request.py", line 96, in request_encode_url
    return self.urlopen(method, url, **extra_kw)
  File "/opt/anaconda3/lib/python3.8/site-packages/urllib3/poolmanager.py", line 376, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/opt/anaconda3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/opt/anaconda3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 398, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/opt/anaconda3/lib/python3.8/site-packages/urllib3/connection.py", line 239, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/opt/anaconda3/lib/python3.8/http/client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/opt/anaconda3/lib/python3.8/http/client.py", line 1296, in _send_request
    self.putheader(hdr, value)
  File "/opt/anaconda3/lib/python3.8/site-packages/urllib3/connection.py", line 224, in putheader
    _HTTPConnection.putheader(self, header, *values)
  File "/opt/anaconda3/lib/python3.8/http/client.py", line 1232, in putheader
    if _is_illegal_header_value(values[i]):
TypeError: expected string or bytes-like object
`

### Current behavior 😯

Does not produce output.

### Expected behavior 🤔

Should work as shown in the demo. Any assistance is greatly appreciated.

### Your prompt 📝

```yaml
# Paste your prompt here
```

{'base_commit': 'c6d90227fecec8acc1481c486a91337b07e8a820', 'files': [{'path': 'README.md', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [61]}}}, {'path': 'scripts/main.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [283]}}}]}


### Duplicates

- [X] I have searched the existing issues

### Steps to reproduce 🕹

1. Build a dockerized version of aouto-gpt
2. Give it any instruction that leads to it needing to browse_website

### Current behavior 😯

SYSTEM:  Command browse_website returned: Error: Message: Service /home/appuser/.wdm/drivers/chromedriver/linux64/112.0.5615.49/chromedriver unexpectedly exited. Status code was: 127

### Expected behavior 🤔

Should be bale to browse website properly

### Your prompt 📝

```yaml
# It really could be any prompt
```

{'base_commit': 'ad7cefa10c0647feee85114d58559fcf83ba6743', 'files': [{'path': 'Dockerfile', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [6]}}}]}


Enriching the auto-generated OpenAPI-Spec

**Description**
Hi there, new to FastAPI so sorry if this question has been asked elsewhere:

What is the best way to enrich the auto-generated OpenAPI-Spec generated by FastAPI. It currently seems to support only a few things (like changing the title or description), but  if I would want to add tags to group my endpoints or do sth more fancy like adding a logo (which is supported by ReDoc via x-logo) it seems to me that I would want to use FastAPI to generate the base specification and then add some scripts that will enrich this spec in a structured way?

Has anyone encountered this issue before?

**Additional context**
I already looked into the code a little bit and it seems that the ReDoc that gets shown when serving the API is generated on the fly (as is the OpenAPI schema) => this seems to make a custom processing of the specification to make use of cool ReDoc features harder


Would be nice to be able to route request using header's Accept field (or generic header's field)

### First Check

- [X] I added a very descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the FastAPI documentation, with the integrated search.
- [X] I already searched in Google "How to X in FastAPI" and didn't find any information.
- [X] I already read and followed all the tutorial in the docs and didn't find an answer.
- [X] I already checked if it is not related to FastAPI but to [Pydantic](https://github.com/samuelcolvin/pydantic).
- [X] I already checked if it is not related to FastAPI but to [Swagger UI](https://github.com/swagger-api/swagger-ui).
- [X] I already checked if it is not related to FastAPI but to [ReDoc](https://github.com/Redocly/redoc).

### Commit to Help

- [X] I commit to help with one of those options 👆

### Example Code

```python
N.A.
```

### Description

In some cases would be nice to specify header's field as routing rules.

One important example is to support API versioning based on Header's Accept field

### Wanted Solution

Ability to specify some header's fields in the `.get()`, `.post()` .... decorators

### Wanted Code

```python
from fastapi import FastAPI

app = FastAPI()

@app.get("/", accept="application/json;version=1.0")
async def root():
    return {"message": "Hello World v1.0"}

@app.get("/", accept="application/json;version=1.1")
async def root():
    return {"message": "Hello World v1.1"}
```

### Alternatives

from fastapi import FastAPI

app = FastAPI()

@app.get("/", headers={"accept": "application/json;version=1.0"})
async def root():
    return {"message": "Hello World v1.0"}

@app.get("/", headers={"accept": "application/json;version=1.1"})
async def root():
    return {"message": "Hello World v1.1"}

### Operating System

macOS

### Operating System Details

_No response_

### FastAPI Version

python -c "import fastapi; print(fastapi.__version__)"

### Python Version

Python 3.9.7

### Additional Context

_No response_


pass method return value as positional parameters to Response

Recently I've noticed that `status_code` parameter of the next statement is useless:
```python3
@router.get('/callback/{provider}', status_code=303,
            response_description='Redirect to the application login',
            response_class=RedirectResponse)
```
Because I always have to create `RedirectResponse` objects manually:
```python3
        return RedirectResponse(target.include_query_params(error=f'{provider}_{error_reason}'),
                                status_code=303)
```

I've tried to play with return values and noticed that return value is always passed to `response_class` instance as a `content` parameter:
```python3
@app.get('/test', status_code=303, response_class=RedirectResponse)
async def test():
    return '/'
```
this snippet produces the next exception:
```
INFO:     127.0.0.1:43878 - "GET /test HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/dmig/.pyenv/versions/fastapi-sandbox/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 385, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/home/dmig/.pyenv/versions/fastapi-sandbox/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/home/dmig/.pyenv/versions/fastapi-sandbox/lib/python3.8/site-packages/fastapi/applications.py", line 171, in __call__
    await super().__call__(scope, receive, send)
  File "/home/dmig/.pyenv/versions/fastapi-sandbox/lib/python3.8/site-packages/starlette/applications.py", line 102, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/dmig/.pyenv/versions/fastapi-sandbox/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/home/dmig/.pyenv/versions/fastapi-sandbox/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/home/dmig/.pyenv/versions/fastapi-sandbox/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/home/dmig/.pyenv/versions/fastapi-sandbox/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/home/dmig/.pyenv/versions/fastapi-sandbox/lib/python3.8/site-packages/starlette/routing.py", line 550, in __call__
    await route.handle(scope, receive, send)
  File "/home/dmig/.pyenv/versions/fastapi-sandbox/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/home/dmig/.pyenv/versions/fastapi-sandbox/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
    response = await func(request)
  File "/home/dmig/.pyenv/versions/fastapi-sandbox/lib/python3.8/site-packages/fastapi/routing.py", line 217, in app
    response = response_class(
TypeError: __init__() got an unexpected keyword argument 'content'
```

I didn't dive into the code yet, so this is not a PR but a request. But the idea is simple:
```python3
response  = response_class(*(endpoint_result if isinstance(endpoint_result, (Tuple, List)) else tuple(endpoint_result)))
```
Or maybe even more complex logic: pass `**endpoint_result` if `endpoint_result` is a `Mapping`, pass `*endpoint_result` if it is an `Iterable` or else pass it as a `*tuple(endpoint_result)`


Bad encoding in query parameters with new TestClient using httpx.Client

### First Check

- [X] I added a very descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the FastAPI documentation, with the integrated search.
- [X] I already searched in Google "How to X in FastAPI" and didn't find any information.
- [X] I already read and followed all the tutorial in the docs and didn't find an answer.
- [X] I already checked if it is not related to FastAPI but to [Pydantic](https://github.com/samuelcolvin/pydantic).
- [X] I already checked if it is not related to FastAPI but to [Swagger UI](https://github.com/swagger-api/swagger-ui).
- [X] I already checked if it is not related to FastAPI but to [ReDoc](https://github.com/Redocly/redoc).

### Commit to Help

- [X] I commit to help with one of those options 👆

### Example Code

```python
import logging

from fastapi import FastAPI

app = FastAPI()

@app.get("/example")
async def _show_encoding_error(look_for: str):
    return {"found": look_for}

if __name__ == '__main__':
    from fastapi.testclient import TestClient

    with TestClient(app) as client:
        params = {"look_for": "plain text"}
        resp = client.get("/example", params=params).json()
        logging.warning(resp)
        assert resp["found"] == "plain text"

        params = {"look_for": "España"}
        resp = client.get("/example", params=params).json()
        logging.warning(resp)
        assert resp["found"] == "España", resp["found"]
```

### Description

After the change to `httpx` for the `TestClient` in **v0.87.0**, the query parameters are not properly encoded? when sending requests with it, and strings are corrupted when received in the endpoints.

The example app works as expected if called from the SwaggerUI or from another python process using a _plain_ `httpx.Client`, so it appears something broke with the new wrapping for `TestClient` 🥲

```python
import httpx

params = {"look_for": "España"}
with httpx.Client(base_url="http://localhost:8000/") as client:
    resp = client.get("/example", params=params).json()
    assert resp["found"] == "España"
```

### Operating System

macOS

### Operating System Details

M1, running arm64 arch

### FastAPI Version

0.87.0

### Python Version

Python 3.10.5

### Additional Context

starlette-0.21
httpx-0.23.0

Discovered when trying to migrate the test suite for a ~big project previously using fastapi-0.85.1 + starlette-0.20.4.

All minor syntax changes from old `requests` to new `httpx` were under control, but in one unit test, **a string with an accent** was making some search to fail without results (test is sending "Formalización" but endpoint is receiving **"FormalizaciÃ³n"** 😱), and I was getting crazy 😅

{'base_commit': '4638b2c64e259b90bef6a44748e00e405825a111', 'files': [{'path': 'pyproject.toml', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [42]}}}, {'path': 'tests/test_starlette_urlconvertors.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [21, 47], 'mod': [1]}}}]}


French translations

# Bonjour 🇫🇷

Welcome to the issue that coordinates the French translation effort.

## Purpose

- Avoiding several people working on the same document at the same time.

The first person who declares that he/she is working on a translation gets the responsibility to carry it out. If a PR seems to be stalled, we can discuss a transfer of responsibility here.

- Enforcing best practices

Best practices are listed later in this description. You can propose your practice at any time, ideally with a supporting source and an example.

Defining and sharing best practices will help to avoid common mistakes and will allow faster and easier reviews.

- Help and build the community

Do not hesitate to ask any questions regarding the french translation effort here. The stronger the community, the more effective we will be and the more we will enjoy.

- Provide a french translation for this awesome library (last but not least)

If you are here, you probably like **FastAPI**, and maybe you even speak French. Giving more people the opportunity to get started using the documentation in its native language will encourage adoption. In that spirit, let's contribute to the magic of open source in this way.

## How to contribute

### Review

Keep in mind that the easiest way to participate is to review the PRs. We need to avoid accumulating PRs waiting for review.

### Translate

If you are not familiar with contributing to open source projects have a look at https://github.com/firstcontributions/first-contributions.

In any case, take a look at the documentation section related to the [contribution](https://fastapi.tiangolo.com/contributing/#development-contributing) and more precisely the part about the [documentation](https://fastapi.tiangolo.com/contributing/#docs).

Once you are decided to translate a document, make yourself known here by leaving a message here (eg. https://github.com/tiangolo/fastapi/issues/1972#issuecomment-702956335).

### Organize

If you wish, your energy is welcome to help with the organization. Bringing together motivated people and helping them get the job done is essential. Moreover, we can surely learn a lot from the translation work of other languages that are much more advanced and we can have a significant impact if we put good processes in place that can help the whole community

## Good practices

- technical terms

Technical terms do not need to be translated. It is also a question of common sense, in certain conditions English can be preferred because the French version is not in use.
See: https://github.com/tiangolo/fastapi/issues/1972#issuecomment-715500921

- punctuation and typography

For example, missing whitespace before/after punctuation. You can rely on [this page](https://leconjugueur.lefigaro.fr/ukponctuationtypographie.php) to help you.
see: https://github.com/tiangolo/fastapi/pull/1973#issuecomment-1186304199

- structure the PR by commit

Splitting the commit will ease the review and helps to track the change on the original documentation while the PR is open.
(see: [example](https://github.com/tiangolo/fastapi/pull/2234/commits)).

The first commit should only contain the copy of the English version of the document to the french one. With the exact same content (eg. 30f1dd6966ceedd9e8bea2d7aac7bbded9bbc568).

The second one is dedicated the index update (eg. 8ff5f7a6d4510819f95d570ac6a1d3279e2595ed)

And starting from this point you can start the translation. Notice that, thanks to this structure we can directly compare the two languages (eg. 3729f5b1c2bc858b15266aa4eae21bce07eb04c0).

Also, if the English document got updated, we just have to update the first commit and the conflicts will reveal updated part of the document 🪄

## Recommended tools

- https://www.deepl.com
- https://www.linguee.fr
- https://www.wordreference.com
- https://french.stackexchange.com

{'base_commit': '3127bc4e05b72e39d1681735ec1ee49844b7dc88', 'files': [{'path': 'docs/fr/mkdocs.yml', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [58]}}}]}


Support body in GET and other methods with undefined behavior

**Describe the bug**
In new version of rest api specification get methods can have body but fastapi not add it to swagger spec.

**To Reproduce**
Steps to reproduce the behavior:
Create get method with some body parameters.

**Expected behavior**
Body parameters present in the specification.

**Environment:**
 - OS: Windows
 - FastAPI Version: 0.42.0

- Python version, get it with: 3.8

{'base_commit': '3ff504f03fb5ba852def5a0a41653c6bed7efb1b', 'files': [{'path': 'docs/en/docs/tutorial/body.md', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [12, 14]}}}, {'path': 'fastapi/dependencies/utils.py', 'status': 'modified', 'Loc': {"(None, 'get_typed_annotation', 246)": {'mod': [249]}}}, {'path': 'fastapi/openapi/constants.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [1]}}}]}


question
answered
reviewed
question-migrate

be able to host statics myself

**Is your feature request related to a problem? Please describe.**
I am using FastAPI on my private network and can't connect to the internet. but the `/docs` use cdn. I cannot visit that page.

Although I can rewrite /docs router to replace the html template , and add a /staitc route , but I feel a bit ugly. I wish there is some config for it.

**Describe the solution you'd like**

add two variable for FastAPI
```
api = FastAPI(static_prefix="/statics", static_url="/data/swagger-dist/")
```
with static_prefix="/statics", the /docs html may look like:
```html
<link type="text/css" rel="stylesheet" href="/statics/swagger-ui.css">
```

with static_url="/data/swagger-dist/" , FastAPI will add router for static_prefix automatically, like
```python
self.router.get(self.static_prefix, response_description=PlainTextResponse, ...)
```

**Describe alternatives you've considered**
If you don't want to handle statics, just ignore ``static_url`` , I can create it myself, or put it behind nginx.

If do so, you may need to write in the document how to download all static files .

**Additional context**


Add __all__ to __init__.py files to silence mypy(strict) errors

Strict mypy mode gives such errors:
```
base/api/users/controllers.py:4: error: Module 'fastapi' has no attribute 'Depends'
base/api/users/controllers.py:4: error: Module 'fastapi' has no attribute 'HTTPException'
```

on such import statement:
```
from fastapi import Depends, HTTPException
```

Tried using

```
from fastapi import Depends as Depends
from fastapi import HTTPException as HTTPException
```
as per recommendations in https://github.com/tiangolo/typer/issues/112 discussion. But the errors remain.

It seems that adding __all__ to the __init__.py files for the stuff that's reexported is a way to go (as per https://github.com/python/mypy/issues/7042 discussion).

Thanks for considering this!


Please support latest SQLAlchemy or pin it

Hi @tiangolo, fastapi tests are currently failing and therefore causing pydantic tests to fail.

See https://github.com/samuelcolvin/pydantic/pull/2584, fastapi is not compatible with the v1.4 of SQLAlchemy which was released earlier in March, I've had to pin to `SQLAlchemy==1.3.23`

Please could we fix fastapi (the incompatibility looks like it might be trivial) or pin the dependency?

Once master of fastapi is fixed, we'll need to remember to also remove the hack from pydantic.

{'base_commit': 'c09e950bd2efb81f82931469bee6856c72e54357', 'files': [{'path': 'pyproject.toml', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [56]}}}]}


Insecure argument passed to cURL

## Expected Behavior
a secure download of the Miniconda install script

## Current Behavior
install script is cURL'd with `-k` resulting in an insecure transfer and possible arbitrary code execution on my machine.

## Steps to Reproduce
1. run any of these without miniconda installed:
- `wsl.sh`
- `start_windows.bat`
- `start_macos.sh`
- `start_linux.sh`

2. pwned

## Possible Solution
don't curl executable things insecurely

## Context
Below is a copy of the text I had put in a security advisory on both this repository and ParisNeo/lollms-webui as of early December.  The response from the maintainers has been radio silence, so I am publishing the text here so that people can know/protect themselves.

# Security Advisory

### Summary
An unsafe command line argument being passed to cURL allows the Miniconda installer download to be MITM'd.

This downloaded script is subsequently run, potentially resulting in arbitrary code execution on user machines.

### Details
Here's an example from `start_linux.sh`
```bash
    mkdir -p "$INSTALL_DIR"
    curl -Lk "$MINICONDA_DOWNLOAD_URL" > "$INSTALL_DIR/miniconda_installer.sh"
```
It passes the `-k` argument to cURL.

cURL man page documentation for `-k`:
```
       -k, --insecure
              (TLS SFTP SCP) By default, every secure connection curl makes is
              verified to be secure before the transfer takes place. This
              option makes curl skip the verification step and proceed without
              checking.

              When this option is not used for protocols using TLS, curl
              verifies the server's TLS certificate before it continues: that
              the certificate contains the right name which matches the host
              name used in the URL and that the certificate has been signed by
              a CA certificate present in the cert store.  See this online
              resource for further details:
               https://curl.se/docs/sslcerts.html

              For SFTP and SCP, this option makes curl skip the known_hosts
              verification.  known_hosts is a file normally stored in the
              user's home directory in the ".ssh" subdirectory, which contains
              host names and their public keys.

              WARNING: using this option makes the transfer insecure.
```
The operative line is at the end:

**` WARNING: using this option makes the transfer insecure.`**

### Impact
All users of the following installer scripts are affected:

- `wsl.sh`
- `start_windows.bat`
- `start_macos.sh`
- `start_linux.sh`

{'base_commit': 'd6bd71db7f3200c2b1ef46123c07374848aed86a', 'files': [{'path': 'start_linux.sh', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [34]}}}, {'path': 'start_macos.sh', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [34]}}}, {'path': 'start_windows.bat', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [40]}}}, {'path': 'wsl.sh', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [61]}}}]}


**Description**

Adding flash attention to one click installer, for usage with exllamaV2

**Additional Context**

Me and others not so tech savvy people are having issues installing it manually on windows


always "llama_tokenize: too many tokens" (even 1 char input) in latest commit(b6643e5039ae210dbc54ae6aa0f4dcf90b2269a8)

### Describe the bug

Load model(vicuna-chinese) OK.
Chat error(console):  llama_tokenize: too many tokens
Reduce input to 1 char: llama_tokenize: too many tokens
Caculate Token: llama_tokenize: too many tokens

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

Install.(last commit)
Run server.
Load model(vicuna-chinese) OK.
Chat Is Good.
...
git pull -> latest(b6643e5039ae210dbc54ae6aa0f4dcf90b2269a8)
Load model(vicuna-chinese) OK.
Chat error(console):  llama_tokenize: too many tokens
Reduce input to 1 char: llama_tokenize: too many tokens
Caculate Token: llama_tokenize: too many tokens

### Screenshot

_No response_

### Logs

```shell
# Server Log
2023-07-08 03:06:08 INFO:Loaded the model in 1.56 seconds.

llama_tokenize: too many tokens
llama_tokenize: too many tokens
llama_tokenize: too many tokens
Output generated in 0.19 seconds (0.00 tokens/s, 0 tokens, context 58, seed 2000)
llama_tokenize: too many tokens
llama_tokenize: too many tokens
llama_tokenize: too many tokens
Output generated in 0.19 seconds (0.00 tokens/s, 0 tokens, context 49, seed 2000)
llama_tokenize: too many tokens
llama_tokenize: too many tokens
llama_tokenize: too many tokens
Output generated in 0.20 seconds (0.00 tokens/s, 0 tokens, context 47, seed 2000)
llama_tokenize: too many tokens
llama_tokenize: too many tokens
llama_tokenize: too many tokens
Output generated in 0.20 seconds (0.00 tokens/s, 0 tokens, context 2, seed 2000)
llama_tokenize: too many tokens
llama_tokenize: too many tokens
llama_tokenize: too many tokens
Output generated in 0.20 seconds (0.00 tokens/s, 0 tokens, context 2, seed 2000)
llama_tokenize: too many tokens
llama_tokenize: too many tokens
llama_tokenize: too many tokens
llama_tokenize: too many tokens
llama_tokenize: too many tokens
llama_tokenize: too many tokens
llama_tokenize: too many tokens
llama_tokenize: too many tokens
llama_tokenize: too many tokens

# Git log
commit b6643e5039ae210dbc54ae6aa0f4dcf90b2269a8 (HEAD -> main, origin/main, origin/HEAD)
Author: oobabooga <112222186+oobabooga@users.noreply.github.com>
Date:   Fri Jul 7 09:11:30 2023 -0700

    Add decode functions to llama.cpp/exllama

commit 1ba2e88551f968cd74478fd02218a62869336ac5
Author: oobabooga <112222186+oobabooga@users.noreply.github.com>
Date:   Fri Jul 7 09:09:23 2023 -0700

    Add truncation to exllama
```

### System Info

```shell
Mac m2 / macOS 13.4.1
```

{'base_commit': 'c8a59d79befd208bc341491d79eb4a2f8d25bb74', 'files': [{'path': 'modules/llamacpp_model.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [8]}, "('LlamaCppModel', 'generate', 76)": {'add': [77]}}}, {'path': 'modules/text_generation.py', 'status': 'modified', 'Loc': {"(None, 'encode', 38)": {'mod': [42]}}}]}


New precise prompts break eachadea_ggml-vicuna-13b-1.1

### Describe the bug

These changes seem to break a "default" install of eachadea/ggml-vicuna-13b-1.1-q4, acquired via the UI, both _0 and _2. I now receive blank responses in cai-chat, chat, and instruct modes using both the vicuna and vicuna v0 templates.

Confirmed it was caused in commit a777c05 by testing commit a840942 which resolves the issue.

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

Pull commit a777c05 or later. Start the application with

`python server.py --chat --model eachadea_ggml-vicuna-13b-1.1 --auto-devices --gpu-memory 8`

Use the chat window.

### Screenshot

![image](https://user-images.githubusercontent.com/4226491/234644445-c23f2d33-5d13-42c4-8ad1-b0c2a0005b51.png)

### Logs

```shell
None.
```

### System Info

```shell
Windows 11 using WSL Ubuntu 22.04
Ryzen 3700x
32gb ram
nvidia 2060 Super 8gb
```

{'base_commit': 'd87ca8f2af2458e8b57b1ec9915c72a4ca5ca19f', 'files': [{'path': 'characters/instruction-following/Vicuna-v0.yaml', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [4]}}}, {'path': 'characters/instruction-following/Vicuna.yaml', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [4]}}}, {'path': 'models/config.yaml', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [29]}}}]}


GPTQ quantization(3 or 4 bit quantization) support for LLaMa

[GPTQ](https://arxiv.org/abs/2210.17323) is currently the SOTA one shot quantization method for LLMs.
GPTQ supports amazingly low 3-bit and 4-bit weight quantization. And it can be applied to LLaMa.
I've actually confirmed that this works well in LLaMa 7b.
I haven't tested the memory usage(n-bit cuda kernel), but I think it should work.

| Model([LLaMa-7B](https://arxiv.org/abs/2302.13971))      | Bits | group-size | Wikitext2 |   PTB     |    C4   |
| ---------                                                | ---- | ---------- | --------- | --------- | ------- |
| FP16                                                     |  16  |     -      |    5.67   |    8.79   |   7.05  |
| RTN                                                      |  4   |     -      |    6.28   |    9.68   |   7.70  |
| [GPTQ](https://arxiv.org/abs/2210.17323)                 |  4   |    64      |    **6.16**   |    **9.66**   |   **7.52**  |
| RTN                                                      |  3   |     -      |    25.66   |    61.25   |   28.19  |
| [GPTQ](https://arxiv.org/abs/2210.17323)                 |  3   |    64      |    **12.24**   |    **16.77**   |   **9.55**  |

code: https://github.com/qwopqwop200/GPTQ-for-LLaMa

{'base_commit': '1d7e893fa199d6e0f868c383782aba9dada7d911', 'files': [{'path': 'modules/models.py', 'status': 'modified', 'Loc': {"(None, 'load_model', 38)": {'mod': [113]}}}]}


Cannot download a huggingface model due to the authorization.

### Describe the bug

I tied to download a new model which is visible in huggingface:   bigcode/starcoder

But failed due to the "Unauthorized". I have a access token from hugginface how can I add it to the downlaod_model.py

File “/home/ahnlab/GPT/text-generation-webui/download-model.py”, line 102, in get_download_links_from_huggingface r.raise_for_status() File “/home/ahnlab/miniconda3/envs/vicuna/lib/python3.11/site-packages/requests/models.py”, line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: [https://huggingface.co/api/models/ bigcode/starcoder/tree/main](https://huggingface.co/api/models/%20bigcode/starcoder/tree/main)

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

python download-model.py  bigcode/starcoder

### Screenshot

_No response_

### Logs

```shell
File “/home/ahnlab/GPT/text-generation-webui/download-model.py”, line 102, in get_download_links_from_huggingface r.raise_for_status() File “/home/ahnlab/miniconda3/envs/vicuna/lib/python3.11/site-packages/requests/models.py”, line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: [https://huggingface.co/api/models/ bigcode/starcoder/tree/main](https://huggingface.co/api/models/%20bigcode/starcoder/tree/main)
```

### System Info

```shell
Ubuntu
```


Backslashes are writen doubled in monospaced blocks

### Describe the bug

Without monospaced markdown there is a single backslash, but if it is written with either a single backtick, or tripple on multiline blocks, it gets doubled.

If I write:
```
'\'
```
or
```
'''
\
'''
```
(replaced the backticks in the example with aposthrophes because I couldn't figure out how to them escaped correctly here)

On the webgui it is written doubled, and it is not just visual, if you click the copy button it does get copied doubled. Like this:

`\\`
and
```
\\
```

But looking at the console it is not internally seen as doubled; so I don't think it's a tokenizer issue.

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

Already described in the description.

### Screenshot

_No response_

### Logs

```shell
(if any), well there is no errors, so it shouldn't be a required field, that red asterisks is annoying.
```

### System Info

```shell
Since it's a issue with the HTML itself, I suspect the system specs isn't relevant, lemme know if it somehow makes any difference.
```

{'base_commit': '02db4b0d06e9573de9e399b49006f882b996571b', 'files': [{'path': 'modules/html_generator.py', 'status': 'modified', 'Loc': {"(None, 'convert_to_markdown', 149)": {'add': [241]}}}]}


Indentation Error

Just updated after the changes to the face enhancer and I'm getting this error whenever I try to turn it on.
I'm not smart enough to know what this is but I'm hoping this helps someone figure it out!
```IndentationError: unindent does not match any outer indentation level
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python310\lib\tkinter\__init__.py", line 1921, in __call__
    return self.func(*args)
  File "C:\Python310\lib\site-packages\customtkinter\windows\widgets\ctk_switch.py", line 413, in toggle
    self._command()
  File "D:\Software\Deep-Live-Cam\modules\ui.py", line 205, in <lambda>
    update_tumbler("face_enhancer", enhancer_value.get()),
  File "D:\Software\Deep-Live-Cam\modules\ui.py", line 561, in update_tumbler
    frame_processors = get_frame_processors_modules(
  File "D:\Software\Deep-Live-Cam\modules\processors\frame\core.py", line 40, in get_frame_processors_modules
    set_frame_processors_modules_from_ui(frame_processors)
  File "D:\Software\Deep-Live-Cam\modules\processors\frame\core.py", line 47, in set_frame_processors_modules_from_ui
    frame_processor_module = load_frame_processor_module(frame_processor)
  File "D:\Software\Deep-Live-Cam\modules\processors\frame\core.py", line 23, in load_frame_processor_module
    frame_processor_module = importlib.import_module(f'modules.processors.frame.{frame_processor}')
  File "C:\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 879, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1017, in get_code
  File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "D:\Software\Deep-Live-Cam\modules\processors\frame\face_enhancer.py", line 61
    FACE_ENHANCER = gfpgan.GFPGANer(model_path=model_path, upscale=1, device=mps_device)  # type: ignore[attr-defined]
```

{'base_commit': 'ed7a21687c4de9f32659c30a17571ce568c30b47', 'files': [{'path': 'modules/processors/frame/face_enhancer.py', 'status': 'modified', 'Loc': {"(None, 'get_face_enhancer', 51)": {'mod': [57, 58, 59, 60, 61, 62, 63]}}}]}


Issues with pip install -r requirement.txt

INFO: pip is looking at multiple versions of opencv-python to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install -r requirements.txt (line 14) and torch==2.5.1 because these package versions have conflicting dependencies.

The conflict is caused by:
The user requested torch==2.5.1
torchvision 0.20.1+cu121 depends on torch==2.5.1+cu121

To fix this you could try to:

loosen the range of package versions you've specified
remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

PLEASE THIS IS MY OUTPUT, PLEASE HELP

{'base_commit': '87081e78d0175c79bab4f1b50d41a9741920e1c4', 'files': [{'path': 'requirements.txt', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [13]}}}]}


不使用ui运行代码，使用face_enhancer模式时无法运行。

您好，碰到一个bug。我不使用ui界面，直接用运行脚本就会报错：
# ------------------------ run.py文件 ------------------------
>“
>#!/usr/bin/env python3
>import os
>import sys
>from modules import core
>os.environ["CUDA_VISIBLE_DEVICES"] = "1"
>
>#模拟命令行参数，添加--execution-provider cuda
>sys.argv += ["--execution-provider", "cuda"]
>sys.argv += ["-s", "input/images/picture1.png", "-t", "input/videos/real_001.mp4", "-o", "output/output03.mp4"]
>#choices=['face_swapper', 'face_enhancer']
>sys.argv += ["--frame-processor", "face_swapper"]
>
>if __name__ == '__main__':
>    print(" ===============> 开始run  ")
>    core.run()
>”
# ------------------------ issues   ------------------------
如果--frame-processor选择“sys.argv += ["--frame-processor", "face_swapper"]”是可以正常执行。
如果--frame-processor变成模式sys.argv += ["--frame-processor", "face_enhancer"]。就会报错！

但是如果使用ui界面来处理，打开face_enhancer模式就能正常运行。想问是什么原因呢？


[BUG] One trailing newline ignored by rich.print in some cases

Hi, thanks for this great library.

Not sure if this is expected behavior or a bug. In certain cases, `rich.print` handles newlines in a slightly different manner than the `print` built-in.

Example:
```
>>> for i in range(3): print('Hey' + '\n' * i)
...
Hey
Hey

Hey

>>> from rich import print
>>> for i in range(3): print('Hey' + '\n' * i)
...
Hey
Hey
Hey

>>>
```
Apparently, when the printed string contains at least one trailing newline (i.e. when `i == 1` or `i == 2`), one newline is ignored by `rich.print`.

A screenshot of a similar example:
![rich](https://user-images.githubusercontent.com/43098013/88477785-33616200-cf43-11ea-9b6a-647ad0080f8b.png)

(rich 3.3.2, Python 3.8.0, GNOME Terminal 3.18.3 on Linux Mint 18.2 64-bit)


[BUG] ImportError OrderedDict

You may find a solution to your problem in the [docs](https://rich.readthedocs.io/en/latest/introduction.html) or [issues](https://github.com/willmcgugan/rich/issues).

First: Thanks for your awesome project and the work you take to make devs lifes better :)!
**Describe the bug**

Some updates seem to have mixed up dependencies.
```bash
> rich README.md
Traceback (most recent call last):
  File "/home/graeter/.local/bin/rich", line 5, in <module>
    from rich_cli.__main__ import run
  File "/home/graeter/.local/lib/python3.8/site-packages/rich_cli/__main__.py", line 7, in <module>
    from rich.console import Console, RenderableType
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/console.py", line 46, in <module>
    from ._log_render import FormatTimeCallable, LogRender
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/_log_render.py", line 5, in <module>
    from .text import Text, TextType
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/text.py", line 5, in <module>
    from rich.emoji import EmojiVariant
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/emoji.py", line 4, in <module>
    from .jupyter import JupyterMixin
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/jupyter.py", line 4, in <module>
    from .segment import Segment
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/segment.py", line 19, in <module>
    from .cells import (
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/cells.py", line 6, in <module>
    from ._lru_cache import LRUCache
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/_lru_cache.py", line 8, in <module>
    from typing_extensions import OrderedDict
ImportError: cannot import name 'OrderedDict' from 'typing_extensions' (/home/graeter/.local/lib/python3.8/site-packages/typing_extensions.py)
```
Can you point me to a working configuration?
Up to now I used rich very happily and would miss it a lot ;)

**Platform**
- Ubuntu 20.04
- python 3.8.10
- pip 22.0.4
- zsh with starship

<details>
```
python -m rich.diagnose
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/diagnose.py", line 5, in <module>
    from rich.console import Console, get_windows_console_features
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/console.py", line 46, in <module>
    from ._log_render import FormatTimeCallable, LogRender
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/_log_render.py", line 5, in <module>
    from .text import Text, TextType
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/text.py", line 5, in <module>
    from rich.emoji import EmojiVariant
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/emoji.py", line 4, in <module>
    from .jupyter import JupyterMixin
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/jupyter.py", line 4, in <module>
    from .segment import Segment
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/segment.py", line 19, in <module>
    from .cells import (
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/cells.py", line 6, in <module>
    from ._lru_cache import LRUCache
  File "/home/graeter/.local/lib/python3.8/site-packages/rich/_lru_cache.py", line 8, in <module>
    from typing_extensions import OrderedDict
ImportError: cannot import name 'OrderedDict' from 'typing_extensions' (/home/graeter/.local/lib/python3.8/site-packages/typing_extensions.py)

pip freeze | grep rich
rich==12.1.0
rich-cli==1.6.1
rich-rst==1.1.7
```

</details>

{'base_commit': '489fafc63e4ab85cacde60ade1a15099d6c08ca8', 'files': [{'path': 'poetry.lock', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [588, 1068, 1468, 1469]}}}, {'path': 'pyproject.toml', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [30]}}}]}


Drop Python 3.6 as a supported version of Python

Time to drop Python 3.6 as a version of Python supported by Rich. The reasons for doing so include:

- Python 3.6 [reached end-of-life on 2021-12-03](https://devguide.python.org/versions/)
- The Poetry installer used for our GitHub actions [recently dropped 3.6](https://github.com/python-poetry/install.python-poetry.org).

Actions to take include:

- [x] Consider the significance of [this TODO in `_null_file.py`](https://github.com/Textualize/rich/blob/84e628655a2981ee90413ca3f35001ec3954161d/rich/_null_file.py#L7).
- [x] Drop `dataclasses` as a dependency.
- [x] Look at dropping [the special-casing of `isascii` in `rule.py`](https://github.com/Textualize/rich/blob/84e628655a2981ee90413ca3f35001ec3954161d/rich/rule.py#L54).
- [x] Drop Python 3.6 from `pythonpackage.yml`.
- [x] Drop mention of Python 3.6 in `pyproject.toml` -> `[tool.poetry]` -> `classifiers`.
- [x] Bump the major version of Rich.
- [x] Update the `Compatibility` section of `README.md` (and all translations).

{'base_commit': '42988b834f9c76b63145dd8d8142a94243e71375', 'files': [{'path': '.github/workflows/pythonpackage.yml', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [11]}}}, {'path': 'CHANGELOG.md', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [7]}}}, {'path': 'README.md', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [41]}}}, {'path': 'pyproject.toml', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [5, 18, 30, 32, 47]}}}, {'path': 'rich/_null_file.py', 'status': 'modified', 'Loc': {"('NullFile', None, 5)": {'mod': [7, 9, 10, 11, 13, 14, 15, 17, 18]}}}, {'path': 'rich/highlighter.py', 'status': 'modified', 'Loc': {"('ReprHighlighter', None, 80)": {'mod': [85]}}}, {'path': 'rich/rule.py', 'status': 'modified', 'Loc': {"('Rule', '__rich_console__', 49)": {'mod': [54, 55, 56, 57, 60]}}}, {'path': 'tests/test_null_file.py', 'status': 'modified', 'Loc': {"(None, 'test_null_file', 4)": {'mod': [8, 9, 10]}}}]}


[BUG] Extra Space above Certain Markdown Tables

- [x] I've checked [docs](https://rich.readthedocs.io/en/latest/introduction.html) and [closed issues](https://github.com/Textualize/rich/issues?q=is%3Aissue+is%3Aclosed) for possible solutions.
- [x] I can't find my issue in the [FAQ](https://github.com/Textualize/rich/blob/master/FAQ.md).

**Describe the bug**
Certain markdown tables contain extra newlines above them in Rich 13.4.2.

```python
from rich.console import Console
from rich.markdown import Markdown

MD = """
|   Temperature |        |        |        |        |           |
|--------------:|:-------|:-------|:-------|:-------|:----------|
|          0.01 | sam    | sam    | sam    | sam    | sam       |
|          0.1  | sam    | sam    | sam    | sam    | sam       |
|          0.25 | sam    | sam    | sam    | sammy  | sammy     |
|          0.5  | lilly  | sam    | sammy  | sammy  | taffy     |
|          0.75 | bambi  | lola   | snoopy | taffy  | taz       |
|          0.9  | bella  | harper | millie | molly  | sweetie   |
|          1    | Anna   | molly  | shaker | sydney | wheessie  |
|          1.25 | Finley | funny  | gertie | gladi  | road kill |
""".strip()

console = Console()
markdown = Markdown(MD)

print('--')
console.print(markdown)
print('--')
```
![image](https://github.com/Textualize/rich/assets/394709/e4d49cad-109e-4ff5-9af6-065b3a91f70c)

**Platform**
<details>
<summary>Click to expand</summary>

Windows 10.

```
┌───────────────────────── <class 'rich.console.Console'> ─────────────────────────┐
│ A high level console interface.                                                  │
│                                                                                │
│ ┌──────────────────────────────────────────────────────────────────────────────┐ │
│ │ <console width=148 ColorSystem.WINDOWS>                                      │ │
│ └──────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                │
│     color_system = 'windows'                                                     │
│         encoding = 'utf-8'                                                       │
│             file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
│           height = 56                                                            │
│    is_alt_screen = False                                                         │
│ is_dumb_terminal = False                                                         │
│   is_interactive = True                                                          │
│       is_jupyter = False                                                         │
│      is_terminal = True                                                          │
│   legacy_windows = True                                                          │
│         no_color = False                                                         │
│          options = ConsoleOptions(                                               │
│                        size=ConsoleDimensions(width=148, height=56),             │
│                        legacy_windows=True,                                      │
│                        min_width=1,                                              │
│                        max_width=148,                                            │
│                        is_terminal=True,                                         │
│                        encoding='utf-8',                                         │
│                        max_height=56,                                            │
│                        justify=None,                                             │
│                        overflow=None,                                            │
│                        no_wrap=False,                                            │
│                        highlight=None,                                           │
│                        markup=None,                                              │
│                        height=None                                               │
│                    )                                                             │
│            quiet = False                                                         │
│           record = False                                                         │
│         safe_box = True                                                          │
│             size = ConsoleDimensions(width=148, height=56)                       │
│        soft_wrap = False                                                         │
│           stderr = False                                                         │
│            style = None                                                          │
│         tab_size = 8                                                             │
│            width = 148                                                           │
└──────────────────────────────────────────────────────────────────────────────────┘
┌─── <class 'rich._windows.WindowsConsoleFeatures'> ────┐
│ Windows features available.                           │
│                                                       │
│ ┌───────────────────────────────────────────────────┐ │
│ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │
│ └───────────────────────────────────────────────────┘ │
│                                                       │
│ truecolor = False                                     │
│        vt = False                                     │
└───────────────────────────────────────────────────────┘
┌────── Environment Variables ───────┐
│ {                                  │
│     'TERM': None,                  │
│     'COLORTERM': None,             │
│     'CLICOLOR': None,              │
│     'NO_COLOR': None,              │
│     'TERM_PROGRAM': None,          │
│     'COLUMNS': None,               │
│     'LINES': None,                 │
│     'JUPYTER_COLUMNS': None,       │
│     'JUPYTER_LINES': None,         │
│     'JPY_PARENT_PID': None,        │
│     'VSCODE_VERBOSE_LOGGING': None │
│ }                                  │
└────────────────────────────────────┘
platform="Windows"
```

</details>

{'base_commit': 'c478588f3c228a4e86741a057c42b452d7bc6bce', 'files': [{'path': 'CHANGELOG.md', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [21]}}}, {'path': 'rich/markdown.py', 'status': 'modified', 'Loc': {"('Markdown', '__rich_console__', 569)": {'mod': [680]}}}, {'path': 'tests/test_markdown.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [176]}, "(None, 'test_markdown_render', 99)": {'mod': [102]}}}]}


[BUG] rich.live does not redirect stdout with fileno

**Describe the bug**

When using `rich.live.Live` with default settings (`redirect_stdout=True`), `sys.stdout` does not have a `fileno` which breaks some stdlib python code which expects it, for example:

```python
from rich.live import Live
import subprocess
import sys

with Live():
    subprocess.Popen(["echo hello world"], stdout=sys.stdout).communicate()
```

which errors with

```
Traceback (most recent call last):
  File "/Users/kratsg/mario-mapyde/live.py", line 6, in <module>
    subprocess.Popen(["echo hello world"], stdout=sys.stdout).communicate()
  File "/usr/local/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 829, in __init__
    errread, errwrite) = self._get_handles(stdin, stdout, stderr)
  File "/usr/local/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1598, in _get_handles
    c2pwrite = stdout.fileno()
io.UnsupportedOperation: fileno
```

**Platform**

Click to expand

```
╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
│ A high level console interface.                                                  │
│                                                                                │
│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=119 ColorSystem.EIGHT_BIT>                                    │ │
│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                │
│     color_system = '256'                                                         │
│         encoding = 'utf-8'                                                       │
│             file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
│           height = 61                                                            │
│    is_alt_screen = False                                                         │
│ is_dumb_terminal = False                                                         │
│   is_interactive = True                                                          │
│       is_jupyter = False                                                         │
│      is_terminal = True                                                          │
│   legacy_windows = False                                                         │
│         no_color = False                                                         │
│          options = ConsoleOptions(                                               │
│                        size=ConsoleDimensions(width=119, height=61),             │
│                        legacy_windows=False,                                     │
│                        min_width=1,                                              │
│                        max_width=119,                                            │
│                        is_terminal=True,                                         │
│                        encoding='utf-8',                                         │
│                        max_height=61,                                            │
│                        justify=None,                                             │
│                        overflow=None,                                            │
│                        no_wrap=False,                                            │
│                        highlight=None,                                           │
│                        markup=None,                                              │
│                        height=None                                               │
│                    )                                                             │
│            quiet = False                                                         │
│           record = False                                                         │
│         safe_box = True                                                          │
│             size = ConsoleDimensions(width=119, height=61)                       │
│        soft_wrap = False                                                         │
│           stderr = False                                                         │
│            style = None                                                          │
│         tab_size = 8                                                             │
│            width = 119                                                           │
╰──────────────────────────────────────────────────────────────────────────────────╯
╭─── <class 'rich._windows.WindowsConsoleFeatures'> ────╮
│ Windows features available.                           │
│                                                       │
│ ╭───────────────────────────────────────────────────╮ │
│ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │
│ ╰───────────────────────────────────────────────────╯ │
│                                                       │
│ truecolor = False                                     │
│        vt = False                                     │
╰───────────────────────────────────────────────────────╯
╭──────── Environment Variables ────────╮
│ {                                     │
│     'TERM': 'xterm-256color',         │
│     'COLORTERM': None,                │
│     'CLICOLOR': None,                 │
│     'NO_COLOR': None,                 │
│     'TERM_PROGRAM': 'Apple_Terminal', │
│     'COLUMNS': None,                  │
│     'LINES': None,                    │
│     'JUPYTER_COLUMNS': None,          │
│     'JUPYTER_LINES': None,            │
│     'JPY_PARENT_PID': None,           │
│     'VSCODE_VERBOSE_LOGGING': None    │
│ }                                     │
╰───────────────────────────────────────╯
platform="Darwin"
```

```
rich==12.6.0
```

**What am I trying to do?**

Click to expand

Well, I was following something like [this SO post](https://stackoverflow.com/questions/71077706/redirect-print-and-or-logging-to-panel) and #1720 to run subprocess, and have the output of `sys.stdout` redirect to *some* renderable. Code that does not error, but also does not do as expected (due to python picking up system `stdout` rather than the redirected `stdout` is similar:

```python
from rich.live import Live
import subprocess
import sys

with Live(screen=True):
    subprocess.Popen(["echo hello world"]).communicate()
```

but this puts the output on the original screen, not the alternate screen. Perhaps there is a better way to pass in a file handler through `subprocess` to auto-redirect into a `Console` or similar, but it's not obvious to me how this can be done. This is the only way I can think of:

```python
from rich.console import Console
import os

class ConsolePanel(Console):
    def __init__(self,*args,**kwargs):
        console_file = open(os.devnull,'w')
        super().__init__(record=True,file=console_file,*args,**kwargs)

    def __rich_console__(self,console,options):
        texts = self.export_text(clear=False).split('\n')
        for line in texts[-options.height:]:
            yield line

if __name__=='__main__':
    from rich.layout import Layout
    from rich.live import Live
    import time
    from datetime import datetime
    import subprocess

    class Interface():
        def __init__(self) -> None:
            self.console:list[ConsolePanel] = [ConsolePanel() for _ in range(2)]

        def get_renderable(self):
            layout = Layout()
            layout.split_column(
                Layout(self.console[0],name='top'),
                Layout(self.console[1],name='bottom',size=6)
            )
            layout.children[0]
            return layout

    # comment out the below line to get wildly different behavior
    proc = subprocess.Popen(["watch", "-n1", "echo hello world"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)

    db = Interface()
    with Live(get_renderable=db.get_renderable):
        while True:
            time.sleep(1)
            db.console[0].print(datetime.now().ctime()+'='*100)
            db.console[1].print(datetime.now().ctime())
```

{'base_commit': '9c0f164f8bbb8811f6e3ef8a69ac77c5e4464f36', 'files': [{'path': 'CHANGELOG.md', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [18]}}}, {'path': 'rich/file_proxy.py', 'status': 'modified', 'Loc': {"('FileProxy', 'flush', 50)": {'add': [54]}}}]}