core[patch]: Fixes for convert_messages (#21207)

- support two-tuples of any sequence type (eg. json.loads never produces
tuples)
- support type alias for role key
- if id is passed in in dict form use it
- if tool_calls passed in in dict form use them

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
Nuno Campos
2024-05-02 09:55:42 -07:00
committed by GitHub
parent df49404794
commit 663747b730
3 changed files with 49 additions and 28 deletions

View File

@@ -44,7 +44,7 @@ jobs:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ inputs.working-directory }}
cache-key: lint-with-extras
# cache-key: lint-with-extras
- name: Check Poetry File
shell: bash
@@ -79,14 +79,14 @@ jobs:
run: |
poetry run pip install -e "$LANGCHAIN_LOCATION"
- name: Get .mypy_cache to speed up mypy
uses: actions/cache@v4
env:
SEGMENT_DOWNLOAD_TIMEOUT_MIN: "2"
with:
path: |
${{ env.WORKDIR }}/.mypy_cache
key: mypy-lint-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ inputs.working-directory }}-${{ hashFiles(format('{0}/poetry.lock', inputs.working-directory)) }}
# - name: Get .mypy_cache to speed up mypy
# uses: actions/cache@v4
# env:
# SEGMENT_DOWNLOAD_TIMEOUT_MIN: "2"
# with:
# path: |
# ${{ env.WORKDIR }}/.mypy_cache
# key: mypy-lint-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ inputs.working-directory }}-${{ hashFiles(format('{0}/poetry.lock', inputs.working-directory)) }}
- name: Analysing the code with our lint
@@ -113,14 +113,14 @@ jobs:
run: |
poetry install --with test,test_integration
- name: Get .mypy_cache_test to speed up mypy
uses: actions/cache@v4
env:
SEGMENT_DOWNLOAD_TIMEOUT_MIN: "2"
with:
path: |
${{ env.WORKDIR }}/.mypy_cache_test
key: mypy-test-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ inputs.working-directory }}-${{ hashFiles(format('{0}/poetry.lock', inputs.working-directory)) }}
# - name: Get .mypy_cache_test to speed up mypy
# uses: actions/cache@v4
# env:
# SEGMENT_DOWNLOAD_TIMEOUT_MIN: "2"
# with:
# path: |
# ${{ env.WORKDIR }}/.mypy_cache_test
# key: mypy-test-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ inputs.working-directory }}-${{ hashFiles(format('{0}/poetry.lock', inputs.working-directory)) }}
- name: Analysing the code with our lint
working-directory: ${{ inputs.working-directory }}