diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml
index 144eb68c098..8b27adcce3e 100644
--- a/.devcontainer/docker-compose.yaml
+++ b/.devcontainer/docker-compose.yaml
@@ -2,7 +2,7 @@ version: '3'
services:
langchain:
build:
- dockerfile: dev.Dockerfile
+ dockerfile: libs/langchain/dev.Dockerfile
context: ..
volumes:
# Update this to wherever you want VS Code to mount the folder of your project
diff --git a/.github/workflows/lint.yml b/.github/workflows/base/lint.yml
similarity index 73%
rename from .github/workflows/lint.yml
rename to .github/workflows/base/lint.yml
index c3e4375fc86..7eec66ca31d 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/base/lint.yml
@@ -1,15 +1,21 @@
name: lint
on:
- push:
- branches: [master]
- pull_request:
+ workflow_call:
+ inputs:
+ working-directory:
+ required: true
+ type: string
+ description: "From which folder this pipeline executes"
env:
POETRY_VERSION: "1.4.2"
jobs:
build:
+ defaults:
+ run:
+ working-directory: ${{ inputs.working-directory }}
runs-on: ubuntu-latest
strategy:
matrix:
diff --git a/.github/workflows/release.yml b/.github/workflows/base/release.yml
similarity index 100%
rename from .github/workflows/release.yml
rename to .github/workflows/base/release.yml
diff --git a/.github/workflows/test.yml b/.github/workflows/base/test.yml
similarity index 100%
rename from .github/workflows/test.yml
rename to .github/workflows/base/test.yml
diff --git a/.github/workflows/langchain/lint.yml b/.github/workflows/langchain/lint.yml
new file mode 100644
index 00000000000..268e5e5cc5c
--- /dev/null
+++ b/.github/workflows/langchain/lint.yml
@@ -0,0 +1,20 @@
+---
+name: Lint libs/langchain
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ paths:
+ - '.github/workflows/base/**'
+ - '.github/workflows/langchain/**'
+ - 'libs/langchain/**'
+ workflow_dispatch: # Allows to trigger the workflow manually in GitHub UI
+
+jobs:
+ ci-libs-fancy:
+ uses:
+ ./.github/workflows/base/lint.yml
+ with:
+ working-directory: libs/langchain
+ secrets: inherit
\ No newline at end of file
diff --git a/.dockerignore b/libs/langchain/.dockerignore
similarity index 100%
rename from .dockerignore
rename to libs/langchain/.dockerignore
diff --git a/.flake8 b/libs/langchain/.flake8
similarity index 100%
rename from .flake8
rename to libs/langchain/.flake8
diff --git a/Dockerfile b/libs/langchain/Dockerfile
similarity index 100%
rename from Dockerfile
rename to libs/langchain/Dockerfile
diff --git a/Makefile b/libs/langchain/Makefile
similarity index 100%
rename from Makefile
rename to libs/langchain/Makefile
diff --git a/dev.Dockerfile b/libs/langchain/dev.Dockerfile
similarity index 100%
rename from dev.Dockerfile
rename to libs/langchain/dev.Dockerfile
diff --git a/langchain/__init__.py b/libs/langchain/langchain/__init__.py
similarity index 100%
rename from langchain/__init__.py
rename to libs/langchain/langchain/__init__.py
diff --git a/langchain/agents/__init__.py b/libs/langchain/langchain/agents/__init__.py
similarity index 100%
rename from langchain/agents/__init__.py
rename to libs/langchain/langchain/agents/__init__.py
diff --git a/langchain/agents/agent.py b/libs/langchain/langchain/agents/agent.py
similarity index 100%
rename from langchain/agents/agent.py
rename to libs/langchain/langchain/agents/agent.py
diff --git a/langchain/agents/agent_toolkits/__init__.py b/libs/langchain/langchain/agents/agent_toolkits/__init__.py
similarity index 100%
rename from langchain/agents/agent_toolkits/__init__.py
rename to libs/langchain/langchain/agents/agent_toolkits/__init__.py
diff --git a/langchain/agents/agent_toolkits/azure_cognitive_services/__init__.py b/libs/langchain/langchain/agents/agent_toolkits/azure_cognitive_services/__init__.py
similarity index 100%
rename from langchain/agents/agent_toolkits/azure_cognitive_services/__init__.py
rename to libs/langchain/langchain/agents/agent_toolkits/azure_cognitive_services/__init__.py
diff --git a/langchain/agents/agent_toolkits/azure_cognitive_services/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/azure_cognitive_services/toolkit.py
similarity index 100%
rename from langchain/agents/agent_toolkits/azure_cognitive_services/toolkit.py
rename to libs/langchain/langchain/agents/agent_toolkits/azure_cognitive_services/toolkit.py
diff --git a/langchain/agents/agent_toolkits/base.py b/libs/langchain/langchain/agents/agent_toolkits/base.py
similarity index 100%
rename from langchain/agents/agent_toolkits/base.py
rename to libs/langchain/langchain/agents/agent_toolkits/base.py
diff --git a/langchain/agents/agent_toolkits/csv/__init__.py b/libs/langchain/langchain/agents/agent_toolkits/csv/__init__.py
similarity index 100%
rename from langchain/agents/agent_toolkits/csv/__init__.py
rename to libs/langchain/langchain/agents/agent_toolkits/csv/__init__.py
diff --git a/langchain/agents/agent_toolkits/csv/base.py b/libs/langchain/langchain/agents/agent_toolkits/csv/base.py
similarity index 100%
rename from langchain/agents/agent_toolkits/csv/base.py
rename to libs/langchain/langchain/agents/agent_toolkits/csv/base.py
diff --git a/langchain/agents/agent_toolkits/file_management/__init__.py b/libs/langchain/langchain/agents/agent_toolkits/file_management/__init__.py
similarity index 100%
rename from langchain/agents/agent_toolkits/file_management/__init__.py
rename to libs/langchain/langchain/agents/agent_toolkits/file_management/__init__.py
diff --git a/langchain/agents/agent_toolkits/file_management/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/file_management/toolkit.py
similarity index 100%
rename from langchain/agents/agent_toolkits/file_management/toolkit.py
rename to libs/langchain/langchain/agents/agent_toolkits/file_management/toolkit.py
diff --git a/langchain/agents/agent_toolkits/gmail/__init__.py b/libs/langchain/langchain/agents/agent_toolkits/gmail/__init__.py
similarity index 100%
rename from langchain/agents/agent_toolkits/gmail/__init__.py
rename to libs/langchain/langchain/agents/agent_toolkits/gmail/__init__.py
diff --git a/langchain/agents/agent_toolkits/gmail/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/gmail/toolkit.py
similarity index 100%
rename from langchain/agents/agent_toolkits/gmail/toolkit.py
rename to libs/langchain/langchain/agents/agent_toolkits/gmail/toolkit.py
diff --git a/langchain/agents/agent_toolkits/jira/__init__.py b/libs/langchain/langchain/agents/agent_toolkits/jira/__init__.py
similarity index 100%
rename from langchain/agents/agent_toolkits/jira/__init__.py
rename to libs/langchain/langchain/agents/agent_toolkits/jira/__init__.py
diff --git a/langchain/agents/agent_toolkits/jira/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/jira/toolkit.py
similarity index 100%
rename from langchain/agents/agent_toolkits/jira/toolkit.py
rename to libs/langchain/langchain/agents/agent_toolkits/jira/toolkit.py
diff --git a/langchain/agents/agent_toolkits/json/__init__.py b/libs/langchain/langchain/agents/agent_toolkits/json/__init__.py
similarity index 100%
rename from langchain/agents/agent_toolkits/json/__init__.py
rename to libs/langchain/langchain/agents/agent_toolkits/json/__init__.py
diff --git a/langchain/agents/agent_toolkits/json/base.py b/libs/langchain/langchain/agents/agent_toolkits/json/base.py
similarity index 100%
rename from langchain/agents/agent_toolkits/json/base.py
rename to libs/langchain/langchain/agents/agent_toolkits/json/base.py
diff --git a/langchain/agents/agent_toolkits/json/prompt.py b/libs/langchain/langchain/agents/agent_toolkits/json/prompt.py
similarity index 100%
rename from langchain/agents/agent_toolkits/json/prompt.py
rename to libs/langchain/langchain/agents/agent_toolkits/json/prompt.py
diff --git a/langchain/agents/agent_toolkits/json/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/json/toolkit.py
similarity index 100%
rename from langchain/agents/agent_toolkits/json/toolkit.py
rename to libs/langchain/langchain/agents/agent_toolkits/json/toolkit.py
diff --git a/langchain/agents/agent_toolkits/nla/__init__.py b/libs/langchain/langchain/agents/agent_toolkits/nla/__init__.py
similarity index 100%
rename from langchain/agents/agent_toolkits/nla/__init__.py
rename to libs/langchain/langchain/agents/agent_toolkits/nla/__init__.py
diff --git a/langchain/agents/agent_toolkits/nla/tool.py b/libs/langchain/langchain/agents/agent_toolkits/nla/tool.py
similarity index 100%
rename from langchain/agents/agent_toolkits/nla/tool.py
rename to libs/langchain/langchain/agents/agent_toolkits/nla/tool.py
diff --git a/langchain/agents/agent_toolkits/nla/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/nla/toolkit.py
similarity index 100%
rename from langchain/agents/agent_toolkits/nla/toolkit.py
rename to libs/langchain/langchain/agents/agent_toolkits/nla/toolkit.py
diff --git a/langchain/agents/agent_toolkits/office365/__init__.py b/libs/langchain/langchain/agents/agent_toolkits/office365/__init__.py
similarity index 100%
rename from langchain/agents/agent_toolkits/office365/__init__.py
rename to libs/langchain/langchain/agents/agent_toolkits/office365/__init__.py
diff --git a/langchain/agents/agent_toolkits/office365/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/office365/toolkit.py
similarity index 100%
rename from langchain/agents/agent_toolkits/office365/toolkit.py
rename to libs/langchain/langchain/agents/agent_toolkits/office365/toolkit.py
diff --git a/langchain/agents/agent_toolkits/openapi/__init__.py b/libs/langchain/langchain/agents/agent_toolkits/openapi/__init__.py
similarity index 100%
rename from langchain/agents/agent_toolkits/openapi/__init__.py
rename to libs/langchain/langchain/agents/agent_toolkits/openapi/__init__.py
diff --git a/langchain/agents/agent_toolkits/openapi/base.py b/libs/langchain/langchain/agents/agent_toolkits/openapi/base.py
similarity index 100%
rename from langchain/agents/agent_toolkits/openapi/base.py
rename to libs/langchain/langchain/agents/agent_toolkits/openapi/base.py
diff --git a/libs/langchain/langchain/agents/agent_toolkits/openapi/openapi.yaml b/libs/langchain/langchain/agents/agent_toolkits/openapi/openapi.yaml
new file mode 100644
index 00000000000..9e9aaccdfb0
--- /dev/null
+++ b/libs/langchain/langchain/agents/agent_toolkits/openapi/openapi.yaml
@@ -0,0 +1,7265 @@
+openapi: 3.0.3
+servers:
+ - url: https://api.spotify.com/v1
+info:
+ description: |
+ You can use Spotify's Web API to discover music and podcasts, manage your Spotify library, control audio playback, and much more. Browse our available Web API endpoints using the sidebar at left, or via the navigation bar on top of this page on smaller screens.
+
+ In order to make successful Web API requests your app will need a valid access token. One can be obtained through OAuth 2.0.
+
+ The base URI for all Web API requests is `https://api.spotify.com/v1`.
+
+ Need help? See our Web API guides for more information, or visit the Spotify for Developers community forum to ask questions and connect with other developers.
+ termsOfService: https://developer.spotify.com/terms/
+ title: Spotify Web API
+ version: 1.0.0
+ x-apisguru-categories:
+ - media
+ x-logo:
+ url: https://logo-core.clearbit.com/spotify.com
+ x-origin:
+ - format: openapi
+ url: https://developer.spotify.com/_data/documentation/web-api/reference/open-api-schema.yml
+ version: "3.0"
+ x-providerName: spotify.com
+paths:
+ /albums:
+ get:
+ description: |
+ Get Spotify catalog information for multiple albums identified by their Spotify IDs.
+ operationId: get-multiple-albums
+ parameters:
+ - $ref: "#/components/parameters/QueryAlbumIds"
+ - $ref: "#/components/parameters/QueryMarket"
+ responses:
+ "200":
+ $ref: "#/components/responses/ManyAlbums"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Several Albums
+ tags:
+ - Albums
+ x-spotify-docs-console-url: /console/get-several-albums/
+ x-spotify-docs-endpoint-name: Get Multiple Albums
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Albums
+ x-spotify-docs-display-name: several-albums
+ "/albums/{id}":
+ get:
+ description: |
+ Get Spotify catalog information for a single album.
+ operationId: get-an-album
+ parameters:
+ - $ref: "#/components/parameters/PathAlbumId"
+ - $ref: "#/components/parameters/QueryMarket"
+ responses:
+ "200":
+ $ref: "#/components/responses/OneAlbum"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Album
+ tags:
+ - Albums
+ x-spotify-docs-console-url: /console/get-album/?id=0sNOF9WDwhWunNAHPD3Baj
+ x-spotify-docs-endpoint-name: Get an Album
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Albums
+ x-spotify-docs-display-name: album
+ "/albums/{id}/tracks":
+ get:
+ description: |
+ Get Spotify catalog information about an album’s tracks.
+ Optional parameters can be used to limit the number of tracks returned.
+ operationId: get-an-albums-tracks
+ parameters:
+ - $ref: "#/components/parameters/PathAlbumId"
+ - $ref: "#/components/parameters/QueryMarket"
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagingSimplifiedTrackObject"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Album Tracks
+ tags:
+ - Albums
+ - Tracks
+ x-spotify-docs-console-url: /console/get-album-tracks/
+ x-spotify-docs-endpoint-name: Get an Album's Tracks
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Albums
+ x-spotify-docs-display-name: album-tracks
+ /artists:
+ get:
+ description: |
+ Get Spotify catalog information for several artists based on their Spotify IDs.
+ operationId: get-multiple-artists
+ parameters:
+ - in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids) for the artists. Maximum: 50 IDs.
+ example: 2CIMQHirSU0MQqyYHq0eOx,57dN52uHvrHOxijzpIgu3E,1vCWHaC5f2uS3yhpwWbIA6
+ title: Spotify Artist IDs
+ type: string
+ responses:
+ "200":
+ $ref: "#/components/responses/ManyArtists"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Several Artists
+ tags:
+ - Artists
+ x-spotify-docs-console-url: /console/get-several-artists/?ids=0oSGxfWSnnOXhD2fKuz2Gy,3dBVyJ7JuOMt4GE9607Qin
+ x-spotify-docs-endpoint-name: Get Multiple Artists
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Artists
+ x-spotify-docs-display-name: several-artists
+ "/artists/{id}":
+ get:
+ description: |
+ Get Spotify catalog information for a single artist identified by their unique Spotify ID.
+ operationId: get-an-artist
+ parameters:
+ - $ref: "#/components/parameters/PathArtistId"
+ responses:
+ "200":
+ $ref: "#/components/responses/OneArtist"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Artist
+ tags:
+ - Artists
+ x-spotify-docs-console-url: /console/get-artist/?id=0OdUWJ0sBjDrqHygGUXeCF
+ x-spotify-docs-endpoint-name: Get an Artist
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Artists
+ x-spotify-docs-display-name: artist
+ "/artists/{id}/albums":
+ get:
+ description: |
+ Get Spotify catalog information about an artist's albums.
+ operationId: get-an-artists-albums
+ parameters:
+ - $ref: "#/components/parameters/PathArtistId"
+ - $ref: "#/components/parameters/QueryIncludeGroups"
+ - $ref: "#/components/parameters/QueryMarket"
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagingSimplifiedAlbumObject"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Artist's Albums
+ tags:
+ - Artists
+ - Albums
+ x-spotify-docs-console-url: /console/get-artist-albums/?album_type=single&limit=2&market=ES&id=1vCWHaC5f2uS3yhpwWbIA6
+ x-spotify-docs-endpoint-name: Get an Artist's Albums
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Artists
+ x-spotify-docs-display-name: artist-albums
+ "/artists/{id}/related-artists":
+ get:
+ description: |
+ Get Spotify catalog information about artists similar to a given artist. Similarity is based on analysis of the Spotify community's [listening history](http://news.spotify.com/se/2010/02/03/related-artists/).
+ operationId: get-an-artists-related-artists
+ parameters:
+ - $ref: "#/components/parameters/PathArtistId"
+ responses:
+ "200":
+ $ref: "#/components/responses/ManyArtists"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Artist's Related Artists
+ tags:
+ - Artists
+ x-spotify-docs-console-url: /console/get-artist-related-artists/?id=43ZHCT0cAZBISjO8DG9PnE
+ x-spotify-docs-endpoint-name: Get an Artist's Related Artists
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Artists
+ x-spotify-docs-display-name: artist-related-artists
+ "/artists/{id}/top-tracks":
+ get:
+ description: |
+ Get Spotify catalog information about an artist's top tracks by country.
+ operationId: get-an-artists-top-tracks
+ parameters:
+ - $ref: "#/components/parameters/PathArtistId"
+ - $ref: "#/components/parameters/QueryMarket"
+ responses:
+ "200":
+ $ref: "#/components/responses/ManyTracks"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Artist's Top Tracks
+ tags:
+ - Artists
+ - Tracks
+ x-spotify-docs-console-url: /console/get-artist-top-tracks/?country=SE&id=43ZHCT0cAZBISjO8DG9PnE
+ x-spotify-docs-endpoint-name: Get an Artist's Top Tracks
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Artists
+ x-spotify-docs-display-name: artist-top-tracks
+ "/audio-analysis/{id}":
+ get:
+ description: |
+ Get a low-level audio analysis for a track in the Spotify catalog. The audio analysis describes the track’s structure and musical content, including rhythm, pitch, and timbre.
+ operationId: get-audio-analysis
+ parameters:
+ - in: path
+ name: id
+ required: true
+ schema:
+ description: |
+ The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids)
+ for the track.
+ example: 11dFghVXANMlKmJXsNCbNl
+ title: Spotify Track ID
+ type: string
+ responses:
+ "200":
+ $ref: "#/components/responses/OneAudioAnalysis"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Track's Audio Analysis
+ tags:
+ - Tracks
+ x-spotify-docs-console-url: /console/get-audio-analysis-track/?id=06AKEBrKUckW0KREUWRnvT
+ x-spotify-docs-endpoint-name: Get Audio Analysis for a Track
+ x-spotify-docs-category: Tracks
+ x-spotify-docs-display-name: audio-analysis-track
+ /audio-features:
+ get:
+ description: |
+ Get audio features for multiple tracks based on their Spotify IDs.
+ operationId: get-several-audio-features
+ parameters:
+ - in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids)
+ for the tracks. Maximum: 100 IDs.
+ example: 7ouMYWpwJ422jRcDASZB7P,4VqPOruhp5EdPBeR92t6lQ,2takcwOaAZWiXQijPHIx7B
+ title: Spotify Track IDs
+ type: string
+ responses:
+ "200":
+ $ref: "#/components/responses/ManyAudioFeatures"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Tracks' Audio Features
+ tags:
+ - Tracks
+ x-spotify-docs-console-url: /console/get-audio-features-several-tracks/?ids=4JpKVNYnVcJ8tuMKjAj50A,2NRANZE9UCmPAS5XVbXL40,24JygzOLM0EmRQeGtFcIcG
+ x-spotify-docs-endpoint-name: Get Audio Features for Several Tracks
+ x-spotify-docs-category: Tracks
+ x-spotify-docs-display-name: audio-features-several-tracks
+ "/audio-features/{id}":
+ get:
+ description: |
+ Get audio feature information for a single track identified by its unique
+ Spotify ID.
+ operationId: get-audio-features
+ parameters:
+ - in: path
+ name: id
+ required: true
+ schema:
+ description: |
+ The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the track.
+ example: 11dFghVXANMlKmJXsNCbNl
+ title: Spotify Track ID
+ type: string
+ responses:
+ "200":
+ $ref: "#/components/responses/OneAudioFeatures"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Track's Audio Features
+ tags:
+ - Tracks
+ x-spotify-docs-console-url: /console/get-audio-features-track/?id=06AKEBrKUckW0KREUWRnvT
+ x-spotify-docs-endpoint-name: Get Audio Features for a Track
+ x-spotify-docs-category: Tracks
+ x-spotify-docs-display-name: audio-features-track
+ /audiobooks:
+ get:
+ description: |
+ Get Spotify catalog information for several audiobooks identified by their Spotify IDs.
+ **Note: Audiobooks are only available for the US, UK, Ireland, New Zealand and Australia markets.**
+ operationId: get-multiple-audiobooks
+ parameters:
+ - $ref: "#/components/parameters/QueryAudiobookIds"
+ - $ref: "#/components/parameters/QueryMarket"
+ responses:
+ "200":
+ $ref: "#/components/responses/ManyAudiobooks"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Several Audiobooks
+ tags:
+ - Audiobooks
+ x-spotify-docs-console-url: /console/get-several-audiobooks/?ids=5thw29eqjomhIDMY1XKsLk,2IEBhnu61ieYGFRPEJIO40
+ x-spotify-docs-endpoint-name: Get Several Audiobooks
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Audiobooks
+ x-spotify-docs-display-name: several-audiobooks
+ "/audiobooks/{id}":
+ get:
+ description: |
+ Get Spotify catalog information for a single audiobook.
+ **Note: Audiobooks are only available for the US, UK, Ireland, New Zealand and Australia markets.**
+ operationId: get-an-audiobook
+ parameters:
+ - $ref: "#/components/parameters/PathAudiobookId"
+ - $ref: "#/components/parameters/QueryMarket"
+ responses:
+ "200":
+ $ref: "#/components/responses/OneAudiobook"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get an Audiobook
+ tags:
+ - Audiobooks
+ x-spotify-docs-console-url: /console/get-audiobook/?id=5thw29eqjomhIDMY1XKsLk
+ x-spotify-docs-endpoint-name: Get an Audiobook
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Audiobooks
+ x-spotify-docs-display-name: audiobook
+ "/audiobooks/{id}/chapters":
+ get:
+ description: |
+ Get Spotify catalog information about an audiobook's chapters.
+ **Note: Audiobooks are only available for the US, UK, Ireland, New Zealand and Australia markets.**
+ operationId: get-audiobook-chapters
+ parameters:
+ - $ref: "#/components/parameters/PathAudiobookId"
+ - $ref: "#/components/parameters/QueryMarket"
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagingSimplifiedChapterObject"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Audiobook Chapters
+ tags:
+ - Audiobooks
+ - Chapters
+ x-spotify-docs-console-url: /console/get-audiobook-chapters/?id=5thw29eqjomhIDMY1XKsLk
+ x-spotify-docs-endpoint-name: Get an Audiobook's Chapters
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Audiobooks
+ x-spotify-docs-display-name: audiobook-chapters
+ /browse/categories:
+ get:
+ description: |
+ Get a list of categories used to tag items in Spotify (on, for example, the Spotify player’s “Browse” tab).
+ operationId: get-categories
+ parameters:
+ - in: query
+ name: country
+ required: false
+ schema:
+ description: |
+ A country: an [ISO 3166-1 alpha-2 country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). Provide this parameter if you want to narrow the list of returned categories to those relevant to a particular country. If omitted, the returned items will be globally relevant.
+ example: SE
+ title: Country
+ type: string
+ - in: query
+ name: locale
+ required: false
+ schema:
+ description: |
+ The desired language, consisting of an [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code and an [ISO 3166-1 alpha-2 country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), joined by an underscore. For example: `es_MX`, meaning "Spanish (Mexico)". Provide this parameter if you want the category metadata returned in a particular language.
+ _**Note**: if `locale` is not supplied, or if the specified language is not available, all strings will be returned in the Spotify default language (American English). The `locale` parameter, combined with the `country` parameter, may give odd results if not carefully matched. For example `country=SE&locale=de_DE` will return a list of categories relevant to Sweden but as German language strings._
+ example: sv_SE
+ title: Locale
+ type: string
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagedCategories"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Several Browse Categories
+ tags:
+ - Categories
+ x-spotify-docs-console-url: /console/get-browse-categories/
+ x-spotify-docs-endpoint-name: Get All Categories
+ x-spotify-docs-category: Browse
+ x-spotify-docs-display-name: browse-categories
+ "/browse/categories/{category_id}":
+ get:
+ description: |
+ Get a single category used to tag items in Spotify (on, for example, the Spotify player’s “Browse” tab).
+ operationId: get-a-category
+ parameters:
+ - in: path
+ name: category_id
+ required: true
+ schema:
+ description: |
+ The [Spotify category ID](/documentation/web-api/#spotify-uris-and-ids) for the category.
+ example: dinner
+ title: Category ID
+ type: string
+ - in: query
+ name: country
+ required: false
+ schema:
+ description: |
+ A country: an [ISO 3166-1 alpha-2 country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). Provide this parameter to ensure that the category exists for a particular country.
+ example: SE
+ title: Country
+ type: string
+ - in: query
+ name: locale
+ required: false
+ schema:
+ description: |
+ The desired language, consisting of an [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code and an [ISO 3166-1 alpha-2 country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), joined by an underscore. For example: `es_MX`, meaning "Spanish (Mexico)". Provide this parameter if you want the category strings returned in a particular language.
_**Note**: if `locale` is not supplied, or if the specified language is not available, the category strings returned will be in the Spotify default language (American English)._
+ example: sv_SE
+ title: Locale
+ type: string
+ responses:
+ "200":
+ $ref: "#/components/responses/OneCategory"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Single Browse Category
+ tags:
+ - Categories
+ x-spotify-docs-console-url: /console/get-browse-category/
+ x-spotify-docs-endpoint-name: Get a Category
+ x-spotify-docs-category: Browse
+ x-spotify-docs-display-name: browse-category
+ "/browse/categories/{category_id}/playlists":
+ get:
+ description: |
+ Get a list of Spotify playlists tagged with a particular category.
+ operationId: get-a-categories-playlists
+ parameters:
+ - in: path
+ name: category_id
+ required: true
+ schema:
+ description: |
+ The [Spotify category ID](/documentation/web-api/#spotify-uris-and-ids) for the category.
+ example: dinner
+ title: Category ID
+ type: string
+ - in: query
+ name: country
+ required: false
+ schema:
+ description: |
+ A country: an [ISO 3166-1 alpha-2 country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). Provide this parameter to ensure that the category exists for a particular country.
+ example: SE
+ title: Country
+ type: string
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagedFeaturedPlaylists"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Category's Playlists
+ tags:
+ - Playlists
+ - Categories
+ x-spotify-docs-console-url: /console/get-category-playlists/?country=BR&category_id=party&limit=2
+ x-spotify-docs-endpoint-name: Get a Category's Playlists
+ x-spotify-docs-category: Browse
+ x-spotify-docs-display-name: category-playlists
+ /browse/featured-playlists:
+ get:
+ description: |
+ Get a list of Spotify featured playlists (shown, for example, on a Spotify player's 'Browse' tab).
+ operationId: get-featured-playlists
+ parameters:
+ - in: query
+ name: country
+ required: false
+ schema:
+ description: |
+ A country: an [ISO 3166-1 alpha-2 country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). Provide this parameter if you want the list of returned items to be relevant to a particular country. If omitted, the returned items will be relevant to all countries.
+ example: SE
+ title: Country
+ type: string
+ - in: query
+ name: locale
+ required: false
+ schema:
+ description: |
+ The desired language, consisting of a lowercase [ISO 639-1 language code](http://en.wikipedia.org/wiki/ISO_639-1) and an uppercase [ISO 3166-1 alpha-2 country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), joined by an underscore. For example: `es_MX`, meaning "Spanish (Mexico)". Provide this parameter if you want the results returned in a particular language (where available).
+ _**Note**: if `locale` is not supplied, or if the specified language is not available, all strings will be returned in the Spotify default language (American English). The `locale` parameter, combined with the `country` parameter, may give odd results if not carefully matched. For example `country=SE&locale=de_DE` will return a list of categories relevant to Sweden but as German language strings._
+ example: sv_SE
+ title: Locale
+ type: string
+ - in: query
+ name: timestamp
+ required: false
+ schema:
+ description: |
+ A timestamp in [ISO 8601 format](http://en.wikipedia.org/wiki/ISO_8601): `yyyy-MM-ddTHH:mm:ss`. Use this parameter to specify the user's local time to get results tailored for that specific date and time in the day. If not provided, the response defaults to the current UTC time. Example: "2014-10-23T09:00:00" for a user whose local time is 9AM. If there were no featured playlists (or there is no data) at the specified time, the response will revert to the current UTC time.
+ example: 2014-10-23T09:00:00
+ title: Timestamp
+ type: string
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagedFeaturedPlaylists"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Featured Playlists
+ tags:
+ - Playlists
+ x-spotify-docs-console-url: /console/get-featured-playlists/?country=SE&limit=2
+ x-spotify-docs-endpoint-name: Get All Featured Playlists
+ x-spotify-policy-list:
+ - $ref: "#/components/x-spotify-policy/MultipleIntegrations"
+ x-spotify-docs-category: Browse
+ x-spotify-docs-display-name: featured-playlists
+ /browse/new-releases:
+ get:
+ description: |
+ Get a list of new album releases featured in Spotify (shown, for example, on a Spotify player’s “Browse” tab).
+ operationId: get-new-releases
+ parameters:
+ - in: query
+ name: country
+ required: false
+ schema:
+ description: |
+ A country: an [ISO 3166-1 alpha-2 country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). Provide this parameter if you want the list of returned items to be relevant to a particular country. If omitted, the returned items will be relevant to all countries.
+ example: SE
+ title: Country
+ type: string
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagedAlbums"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get New Releases
+ tags:
+ - Albums
+ x-spotify-docs-console-url: /console/get-new-releases/?country=SE
+ x-spotify-docs-endpoint-name: Get All New Releases
+ x-spotify-policy-list:
+ - $ref: "#/components/x-spotify-policy/MultipleIntegrations"
+ x-spotify-docs-category: Browse
+ x-spotify-docs-display-name: new-releases
+ /chapters:
+ get:
+ description: |
+ Get Spotify catalog information for several chapters identified by their Spotify IDs.
+ **Note: Chapters are only available for the US, UK, Ireland, New Zealand and Australia markets.**
+ operationId: get-several-chapters
+ parameters:
+ - $ref: "#/components/parameters/QueryChapterIds"
+ - $ref: "#/components/parameters/QueryMarket"
+ responses:
+ "200":
+ $ref: "#/components/responses/ManyChapters"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Several Chapters
+ tags:
+ - Chapters
+ x-spotify-docs-console-url: /console/get-several-chapters/?ids=2i47HuOBSV2XaJNy0NCZXM,2GUbORsUnP1qVVlLwd9DzP
+ x-spotify-docs-endpoint-name: Get Several Chapters
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Chapters
+ x-spotify-docs-display-name: several-chapters
+ "/chapters/{id}":
+ get:
+ description: |
+ Get Spotify catalog information for a single chapter.
+ **Note: Chapters are only available for the US, UK, Ireland, New Zealand and Australia markets.**
+ operationId: get-a-chapter
+ parameters:
+ - $ref: "#/components/parameters/PathChapterId"
+ - $ref: "#/components/parameters/QueryMarket"
+ responses:
+ "200":
+ $ref: "#/components/responses/OneChapter"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get a Chapter
+ tags:
+ - Chapters
+ x-spotify-docs-console-url: /console/get-chapter/?id=2i47HuOBSV2XaJNy0NCZXM
+ x-spotify-docs-endpoint-name: Get a Chapter
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Chapters
+ x-spotify-docs-display-name: chapters
+ /episodes:
+ get:
+ description: |
+ Get Spotify catalog information for several episodes based on their Spotify IDs.
+ operationId: get-multiple-episodes
+ parameters:
+ - in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids) for the episodes. Maximum: 50 IDs.
+ example: 77o6BIVlYM3msb4MMIL1jH,0Q86acNRm6V9GYx55SXKwf
+ title: Ids
+ type: string
+ - $ref: "#/components/parameters/QueryMarket"
+ responses:
+ "200":
+ $ref: "#/components/responses/ManyEpisodes"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-read-playback-position
+ summary: |
+ Get Several Episodes
+ tags:
+ - Episodes
+ x-spotify-docs-console-url: /console/get-several-episodes/?ids=77o6BIVlYM3msb4MMIL1jH,0Q86acNRm6V9GYx55SXKwf
+ x-spotify-docs-endpoint-name: Get Multiple Episodes
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Episodes
+ x-spotify-docs-display-name: several-episodes
+ "/episodes/{id}":
+ get:
+ description: |
+ Get Spotify catalog information for a single episode identified by its
+ unique Spotify ID.
+ operationId: get-an-episode
+ parameters:
+ - in: path
+ name: id
+ required: true
+ schema:
+ description: The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the episode.
+ example: 512ojhOuo1ktJprKbVcKyQ
+ title: Get an Episode
+ type: string
+ - $ref: "#/components/parameters/QueryMarket"
+ responses:
+ "200":
+ $ref: "#/components/responses/OneEpisode"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-read-playback-position
+ summary: |
+ Get Episode
+ tags:
+ - Episodes
+ x-spotify-docs-console-url: /console/get-episode/?id=512ojhOuo1ktJprKbVcKyQ
+ x-spotify-docs-endpoint-name: Get an Episode
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Episodes
+ x-spotify-docs-display-name: episode
+ /markets:
+ get:
+ description: |
+ Get the list of markets where Spotify is available.
+ operationId: get-available-markets
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ properties:
+ markets:
+ example:
+ - CA
+ - BR
+ - IT
+ items:
+ type: string
+ type: array
+ type: object
+ description: A markets object with an array of country codes
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Available Markets
+ tags:
+ - Markets
+ x-spotify-docs-console-url: /console/get-available-markets/
+ x-spotify-docs-endpoint-name: Get Available Markets
+ x-spotify-docs-category: Markets
+ x-spotify-docs-display-name: available-markets
+ /me:
+ get:
+ description: |
+ Get detailed profile information about the current user (including the
+ current user's username).
+ operationId: get-current-users-profile
+ responses:
+ "200":
+ $ref: "#/components/responses/OnePrivateUser"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-read-private
+ - user-read-email
+ summary: |
+ Get Current User's Profile
+ tags:
+ - Users
+ x-spotify-docs-console-url: /console/get-current-user/
+ x-spotify-docs-endpoint-name: Get Current User's Profile
+ x-spotify-docs-category: Users Profile
+ x-spotify-docs-display-name: current-user
+ /me/albums:
+ delete:
+ description: |
+ Remove one or more albums from the current user's 'Your Music' library.
+ operationId: remove-albums-user
+ parameters:
+ - $ref: "#/components/parameters/QueryAlbumIds"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ properties:
+ ids:
+ description: |
+ A JSON array of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids). For example: `["4iV5W9uYEdYUVa79Axb7Rh", "1301WleyT98MSxVHPZCA6M"]`
A maximum of 50 items can be specified in one request. _**Note**: if the `ids` parameter is present in the query string, any IDs listed here in the body will be ignored._
+ items:
+ type: string
+ type: array
+ type: object
+ responses:
+ "200":
+ description: Album(s) have been removed from the library
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-modify
+ summary: |
+ Remove Users' Saved Albums
+ tags:
+ - Albums
+ - Library
+ x-spotify-docs-console-url: /console/delete-current-user-saved-albums/?ids=07bYtmE3bPsLB6ZbmmFi8d%2C48JYNjh7GMie6NjqYHMmtT%2C27cZdqrQiKt3IT00338dws
+ x-spotify-docs-endpoint-name: Remove Albums for Current User
+ get:
+ description: |
+ Get a list of the albums saved in the current Spotify user's 'Your Music' library.
+ operationId: get-users-saved-albums
+ parameters:
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ - $ref: "#/components/parameters/QueryMarket"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagingSavedAlbumObject"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-read
+ summary: |
+ Get User's Saved Albums
+ tags:
+ - Albums
+ - Library
+ x-spotify-docs-console-url: /console/get-current-user-saved-albums/?limit=1
+ x-spotify-docs-endpoint-name: Get User's Saved Albums
+ put:
+ description: |
+ Save one or more albums to the current user's 'Your Music' library.
+ operationId: save-albums-user
+ parameters:
+ - $ref: "#/components/parameters/QueryAlbumIds"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ properties:
+ ids:
+ description: |
+ A JSON array of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids). For example: `["4iV5W9uYEdYUVa79Axb7Rh", "1301WleyT98MSxVHPZCA6M"]`
A maximum of 50 items can be specified in one request. _**Note**: if the `ids` parameter is present in the query string, any IDs listed here in the body will be ignored._
+ items:
+ type: string
+ type: array
+ type: object
+ responses:
+ "200":
+ description: The album is saved
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-modify
+ summary: |
+ Save Albums for Current User
+ tags:
+ - Albums
+ - Library
+ x-spotify-docs-console-url: /console/put-current-user-saved-albums/?ids=07bYtmE3bPsLB6ZbmmFi8d%2C48JYNjh7GMie6NjqYHMmtT%2C27cZdqrQiKt3IT00338dws
+ x-spotify-docs-endpoint-name: Save Albums for Current User
+ x-spotify-docs-category: Library
+ x-spotify-docs-display-name: current-user-saved-albums
+ /me/albums/contains:
+ get:
+ description: |
+ Check if one or more albums is already saved in the current Spotify user's 'Your Music' library.
+ operationId: check-users-saved-albums
+ parameters:
+ - $ref: "#/components/parameters/QueryAlbumIds"
+ responses:
+ "200":
+ $ref: "#/components/responses/ArrayOfBooleans"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-read
+ summary: |
+ Check User's Saved Albums
+ tags:
+ - Albums
+ - Library
+ x-spotify-docs-console-url: /console/get-current-user-contains-saved-albums/?ids=0pJJgBzj26qnE1nSQUxaB0%2C5ZAKzV4ZIa5Gt7z29OYHv0
+ x-spotify-docs-endpoint-name: Check User's Saved Albums
+ x-spotify-docs-category: Library
+ x-spotify-docs-display-name: current-user-contains-saved-albums
+ /me/audiobooks:
+ delete:
+ description: |
+ Remove one or more audiobooks from the Spotify user's library.
+ operationId: remove-audiobooks-user
+ parameters:
+ - $ref: "#/components/parameters/QueryAudiobookIds"
+ responses:
+ "200":
+ description: Audiobook(s) have been removed from the library
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-modify
+ summary: |
+ Remove User's Saved Audiobooks
+ tags:
+ - Audiobooks
+ - Library
+ x-spotify-docs-console-url: /console/delete-current-user-saved-audiobooks/?ids=07bYtmE3bPsLB6ZbmmFi8d%2C48JYNjh7GMie6NjqYHMmtT%2C27cZdqrQiKt3IT00338dws
+ x-spotify-docs-endpoint-name: Remove Audiobooks for Current User
+ get:
+ description: |
+ Get a list of the audiobooks saved in the current Spotify user's 'Your Music' library.
+ operationId: get-users-saved-audiobooks
+ parameters:
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagingSimplifiedAudiobookObject"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-read
+ summary: |
+ Get User's Saved Audiobooks
+ tags:
+ - Audiobooks
+ - Library
+ x-spotify-docs-console-url: /console/get-current-user-saved-audiobooks/?limit=1
+ x-spotify-docs-endpoint-name: Get User's Saved Audiobooks
+ put:
+ description: |
+ Save one or more audiobooks to the current Spotify user's library.
+ operationId: save-audiobooks-user
+ parameters:
+ - $ref: "#/components/parameters/QueryAudiobookIds"
+ responses:
+ "200":
+ description: Audiobook(s) are saved to the library
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-modify
+ summary: |
+ Save Audiobooks for Current User
+ tags:
+ - Audiobooks
+ - Library
+ x-spotify-docs-console-url: /console/put-current-user-saved-audiobooks/?ids=07bYtmE3bPsLB6ZbmmFi8d%2C48JYNjh7GMie6NjqYHMmtT%2C27cZdqrQiKt3IT00338dws
+ x-spotify-docs-endpoint-name: Save Audiobooks for Current User
+ x-spotify-docs-category: Library
+ x-spotify-docs-display-name: current-user-saved-audiobooks
+ /me/audiobooks/contains:
+ get:
+ description: |
+ Check if one or more audiobooks are already saved in the current Spotify user's library.
+ operationId: check-users-saved-audiobooks
+ parameters:
+ - $ref: "#/components/parameters/QueryAudiobookIds"
+ responses:
+ "200":
+ $ref: "#/components/responses/ArrayOfBooleans"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-read
+ summary: |
+ Check User's Saved Audiobooks
+ tags:
+ - Audiobooks
+ - Library
+ x-spotify-docs-console-url: /console/get-current-user-contains-saved-audiobooks/?ids=0pJJgBzj26qnE1nSQUxaB0%2C5ZAKzV4ZIa5Gt7z29OYHv0
+ x-spotify-docs-endpoint-name: Check User's Saved Audiobooks
+ x-spotify-docs-category: Library
+ x-spotify-docs-display-name: current-user-contains-saved-audiobooks
+ /me/episodes:
+ delete:
+ description: |
+ Remove one or more episodes from the current user's library.
+ operationId: remove-episodes-user
+ parameters:
+ - $ref: "#/components/parameters/QueryTrackIds"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ properties:
+ ids:
+ description: |
+ A JSON array of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids).
A maximum of 50 items can be specified in one request. _**Note**: if the `ids` parameter is present in the query string, any IDs listed here in the body will be ignored._
+ items:
+ type: string
+ type: array
+ type: object
+ responses:
+ "200":
+ description: Episode removed
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-modify
+ summary: |
+ Remove User's Saved Episodes
+ tags:
+ - Episodes
+ - Library
+ x-spotify-docs-console-url: /console/delete-current-user-saved-episodes/?ids=77o6BIVlYM3msb4MMIL1jH%2C0Q86acNRm6V9GYx55SXKwf
+ x-spotify-docs-endpoint-name: Remove User's Saved Episodes
+ get:
+ description: |
+ Get a list of the episodes saved in the current Spotify user's library.
+ operationId: get-users-saved-episodes
+ parameters:
+ - $ref: "#/components/parameters/QueryMarket"
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagingSavedEpisodeObject"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-read
+ - user-read-playback-position
+ summary: |
+ Get User's Saved Episodes
+ tags:
+ - Episodes
+ - Library
+ x-spotify-docs-console-url: /console/get-current-user-saved-episodes/
+ x-spotify-docs-endpoint-name: Get User's Saved Episodes
+ put:
+ description: |
+ Save one or more episodes to the current user's library.
+ operationId: save-episodes-user
+ parameters:
+ - in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids). Maximum: 50 IDs.
+ example: 77o6BIVlYM3msb4MMIL1jH,0Q86acNRm6V9GYx55SXKwf
+ title: Spotify Episodes IDs
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ properties:
+ ids:
+ description: |
+ A JSON array of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids).
A maximum of 50 items can be specified in one request. _**Note**: if the `ids` parameter is present in the query string, any IDs listed here in the body will be ignored._
+ items:
+ type: string
+ type: array
+ required:
+ - uris
+ type: object
+ responses:
+ "200":
+ description: Episode saved
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-modify
+ summary: |
+ Save Episodes for Current User
+ tags:
+ - Episodes
+ - Library
+ x-spotify-docs-console-url: /console/put-current-user-saved-episodes/?ids=77o6BIVlYM3msb4MMIL1jH%2C0Q86acNRm6V9GYx55SXKwf
+ x-spotify-docs-endpoint-name: Save Episodes for Current User
+ x-spotify-docs-category: Library
+ x-spotify-docs-display-name: current-user-saved-episodes
+ /me/episodes/contains:
+ get:
+ description: |
+ Check if one or more episodes is already saved in the current Spotify user's 'Your Episodes' library.
+ operationId: check-users-saved-episodes
+ parameters:
+ - in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids) for the episodes. Maximum: 50 IDs.
+ example: 77o6BIVlYM3msb4MMIL1jH,0Q86acNRm6V9GYx55SXKwf
+ title: Spotify Episode IDs
+ type: string
+ responses:
+ "200":
+ $ref: "#/components/responses/ArrayOfBooleans"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-read
+ summary: |
+ Check User's Saved Episodes
+ tags:
+ - Episodes
+ - Library
+ x-spotify-docs-console-url: /console/get-current-user-contains-saved-episodes/?ids=77o6BIVlYM3msb4MMIL1jH%2C0Q86acNRm6V9GYx55SXKwf
+ x-spotify-docs-endpoint-name: Check User's Saved Episodes
+ x-spotify-docs-category: Library
+ x-spotify-docs-display-name: current-user-contains-saved-episodes
+ /me/following:
+ delete:
+ description: |
+ Remove the current user as a follower of one or more artists or other Spotify users.
+ operationId: unfollow-artists-users
+ parameters:
+ - in: query
+ name: type
+ required: true
+ schema:
+ description: |
+ The ID type: either `artist` or `user`.
+ enum:
+ - artist
+ - user
+ example: artist
+ title: Item Type
+ type: string
+ - in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the artist or the user [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids). For example: `ids=74ASZWbe4lXaubB36ztrGX,08td7MxkoHQkXnWAYD8d6Q`. A maximum of 50 IDs can be sent in one request.
+ example: 2CIMQHirSU0MQqyYHq0eOx,57dN52uHvrHOxijzpIgu3E,1vCWHaC5f2uS3yhpwWbIA6
+ title: Spotify IDs
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ properties:
+ ids:
+ description: |
+ A JSON array of the artist or user [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids). For example: `{ids:["74ASZWbe4lXaubB36ztrGX", "08td7MxkoHQkXnWAYD8d6Q"]}`. A maximum of 50 IDs can be sent in one request. _**Note**: if the `ids` parameter is present in the query string, any IDs listed here in the body will be ignored._
+ items:
+ type: string
+ type: array
+ type: object
+ responses:
+ "200":
+ description: Artist or user unfollowed
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-follow-modify
+ summary: |
+ Unfollow Artists or Users
+ tags:
+ - Users
+ - Artists
+ - Library
+ x-spotify-docs-console-url: /console/delete-following/?type=user&ids=exampleuser01
+ x-spotify-docs-endpoint-name: Unfollow Artists or Users
+ get:
+ description: |
+ Get the current user's followed artists.
+ operationId: get-followed
+ parameters:
+ - in: query
+ name: type
+ required: true
+ schema:
+ description: |
+ The ID type: currently only `artist` is supported.
+ enum:
+ - artist
+ example: artist
+ title: Item Type
+ type: string
+ - in: query
+ name: after
+ required: false
+ schema:
+ description: |
+ The last artist ID retrieved from the previous request.
+ example: 0I2XqVXqHScXjHhk6AYYRe
+ title: After
+ type: string
+ - in: query
+ name: limit
+ required: false
+ schema:
+ default: 20
+ description: |
+ The maximum number of items to return. Default: 20\. Minimum: 1\. Maximum: 50\.
+ example: 10
+ maximum: 50
+ minimum: 0
+ title: Limit
+ type: integer
+ responses:
+ "200":
+ $ref: "#/components/responses/CursorPagedArtists"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-follow-read
+ summary: |
+ Get Followed Artists
+ tags:
+ - Users
+ - Library
+ - Artists
+ x-spotify-docs-console-url: /console/get-following/?type=artist&limit=20
+ x-spotify-docs-endpoint-name: Get User's Followed Artists
+ put:
+ description: |
+ Add the current user as a follower of one or more artists or other Spotify users.
+ operationId: follow-artists-users
+ parameters:
+ - in: query
+ name: type
+ required: true
+ schema:
+ description: |
+ The ID type.
+ enum:
+ - artist
+ - user
+ example: artist
+ title: Item Type
+ type: string
+ - in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the artist or the user [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids).
+ A maximum of 50 IDs can be sent in one request.
+ example: 2CIMQHirSU0MQqyYHq0eOx,57dN52uHvrHOxijzpIgu3E,1vCWHaC5f2uS3yhpwWbIA6
+ title: Spotify IDs
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ properties:
+ ids:
+ description: |
+ A JSON array of the artist or user [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids).
+ For example: `{ids:["74ASZWbe4lXaubB36ztrGX", "08td7MxkoHQkXnWAYD8d6Q"]}`. A maximum of 50 IDs can be sent in one request. _**Note**: if the `ids` parameter is present in the query string, any IDs listed here in the body will be ignored._
+ items:
+ type: string
+ type: array
+ required:
+ - ids
+ type: object
+ responses:
+ "204":
+ description: Artist or user followed
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-follow-modify
+ summary: |
+ Follow Artists or Users
+ tags:
+ - Users
+ - Artists
+ - Library
+ x-spotify-docs-console-url: /console/put-following/?type=user&ids=exampleuser01
+ x-spotify-docs-endpoint-name: Follow Artists or Users
+ x-spotify-docs-category: Follow
+ x-spotify-docs-display-name: following
+ /me/following/contains:
+ get:
+ description: |
+ Check to see if the current user is following one or more artists or other Spotify users.
+ operationId: check-current-user-follows
+ parameters:
+ - in: query
+ name: type
+ required: true
+ schema:
+ description: |
+ The ID type: either `artist` or `user`.
+ enum:
+ - artist
+ - user
+ example: artist
+ title: Item Type
+ type: string
+ - in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the artist or the user [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids) to check. For example: `ids=74ASZWbe4lXaubB36ztrGX,08td7MxkoHQkXnWAYD8d6Q`. A maximum of 50 IDs can be sent in one request.
+ example: 2CIMQHirSU0MQqyYHq0eOx,57dN52uHvrHOxijzpIgu3E,1vCWHaC5f2uS3yhpwWbIA6
+ title: Spotify IDs
+ type: string
+ responses:
+ "200":
+ $ref: "#/components/responses/ArrayOfBooleans"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-follow-read
+ summary: |
+ Check If User Follows Artists or Users
+ tags:
+ - Users
+ - Artists
+ - Library
+ x-spotify-docs-console-url: /console/get-following-contains/?type=user&ids=exampleuser01
+ x-spotify-docs-endpoint-name: Get Following State for Artists/Users
+ x-spotify-docs-category: Follow
+ x-spotify-docs-display-name: following-contains
+ /me/player:
+ get:
+ description: |
+ Get information about the user’s current playback state, including track or episode, progress, and active device.
+ operationId: get-information-about-the-users-current-playback
+ parameters:
+ - $ref: "#/components/parameters/QueryMarket"
+ - $ref: "#/components/parameters/QueryAdditionalTypes"
+ responses:
+ "200":
+ $ref: "#/components/responses/OneCurrentlyPlaying"
+ "204":
+ description: Playback not available or active
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-read-playback-state
+ summary: |
+ Get Playback State
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/get-user-player/
+ x-spotify-docs-endpoint-name: Get Information About The User's Current Playback
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/playerPolicyList"
+ put:
+ description: |
+ Transfer playback to a new device and determine if it should start playing.
+ operationId: transfer-a-users-playback
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ example:
+ device_ids:
+ - 74ASZWbe4lXaubB36ztrGX
+ properties:
+ device_ids:
+ description: |
+ A JSON array containing the ID of the device on which playback should be started/transferred.
For example:`{device_ids:["74ASZWbe4lXaubB36ztrGX"]}`
_**Note**: Although an array is accepted, only a single device_id is currently supported. Supplying more than one will return `400 Bad Request`_
+ items:
+ type: string
+ type: array
+ play:
+ additionalProperties: true
+ description: |
+ **true**: ensure playback happens on new device.
**false** or not provided: keep the current playback state.
+ type: boolean
+ required:
+ - device_ids
+ type: object
+ responses:
+ "204":
+ description: Playback transferred
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-modify-playback-state
+ summary: |
+ Transfer Playback
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/put-user-player
+ x-spotify-docs-endpoint-name: Transfer a User's Playback
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/playerPolicyList"
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: user-player
+ /me/player/currently-playing:
+ get:
+ description: |
+ Get the object currently being played on the user's Spotify account.
+ operationId: get-the-users-currently-playing-track
+ parameters:
+ - $ref: "#/components/parameters/QueryMarket"
+ - $ref: "#/components/parameters/QueryAdditionalTypes"
+ responses:
+ "200":
+ $ref: "#/components/responses/OneCurrentlyPlayingTrack"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-read-currently-playing
+ summary: |
+ Get Currently Playing Track
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/get-users-currently-playing-track/
+ x-spotify-docs-endpoint-name: Get the User's Currently Playing Track
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/playerPolicyList"
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: users-currently-playing-track
+ /me/player/devices:
+ get:
+ description: |
+ Get information about a user’s available devices.
+ operationId: get-a-users-available-devices
+ responses:
+ "200":
+ $ref: "#/components/responses/ManyDevices"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-read-playback-state
+ summary: |
+ Get Available Devices
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/get-users-available-devices/
+ x-spotify-docs-endpoint-name: Get a User's Available Devices
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: users-available-devices
+ /me/player/next:
+ post:
+ description: |
+ Skips to next track in the user’s queue.
+ operationId: skip-users-playback-to-next-track
+ parameters:
+ - in: query
+ name: device_id
+ required: false
+ schema:
+ description: The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
+ example: 0d1841b0976bae2a3a310dd74c0f3df354899bc8
+ title: Device ID
+ type: string
+ responses:
+ "204":
+ description: Command sent
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-modify-playback-state
+ summary: |
+ Skip To Next
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/post-next/
+ x-spotify-docs-endpoint-name: Skip User’s Playback To Next Track
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/playerPolicyList"
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: next
+ /me/player/pause:
+ put:
+ description: |
+ Pause playback on the user's account.
+ operationId: pause-a-users-playback
+ parameters:
+ - in: query
+ name: device_id
+ required: false
+ schema:
+ description: |
+ The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
+ example: 0d1841b0976bae2a3a310dd74c0f3df354899bc8
+ title: Device ID
+ type: string
+ responses:
+ "204":
+ description: Playback paused
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-modify-playback-state
+ summary: |
+ Pause Playback
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/put-pause/
+ x-spotify-docs-endpoint-name: Pause a User's Playback
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/playerPolicyList"
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: pause
+ /me/player/play:
+ put:
+ description: |
+ Start a new context or resume current playback on the user's active device.
+ operationId: start-a-users-playback
+ parameters:
+ - in: query
+ name: device_id
+ required: false
+ schema:
+ description: The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
+ example: 0d1841b0976bae2a3a310dd74c0f3df354899bc8
+ title: Device ID
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ example:
+ context_uri: spotify:album:5ht7ItJgpBH7W6vJ5BqpPr
+ offset:
+ position: 5
+ position_ms: 0
+ properties:
+ context_uri:
+ additionalProperties: true
+ description: |
+ Optional. Spotify URI of the context to play.
+ Valid contexts are albums, artists & playlists.
+ `{context_uri:"spotify:album:1Je1IMUlBXcx1Fz0WE7oPT"}`
+ type: string
+ offset:
+ additionalProperties: true
+ description: |
+ Optional. Indicates from where in the context playback should start. Only available when context_uri corresponds to an album or playlist object
+ "position" is zero based and can’t be negative. Example: `"offset": {"position": 5}`
+ "uri" is a string representing the uri of the item to start at. Example: `"offset": {"uri": "spotify:track:1301WleyT98MSxVHPZCA6M"}`
+ type: object
+ position_ms:
+ additionalProperties: true
+ description: integer
+ type: integer
+ uris:
+ description: |
+ Optional. A JSON array of the Spotify track URIs to play.
+ For example: `{"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "spotify:track:1301WleyT98MSxVHPZCA6M"]}`
+ items:
+ type: string
+ type: array
+ type: object
+ responses:
+ "204":
+ description: Playback started
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-modify-playback-state
+ summary: |
+ Start/Resume Playback
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/put-play/
+ x-spotify-docs-endpoint-name: Start/Resume a User's Playback
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/playerPolicyList"
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: play
+ /me/player/previous:
+ post:
+ description: |
+ Skips to previous track in the user’s queue.
+ operationId: skip-users-playback-to-previous-track
+ parameters:
+ - in: query
+ name: device_id
+ required: false
+ schema:
+ description: |
+ The id of the device this command is targeting. If
+ not supplied, the user's currently active device is the target.
+ example: 0d1841b0976bae2a3a310dd74c0f3df354899bc8
+ title: Device ID
+ type: string
+ responses:
+ "204":
+ description: Command sent
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-modify-playback-state
+ summary: |
+ Skip To Previous
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/post-previous/
+ x-spotify-docs-endpoint-name: Skip User’s Playback To Previous Track
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/playerPolicyList"
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: previous
+ /me/player/queue:
+ get:
+ description: |
+ Get the list of objects that make up the user's queue.
+ operationId: get-queue
+ responses:
+ "200":
+ $ref: "#/components/responses/Queue"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-read-playback-state
+ summary: |
+ Get the User's Queue
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/get-queue/
+ x-spotify-docs-endpoint-name: Get the User's Queue
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/playerPolicyList"
+ post:
+ description: |
+ Add an item to the end of the user's current playback queue.
+ operationId: add-to-queue
+ parameters:
+ - in: query
+ name: uri
+ required: true
+ schema:
+ description: |
+ The uri of the item to add to the queue. Must be a track or an episode uri.
+ example: spotify:track:4iV5W9uYEdYUVa79Axb7Rh
+ title: Spotify URI
+ type: string
+ - in: query
+ name: device_id
+ required: false
+ schema:
+ description: |
+ The id of the device this command is targeting. If
+ not supplied, the user's currently active device is the target.
+ example: 0d1841b0976bae2a3a310dd74c0f3df354899bc8
+ title: Device ID
+ type: string
+ responses:
+ "204":
+ description: Command received
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-modify-playback-state
+ summary: |
+ Add Item to Playback Queue
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/post-queue/
+ x-spotify-docs-endpoint-name: Add an item to queue
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/playerPolicyList"
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: queue
+ /me/player/recently-played:
+ get:
+ description: |
+ Get tracks from the current user's recently played tracks.
+ _**Note**: Currently doesn't support podcast episodes._
+ operationId: get-recently-played
+ parameters:
+ - in: query
+ name: limit
+ required: false
+ schema:
+ default: 20
+ description: |
+ The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
+ example: 10
+ maximum: 50
+ minimum: 0
+ title: Limit
+ type: integer
+ - in: query
+ name: after
+ required: false
+ schema:
+ description: |
+ A Unix timestamp in milliseconds. Returns all items
+ after (but not including) this cursor position. If `after` is specified, `before`
+ must not be specified.
+ example: 1484811043508
+ title: After
+ type: integer
+ - in: query
+ name: before
+ required: false
+ schema:
+ description: |
+ A Unix timestamp in milliseconds. Returns all items
+ before (but not including) this cursor position. If `before` is specified,
+ `after` must not be specified.
+ title: Before
+ type: integer
+ responses:
+ "200":
+ $ref: "#/components/responses/CursorPagedPlayHistory"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-read-recently-played
+ summary: |
+ Get Recently Played Tracks
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/get-recently-played/
+ x-spotify-docs-endpoint-name: Get Current User's Recently Played Tracks
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/playerPolicyList"
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: recently-played
+ /me/player/repeat:
+ put:
+ description: |
+ Set the repeat mode for the user's playback. Options are repeat-track,
+ repeat-context, and off.
+ operationId: set-repeat-mode-on-users-playback
+ parameters:
+ - in: query
+ name: state
+ required: true
+ schema:
+ description: |
+ **track**, **context** or **off**.
+ **track** will repeat the current track.
+ **context** will repeat the current context.
+ **off** will turn repeat off.
+ example: context
+ title: State
+ type: string
+ - in: query
+ name: device_id
+ required: false
+ schema:
+ description: |
+ The id of the device this command is targeting. If
+ not supplied, the user's currently active device is the target.
+ example: 0d1841b0976bae2a3a310dd74c0f3df354899bc8
+ title: Device ID
+ type: string
+ responses:
+ "204":
+ description: Command sent
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-modify-playback-state
+ summary: |
+ Set Repeat Mode
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/put-repeat/
+ x-spotify-docs-endpoint-name: Set Repeat Mode On User’s Playback
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: repeat
+ /me/player/seek:
+ put:
+ description: |
+ Seeks to the given position in the user’s currently playing track.
+ operationId: seek-to-position-in-currently-playing-track
+ parameters:
+ - in: query
+ name: position_ms
+ required: true
+ schema:
+ description: |
+ The position in milliseconds to seek to. Must be a
+ positive number. Passing in a position that is greater than the length of
+ the track will cause the player to start playing the next song.
+ example: 25000
+ title: Position (ms)
+ type: integer
+ - in: query
+ name: device_id
+ required: false
+ schema:
+ description: |
+ The id of the device this command is targeting. If
+ not supplied, the user's currently active device is the target.
+ example: 0d1841b0976bae2a3a310dd74c0f3df354899bc8
+ title: Device ID
+ type: string
+ responses:
+ "204":
+ description: Command sent
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-modify-playback-state
+ summary: |
+ Seek To Position
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/put-seek/
+ x-spotify-docs-endpoint-name: Seek To Position In Currently Playing Track
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/playerPolicyList"
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: seek
+ /me/player/shuffle:
+ put:
+ description: |
+ Toggle shuffle on or off for user’s playback.
+ operationId: toggle-shuffle-for-users-playback
+ parameters:
+ - in: query
+ name: state
+ required: true
+ schema:
+ description: |
+ **true** : Shuffle user's playback.
+ **false** : Do not shuffle user's playback.
+ example: true
+ title: State
+ type: boolean
+ - in: query
+ name: device_id
+ required: false
+ schema:
+ description: |
+ The id of the device this command is targeting. If
+ not supplied, the user's currently active device is the target.
+ example: 0d1841b0976bae2a3a310dd74c0f3df354899bc8
+ title: Device ID
+ type: string
+ responses:
+ "204":
+ description: Command sent
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-modify-playback-state
+ summary: |
+ Toggle Playback Shuffle
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/put-shuffle/?state=true
+ x-spotify-docs-endpoint-name: Toggle Shuffle For User’s Playback
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: shuffle
+ /me/player/volume:
+ put:
+ description: |
+ Set the volume for the user’s current playback device.
+ operationId: set-volume-for-users-playback
+ parameters:
+ - in: query
+ name: volume_percent
+ required: true
+ schema:
+ description: |
+ The volume to set. Must be a value from 0 to 100 inclusive.
+ example: 50
+ title: Volume %
+ type: integer
+ - in: query
+ name: device_id
+ required: false
+ schema:
+ description: |
+ The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
+ example: 0d1841b0976bae2a3a310dd74c0f3df354899bc8
+ title: Device ID
+ type: string
+ responses:
+ "204":
+ description: Command sent
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-modify-playback-state
+ summary: |
+ Set Playback Volume
+ tags:
+ - Player
+ x-spotify-docs-console-url: /console/put-volume/
+ x-spotify-docs-endpoint-name: Set Volume For User's Playback
+ x-spotify-docs-category: Player
+ x-spotify-docs-display-name: volume
+ /me/playlists:
+ get:
+ description: |
+ Get a list of the playlists owned or followed by the current Spotify
+ user.
+ operationId: get-a-list-of-current-users-playlists
+ parameters:
+ - $ref: "#/components/parameters/QueryLimit"
+ - in: query
+ name: offset
+ required: false
+ schema:
+ default: 0
+ description: |
+ 'The index of the first playlist to return. Default:
+ 0 (the first object). Maximum offset: 100.000\. Use with `limit` to get the
+ next set of playlists.'
+ example: 5
+ title: Offset
+ type: integer
+ responses:
+ "200":
+ $ref: "#/components/responses/PagedPlaylists"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - playlist-read-private
+ summary: |
+ Get Current User's Playlists
+ tags:
+ - Playlists
+ - Library
+ x-spotify-docs-console-url: /console/get-current-user-playlists/
+ x-spotify-docs-endpoint-name: Get a List of Current User's Playlists
+ x-spotify-docs-category: Playlists
+ x-spotify-docs-display-name: current-user-playlists
+ /me/shows:
+ delete:
+ description: |
+ Delete one or more shows from current Spotify user's library.
+ operationId: remove-shows-user
+ parameters:
+ - $ref: "#/components/parameters/QueryShowIds"
+ - $ref: "#/components/parameters/QueryMarket"
+ responses:
+ "200":
+ description: Show removed
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-modify
+ summary: |
+ Remove User's Saved Shows
+ tags:
+ - Shows
+ - Library
+ x-spotify-docs-console-url: /console/delete-current-user-saved-shows/?ids=5AvwZVawapvyhJUIx71pdJ%2C6ups0LMt1G8n81XLlkbsPo%2C5AvwZVawapvyhJUIx71pdJ
+ x-spotify-docs-endpoint-name: Remove User's Saved Shows
+ get:
+ description: |
+ Get a list of shows saved in the current Spotify user's library. Optional parameters can be used to limit the number of shows returned.
+ operationId: get-users-saved-shows
+ parameters:
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagingSavedShowObject"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-read
+ summary: |
+ Get User's Saved Shows
+ tags:
+ - Shows
+ - Library
+ x-spotify-docs-console-url: /console/get-current-user-saved-shows/
+ x-spotify-docs-endpoint-name: Get User's Saved Shows
+ put:
+ description: |
+ Save one or more shows to current Spotify user's library.
+ operationId: save-shows-user
+ parameters:
+ - $ref: "#/components/parameters/QueryShowIds"
+ responses:
+ "200":
+ description: Show saved
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-modify
+ summary: |
+ Save Shows for Current User
+ tags:
+ - Shows
+ - Library
+ x-spotify-docs-console-url: /console/put-current-user-saved-shows/?ids=5AvwZVawapvyhJUIx71pdJ%2C6ups0LMt1G8n81XLlkbsPo%2C5AvwZVawapvyhJUIx71pdJ
+ x-spotify-docs-endpoint-name: Save Shows for Current User
+ x-spotify-docs-category: Library
+ x-spotify-docs-display-name: current-user-saved-shows
+ /me/shows/contains:
+ get:
+ description: |
+ Check if one or more shows is already saved in the current Spotify user's library.
+ operationId: check-users-saved-shows
+ parameters:
+ - $ref: "#/components/parameters/QueryShowIds"
+ responses:
+ "200":
+ $ref: "#/components/responses/ArrayOfBooleans"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-read
+ summary: |
+ Check User's Saved Shows
+ tags:
+ - Shows
+ - Library
+ x-spotify-docs-console-url: /console/get-current-user-contains-saved-shows/?ids=5AvwZVawapvyhJUIx71pdJ%2C6ups0LMt1G8n81XLlkbsPo%2C5AvwZVawapvyhJUIx71pdJ
+ x-spotify-docs-endpoint-name: Check User's Saved Shows
+ x-spotify-docs-category: Library
+ x-spotify-docs-display-name: current-user-contains-saved-shows
+ "/me/top/{type}":
+ get:
+ description: |
+ Get the current user's top artists or tracks based on calculated affinity.
+ operationId: get-users-top-artists-and-tracks
+ parameters:
+ - in: path
+ name: type
+ required: true
+ schema:
+ description: |
+ The type of entity to return. Valid values: `artists` or `tracks`
+ enum:
+ - artists
+ - tracks
+ title: Type
+ type: string
+ - in: query
+ name: time_range
+ required: false
+ schema:
+ default: medium_term
+ description: |
+ Over what time frame the affinities are computed. Valid values: `long_term` (calculated from several years of data and including all new data as it becomes available), `medium_term` (approximately last 6 months), `short_term` (approximately last 4 weeks). Default: `medium_term`
+ example: medium_term
+ title: Time Range
+ type: string
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagingArtistOrTrackObject"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-top-read
+ summary: |
+ Get User's Top Items
+ tags:
+ - Users
+ - Tracks
+ - Library
+ x-spotify-docs-console-url: /console/get-current-user-top-artists-and-tracks/?type=artists
+ x-spotify-docs-endpoint-name: Get a User's Top Artists and Tracks
+ x-spotify-docs-category: Personalization
+ x-spotify-docs-display-name: current-user-top-artists-and-tracks
+ /me/tracks:
+ delete:
+ description: |
+ Remove one or more tracks from the current user's 'Your Music' library.
+ operationId: remove-tracks-user
+ parameters:
+ - $ref: "#/components/parameters/QueryTrackIds"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ properties:
+ ids:
+ description: |
+ A JSON array of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids). For example: `["4iV5W9uYEdYUVa79Axb7Rh", "1301WleyT98MSxVHPZCA6M"]`
A maximum of 50 items can be specified in one request. _**Note**: if the `ids` parameter is present in the query string, any IDs listed here in the body will be ignored._
+ items:
+ type: string
+ type: array
+ type: object
+ responses:
+ "200":
+ description: Track removed
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-modify
+ summary: |
+ Remove User's Saved Tracks
+ tags:
+ - Tracks
+ - Library
+ x-spotify-docs-console-url: /console/delete-current-user-saved-tracks/?ids=7ouMYWpwJ422jRcDASZB7P%2C4VqPOruhp5EdPBeR92t6lQ%2C2takcwOaAZWiXQijPHIx7B
+ x-spotify-docs-endpoint-name: Remove User's Saved Tracks
+ get:
+ description: |
+ Get a list of the songs saved in the current Spotify user's 'Your Music' library.
+ operationId: get-users-saved-tracks
+ parameters:
+ - $ref: "#/components/parameters/QueryMarket"
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagingSavedTrackObject"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-read
+ summary: |
+ Get User's Saved Tracks
+ tags:
+ - Tracks
+ - Library
+ x-spotify-docs-console-url: /console/get-current-user-saved-tracks/
+ x-spotify-docs-endpoint-name: Get User's Saved Tracks
+ put:
+ description: |
+ Save one or more tracks to the current user's 'Your Music' library.
+ operationId: save-tracks-user
+ parameters:
+ - $ref: "#/components/parameters/QueryTrackIds"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ properties:
+ ids:
+ description: |
+ A JSON array of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids). For example: `["4iV5W9uYEdYUVa79Axb7Rh", "1301WleyT98MSxVHPZCA6M"]`
A maximum of 50 items can be specified in one request. _**Note**: if the `ids` parameter is present in the query string, any IDs listed here in the body will be ignored._
+ items:
+ type: string
+ type: array
+ required:
+ - uris
+ type: object
+ responses:
+ "200":
+ description: Track saved
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-modify
+ summary: |
+ Save Tracks for Current User
+ tags:
+ - Tracks
+ - Library
+ x-spotify-docs-console-url: /console/put-current-user-saved-tracks/?ids=7ouMYWpwJ422jRcDASZB7P%2C4VqPOruhp5EdPBeR92t6lQ%2C2takcwOaAZWiXQijPHIx7B
+ x-spotify-docs-endpoint-name: Save Tracks for User
+ x-spotify-docs-category: Library
+ x-spotify-docs-display-name: current-user-saved-tracks
+ /me/tracks/contains:
+ get:
+ description: |
+ Check if one or more tracks is already saved in the current Spotify user's 'Your Music' library.
+ operationId: check-users-saved-tracks
+ parameters:
+ - $ref: "#/components/parameters/QueryTrackIds"
+ responses:
+ "200":
+ $ref: "#/components/responses/ArrayOfBooleans"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-library-read
+ summary: |
+ Check User's Saved Tracks
+ tags:
+ - Tracks
+ - Library
+ x-spotify-docs-console-url: /console/get-current-user-contains-saved-tracks/?ids=0udZHhCi7p1YzMlvI4fXoK%2C3SF5puV5eb6bgRSxBeMOk9
+ x-spotify-docs-endpoint-name: Check User's Saved Tracks
+ x-spotify-docs-category: Library
+ x-spotify-docs-display-name: current-user-contains-saved-tracks
+ "/playlists/{playlist_id}":
+ get:
+ description: |
+ Get a playlist owned by a Spotify user.
+ operationId: get-playlist
+ parameters:
+ - $ref: "#/components/parameters/PathPlaylistId"
+ - $ref: "#/components/parameters/QueryMarket"
+ - in: query
+ name: fields
+ required: false
+ schema:
+ description: |
+ Filters for the query: a comma-separated list of the
+ fields to return. If omitted, all fields are returned. For example, to get
+ just the playlist''s description and URI: `fields=description,uri`. A dot
+ separator can be used to specify non-reoccurring fields, while parentheses
+ can be used to specify reoccurring fields within objects. For example, to
+ get just the added date and user ID of the adder: `fields=tracks.items(added_at,added_by.id)`.
+ Use multiple parentheses to drill down into nested objects, for example: `fields=tracks.items(track(name,href,album(name,href)))`.
+ Fields can be excluded by prefixing them with an exclamation mark, for example:
+ `fields=tracks.items(track(name,href,album(!name,href)))`
+ example: items(added_by.id,track(name,href,album(name,href)))
+ title: Fields
+ type: string
+ - $ref: "#/components/parameters/QueryAdditionalTypes"
+ responses:
+ "200":
+ $ref: "#/components/responses/OnePlaylist"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Playlist
+ tags:
+ - Playlists
+ x-spotify-docs-console-url: /console/get-playlist/?playlist_id=59ZbFPES4DQwEjBpWHzrtC&user_id=spotify
+ x-spotify-docs-endpoint-name: Get a Playlist
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ put:
+ description: |
+ Change a playlist's name and public/private state. (The user must, of
+ course, own the playlist.)
+ operationId: change-playlist-details
+ parameters:
+ - $ref: "#/components/parameters/PathPlaylistId"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ example:
+ description: Updated playlist description
+ name: Updated Playlist Name
+ public: false
+ properties:
+ collaborative:
+ description: |
+ If `true`, the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client.
+ _**Note**: You can only set `collaborative` to `true` on non-public playlists._
+ type: boolean
+ description:
+ description: |
+ Value for playlist description as displayed in Spotify Clients and in the Web API.
+ type: string
+ name:
+ description: |
+ The new name for the playlist, for example `"My New Playlist Title"`
+ type: string
+ public:
+ description: |
+ If `true` the playlist will be public, if `false` it will be private.
+ type: boolean
+ type: object
+ responses:
+ "200":
+ description: Playlist updated
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - playlist-modify-public
+ - playlist-modify-private
+ summary: |
+ Change Playlist Details
+ tags:
+ - Playlists
+ - Library
+ x-spotify-docs-console-url: /console/put-playlist/
+ x-spotify-docs-endpoint-name: Change a Playlist's Details
+ x-spotify-docs-category: Playlists
+ x-spotify-docs-display-name: playlist
+ "/playlists/{playlist_id}/followers":
+ delete:
+ description: |
+ Remove the current user as a follower of a playlist.
+ operationId: unfollow-playlist
+ parameters:
+ - $ref: "#/components/parameters/PathPlaylistId"
+ responses:
+ "200":
+ description: Playlist unfollowed
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - playlist-modify-public
+ - playlist-modify-private
+ summary: |
+ Unfollow Playlist
+ tags:
+ - Users
+ - Playlists
+ x-spotify-docs-console-url: /console/delete-playlist-followers/?playlist_id=2v3iNvBX8Ay1Gt2uXtUKUT&user_id=jmperezperez
+ x-spotify-docs-endpoint-name: Unfollow Playlist
+ put:
+ description: |
+ Add the current user as a follower of a playlist.
+ operationId: follow-playlist
+ parameters:
+ - $ref: "#/components/parameters/PathPlaylistId"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ example:
+ public: false
+ properties:
+ public:
+ description: |
+ Defaults to `true`. If `true` the playlist will be included in user's public playlists, if `false` it will remain private.
+ type: boolean
+ type: object
+ responses:
+ "200":
+ description: Playlist followed
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - playlist-modify-public
+ - playlist-modify-private
+ summary: |
+ Follow Playlist
+ tags:
+ - Users
+ - Playlists
+ x-spotify-docs-console-url: /console/put-playlist-followers/?playlist_id=2v3iNvBX8Ay1Gt2uXtUKUT&body-json=%7B%0D%0A++%22public%22%3A+true%0D%0A%7D&user_id=jmperezperez
+ x-spotify-docs-endpoint-name: Follow a Playlist
+ x-spotify-docs-category: Follow
+ x-spotify-docs-display-name: playlist-followers
+ "/playlists/{playlist_id}/followers/contains":
+ get:
+ description: |
+ Check to see if one or more Spotify users are following a specified playlist.
+ operationId: check-if-user-follows-playlist
+ parameters:
+ - $ref: "#/components/parameters/PathPlaylistId"
+ - in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of [Spotify User IDs](/documentation/web-api/#spotify-uris-and-ids) ; the ids of the users that you want to check to see if they follow the playlist. Maximum: 5 ids.
+ example: jmperezperez,thelinmichael,wizzler
+ title: Spotify user IDs
+ type: string
+ responses:
+ "200":
+ $ref: "#/components/responses/ArrayOfBooleans"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Check if Users Follow Playlist
+ tags:
+ - Users
+ - Playlists
+ x-spotify-docs-console-url: /console/get-playlist-followers-contains/?ids=possan,elogain&user_id=jmperezperez&playlist_id=2v3iNvBX8Ay1Gt2uXtUKUT
+ x-spotify-docs-endpoint-name: Check if Users Follow a Playlist
+ x-spotify-docs-category: Follow
+ x-spotify-docs-display-name: playlist-followers-contains
+ "/playlists/{playlist_id}/images":
+ get:
+ description: |
+ Get the current image associated with a specific playlist.
+ operationId: get-playlist-cover
+ parameters:
+ - $ref: "#/components/parameters/PathPlaylistId"
+ responses:
+ "200":
+ $ref: "#/components/responses/ArrayOfImages"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Playlist Cover Image
+ tags:
+ - Playlists
+ x-spotify-docs-console-url: /console/get-playlist-images?playlist_id=3cEYpjA9oz9GiPac4AsH4n
+ x-spotify-docs-endpoint-name: Get a Playlist Cover Image
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ put:
+ description: |
+ Replace the image used to represent a specific playlist.
+ operationId: upload-custom-playlist-cover
+ parameters:
+ - $ref: "#/components/parameters/PathPlaylistId"
+ responses:
+ "200":
+ description: Image uploaded
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - ugc-image-upload
+ - playlist-modify-public
+ - playlist-modify-private
+ summary: |
+ Add Custom Playlist Cover Image
+ tags:
+ - Playlists
+ x-spotify-docs-console-url: /console/put-playlist-images?playlist_id=3cEYpjA9oz9GiPac4AsH4n
+ x-spotify-docs-endpoint-name: Upload a Custom Playlist Cover Image
+ x-spotify-docs-category: Playlists
+ x-spotify-docs-display-name: playlist-images
+ "/playlists/{playlist_id}/tracks":
+ delete:
+ description: |
+ Remove one or more items from a user's playlist.
+ operationId: remove-tracks-playlist
+ parameters:
+ - $ref: "#/components/parameters/PathPlaylistId"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ snapshot_id:
+ description: |
+ The playlist's snapshot ID against which you want to make the changes.
+ The API will validate that the specified items exist and in the specified positions and make the changes,
+ even if more recent changes have been made to the playlist.
+ type: string
+ tracks:
+ description: |
+ An array of objects containing [Spotify URIs](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) of the tracks or episodes to remove.
+ For example: `{ "tracks": [{ "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },{ "uri": "spotify:track:1301WleyT98MSxVHPZCA6M" }] }`. A maximum of 100 objects can be sent at once.
+ items:
+ properties:
+ uri:
+ description: Spotify URI
+ type: string
+ type: object
+ type: array
+ required:
+ - tracks
+ type: object
+ responses:
+ "200":
+ $ref: "#/components/responses/PlaylistSnapshotId"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - playlist-modify-public
+ - playlist-modify-private
+ summary: |
+ Remove Playlist Items
+ tags:
+ - Playlists
+ - Tracks
+ x-spotify-docs-console-url: /console/delete-playlist-tracks/
+ x-spotify-docs-endpoint-name: Remove Items from a Playlist
+ get:
+ description: |
+ Get full details of the items of a playlist owned by a Spotify user.
+ operationId: get-playlists-tracks
+ parameters:
+ - $ref: "#/components/parameters/PathPlaylistId"
+ - $ref: "#/components/parameters/QueryMarket"
+ - in: query
+ name: fields
+ required: false
+ schema:
+ description: |
+ Filters for the query: a comma-separated list of the
+ fields to return. If omitted, all fields are returned. For example, to get
+ just the total number of items and the request limit:
`fields=total,limit`
A
+ dot separator can be used to specify non-reoccurring fields, while parentheses
+ can be used to specify reoccurring fields within objects. For example, to
+ get just the added date and user ID of the adder:
`fields=items(added_at,added_by.id)`
Use
+ multiple parentheses to drill down into nested objects, for example:
`fields=items(track(name,href,album(name,href)))`
Fields
+ can be excluded by prefixing them with an exclamation mark, for example:
`fields=items.track.album(!external_urls,images)`
+ example: items(added_by.id,track(name,href,album(name,href)))
+ title: Fields
+ type: string
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ - $ref: "#/components/parameters/QueryAdditionalTypes"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagingPlaylistTrackObject"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - playlist-read-private
+ summary: |
+ Get Playlist Items
+ tags:
+ - Playlists
+ - Tracks
+ x-spotify-docs-console-url: /console/get-playlist-tracks/?playlist_id=21THa8j9TaSGuXYNBU5tsC&user_id=spotify_espa%C3%B1a
+ x-spotify-docs-endpoint-name: Get a Playlist's Items
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ post:
+ description: |
+ Add one or more items to a user's playlist.
+ operationId: add-tracks-to-playlist
+ parameters:
+ - $ref: "#/components/parameters/PathPlaylistId"
+ - in: query
+ name: position
+ required: false
+ schema:
+ description: |
+ The position to insert the items, a zero-based index. For example, to insert the items in the first position: `position=0`; to insert the items in the third position: `position=2`. If omitted, the items will be appended to the playlist. Items are added in the order they are listed in the query string or request body.
+ example: 0
+ title: Position (append by default)
+ type: integer
+ - in: query
+ name: uris
+ required: false
+ schema:
+ description: |
+ A comma-separated list of [Spotify URIs](/documentation/web-api/#spotify-uris-and-ids) to add, can be track or episode URIs. For example:
`uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh, spotify:track:1301WleyT98MSxVHPZCA6M, spotify:episode:512ojhOuo1ktJprKbVcKyQ`
A maximum of 100 items can be added in one request.
+ _**Note**: it is likely that passing a large number of item URIs as a query parameter will exceed the maximum length of the request URI. When adding a large number of items, it is recommended to pass them in the request body, see below._
+ example: spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M
+ title: Spotify Track URIs
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ properties:
+ position:
+ description: |
+ The position to insert the items, a zero-based index. For example, to insert the items in the first position: `position=0` ; to insert the items in the third position: `position=2`. If omitted, the items will be appended to the playlist. Items are added in the order they appear in the uris array. For example: `{"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZCA6M"], "position": 3}`
+ type: integer
+ uris:
+ description: |
+ A JSON array of the [Spotify URIs](/documentation/web-api/#spotify-uris-and-ids) to add. For example: `{"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZCA6M", "spotify:episode:512ojhOuo1ktJprKbVcKyQ"]}`
A maximum of 100 items can be added in one request. _**Note**: if the `uris` parameter is present in the query string, any URIs listed here in the body will be ignored._
+ items:
+ type: string
+ type: array
+ type: object
+ responses:
+ "201":
+ $ref: "#/components/responses/PlaylistSnapshotId"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - playlist-modify-public
+ - playlist-modify-private
+ summary: |
+ Add Items to Playlist
+ tags:
+ - Playlists
+ - Tracks
+ x-spotify-docs-console-url: /console/post-playlist-tracks/
+ x-spotify-docs-endpoint-name: Add Items to a Playlist
+ put:
+ description: |
+ Either reorder or replace items in a playlist depending on the request's parameters.
+ To reorder items, include `range_start`, `insert_before`, `range_length` and `snapshot_id` in the request's body.
+ To replace items, include `uris` as either a query parameter or in the request's body.
+ Replacing items in a playlist will overwrite its existing items. This operation can be used for replacing or clearing items in a playlist.
+
+ **Note**: Replace and reorder are mutually exclusive operations which share the same endpoint, but have different parameters.
+ These operations can't be applied together in a single request.
+ operationId: reorder-or-replace-playlists-tracks
+ parameters:
+ - $ref: "#/components/parameters/PathPlaylistId"
+ - in: query
+ name: uris
+ required: false
+ schema:
+ description: |
+ A comma-separated list of [Spotify URIs](/documentation/web-api/#spotify-uris-and-ids) to set, can be track or episode URIs. For example: `uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M,spotify:episode:512ojhOuo1ktJprKbVcKyQ`
A maximum of 100 items can be set in one request.
+ title: Spotify Track URIs
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ example:
+ insert_before: 3
+ range_length: 2
+ range_start: 1
+ properties:
+ insert_before:
+ description: |
+ The position where the items should be inserted.
To reorder the items to the end of the playlist, simply set _insert_before_ to the position after the last item.
Examples:
To reorder the first item to the last position in a playlist with 10 items, set _range_start_ to 0, and _insert_before_ to 10.
To reorder the last item in a playlist with 10 items to the start of the playlist, set _range_start_ to 9, and _insert_before_ to 0.
+ type: integer
+ range_length:
+ description: |
+ The amount of items to be reordered. Defaults to 1 if not set.
The range of items to be reordered begins from the _range_start_ position, and includes the _range_length_ subsequent items.
Example:
To move the items at index 9-10 to the start of the playlist, _range_start_ is set to 9, and _range_length_ is set to 2.
+ type: integer
+ range_start:
+ description: |
+ The position of the first item to be reordered.
+ type: integer
+ snapshot_id:
+ description: |
+ The playlist's snapshot ID against which you want to make the changes.
+ type: string
+ uris:
+ items:
+ type: string
+ type: array
+ type: object
+ responses:
+ "200":
+ $ref: "#/components/responses/PlaylistSnapshotId"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - playlist-modify-public
+ - playlist-modify-private
+ summary: |
+ Update Playlist Items
+ tags:
+ - Playlists
+ - Tracks
+ x-spotify-docs-console-url: /console/put-playlist-tracks/
+ x-spotify-docs-endpoint-name: Reorder or Replace a Playlist's Items
+ x-spotify-docs-category: Playlists
+ x-spotify-docs-display-name: playlist-tracks
+ /recommendations:
+ get:
+ description: |
+ Recommendations are generated based on the available information for a given seed entity and matched against similar artists and tracks. If there is sufficient information about the provided seeds, a list of tracks will be returned together with pool size details.
+
+ For artists and tracks that are very new or obscure there might not be enough data to generate a list of tracks.
+ operationId: get-recommendations
+ parameters:
+ - in: query
+ name: limit
+ required: false
+ schema:
+ default: 20
+ description: |
+ The target size of the list of recommended tracks. For seeds with unusually small pools or when highly restrictive filtering is applied, it may be impossible to generate the requested number of recommended tracks. Debugging information for such cases is available in the response. Default: 20\. Minimum: 1\. Maximum: 100.
+ example: 10
+ maximum: 100
+ minimum: 1
+ title: Limit
+ type: integer
+ - $ref: "#/components/parameters/QueryMarket"
+ - in: query
+ name: seed_artists
+ required: true
+ schema:
+ description: |
+ A comma separated list of [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids) for seed artists. Up to 5 seed values may be provided in any combination of `seed_artists`, `seed_tracks` and `seed_genres`.
+ example: 4NHQUGzhtTLFvgF5SZesLK
+ title: Spotify Artist ID Seeds
+ type: string
+ - in: query
+ name: seed_genres
+ required: true
+ schema:
+ description: |
+ A comma separated list of any genres in the set of [available genre seeds](#available-genre-seeds). Up to 5 seed values may be provided in any combination of `seed_artists`, `seed_tracks` and `seed_genres`.
+ example: classical,country
+ title: Genres Seeds
+ type: string
+ - in: query
+ name: seed_tracks
+ required: true
+ schema:
+ description: |
+ A comma separated list of [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids) for a seed track. Up to 5 seed values may be provided in any combination of `seed_artists`, `seed_tracks` and `seed_genres`.
+ example: 0c6xIDDpzE81m2q797ordA
+ title: Spotify Track ID Seeds
+ type: string
+ - in: query
+ name: min_acousticness
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ maximum: 1
+ minimum: 0
+ title: Min. Acousticness
+ type: number
+ - in: query
+ name: max_acousticness
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ maximum: 1
+ minimum: 0
+ title: Max. Acousticness
+ type: number
+ - in: query
+ name: target_acousticness
+ required: false
+ schema:
+ description: |
+ For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed equally in ranking results.
+ maximum: 1
+ minimum: 0
+ title: Target Acousticness
+ type: number
+ - in: query
+ name: min_danceability
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ maximum: 1
+ minimum: 0
+ title: Min. Danceability
+ type: number
+ - in: query
+ name: max_danceability
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ maximum: 1
+ minimum: 0
+ title: Max. Danceability
+ type: number
+ - in: query
+ name: target_danceability
+ required: false
+ schema:
+ description: |
+ For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed equally in ranking results.
+ maximum: 1
+ minimum: 0
+ title: Target Danceability
+ type: number
+ - in: query
+ name: min_duration_ms
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ title: Min. Duration (ms)
+ type: integer
+ - in: query
+ name: max_duration_ms
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ title: Max. Duration (ms)
+ type: integer
+ - in: query
+ name: target_duration_ms
+ required: false
+ schema:
+ description: Target duration of the track (ms)
+ title: Target Duration (ms)
+ type: integer
+ - in: query
+ name: min_energy
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ maximum: 1
+ minimum: 0
+ title: Min. Energy
+ type: number
+ - in: query
+ name: max_energy
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ maximum: 1
+ minimum: 0
+ title: Max. Energy
+ type: number
+ - in: query
+ name: target_energy
+ required: false
+ schema:
+ description: |
+ For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed equally in ranking results.
+ maximum: 1
+ minimum: 0
+ title: Target Energy
+ type: number
+ - in: query
+ name: min_instrumentalness
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ maximum: 1
+ minimum: 0
+ title: Min. Instrumentalness
+ type: number
+ - in: query
+ name: max_instrumentalness
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ maximum: 1
+ minimum: 0
+ title: Max. Instrumentalness
+ type: number
+ - in: query
+ name: target_instrumentalness
+ required: false
+ schema:
+ description: |
+ For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed equally in ranking results.
+ maximum: 1
+ minimum: 0
+ title: Target Instrumentalness
+ type: number
+ - in: query
+ name: min_key
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ maximum: 11
+ minimum: 0
+ title: Min. Key
+ type: integer
+ - in: query
+ name: max_key
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ maximum: 11
+ minimum: 0
+ title: Max. Key
+ type: integer
+ - in: query
+ name: target_key
+ required: false
+ schema:
+ description: |
+ For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed equally in ranking results.
+ maximum: 11
+ minimum: 0
+ title: Target Key
+ type: integer
+ - in: query
+ name: min_liveness
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ maximum: 1
+ minimum: 0
+ title: Min. Liveness
+ type: number
+ - in: query
+ name: max_liveness
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ maximum: 1
+ minimum: 0
+ title: Max. Liveness
+ type: number
+ - in: query
+ name: target_liveness
+ required: false
+ schema:
+ description: |
+ For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed equally in ranking results.
+ maximum: 1
+ minimum: 0
+ title: Target Liveness
+ type: number
+ - in: query
+ name: min_loudness
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ title: Min. Loudness
+ type: number
+ - in: query
+ name: max_loudness
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ title: Max. Loudness
+ type: number
+ - in: query
+ name: target_loudness
+ required: false
+ schema:
+ description: |
+ For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed equally in ranking results.
+ title: Target Loudness
+ type: number
+ - in: query
+ name: min_mode
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ maximum: 1
+ minimum: 0
+ title: Min. Mode
+ type: integer
+ - in: query
+ name: max_mode
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ maximum: 1
+ minimum: 0
+ title: Max. Mode
+ type: integer
+ - in: query
+ name: target_mode
+ required: false
+ schema:
+ description: |
+ For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed equally in ranking results.
+ maximum: 1
+ minimum: 0
+ title: Target Mode
+ type: integer
+ - in: query
+ name: min_popularity
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ maximum: 100
+ minimum: 0
+ title: Min. Popularity
+ type: integer
+ - in: query
+ name: max_popularity
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ maximum: 100
+ minimum: 0
+ title: Max. Popularity
+ type: integer
+ - in: query
+ name: target_popularity
+ required: false
+ schema:
+ description: |
+ For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed equally in ranking results.
+ maximum: 100
+ minimum: 0
+ title: Target Popularity
+ type: integer
+ - in: query
+ name: min_speechiness
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ maximum: 1
+ minimum: 0
+ title: Min. Speechiness
+ type: number
+ - in: query
+ name: max_speechiness
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ maximum: 1
+ minimum: 0
+ title: Max. Speechiness
+ type: number
+ - in: query
+ name: target_speechiness
+ required: false
+ schema:
+ description: |
+ For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed equally in ranking results.
+ maximum: 1
+ minimum: 0
+ title: Target Speechiness
+ type: number
+ - in: query
+ name: min_tempo
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ title: Min. Tempo
+ type: number
+ - in: query
+ name: max_tempo
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ title: Max. Tempo
+ type: number
+ - in: query
+ name: target_tempo
+ required: false
+ schema:
+ description: Target tempo (BPM)
+ title: Target Tempo
+ type: number
+ - in: query
+ name: min_time_signature
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ maximum: 11
+ title: Min. Time Signature
+ type: integer
+ - in: query
+ name: max_time_signature
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ title: Max. Time Signature
+ type: integer
+ - in: query
+ name: target_time_signature
+ required: false
+ schema:
+ description: |
+ For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed equally in ranking results.
+ title: Target Time Signature
+ type: integer
+ - in: query
+ name: min_valence
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
+ maximum: 1
+ minimum: 0
+ title: Min. Valence
+ type: number
+ - in: query
+ name: max_valence
+ required: false
+ schema:
+ description: |
+ For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental.
+ maximum: 1
+ minimum: 0
+ title: Max. Valence
+ type: number
+ - in: query
+ name: target_valence
+ required: false
+ schema:
+ description: |
+ For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed equally in ranking results.
+ maximum: 1
+ minimum: 0
+ title: Target Valence
+ type: number
+ responses:
+ "200":
+ $ref: "#/components/responses/OneRecommendations"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Recommendations
+ tags:
+ - Tracks
+ x-spotify-docs-console-url: /console/get-recommendations/?seed_artists=4NHQUGzhtTLFvgF5SZesLK&seed_tracks=0c6xIDDpzE81m2q797ordA&min_energy=0.4&min_popularity=50&market=US
+ x-spotify-docs-endpoint-name: Get Recommendations
+ x-spotify-docs-category: Browse
+ x-spotify-docs-display-name: recommendations
+ /recommendations/available-genre-seeds:
+ get:
+ description: |
+ Retrieve a list of available genres seed parameter values for [recommendations](/documentation/web-api/reference/#/operations/get-recommendations).
+ operationId: get-recommendation-genres
+ responses:
+ "200":
+ $ref: "#/components/responses/ManyGenres"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Available Genre Seeds
+ tags:
+ - Genres
+ x-spotify-docs-console-url: /console/get-available-genre-seeds/
+ x-spotify-docs-endpoint-name: Get Recommendation Genres
+ x-spotify-docs-category: Browse
+ x-spotify-docs-display-name: available-genre-seeds
+ /search:
+ get:
+ description: |
+ Get Spotify catalog information about albums, artists, playlists, tracks, shows, episodes or audiobooks
+ that match a keyword string.
+ **Note: Audiobooks are only available for the US, UK, Ireland, New Zealand and Australia markets.**
+ operationId: search
+ parameters:
+ - in: query
+ name: q
+ required: true
+ schema:
+ description: |
+ Your search query.
+
+ You can narrow down your search using field filters. The available filters are `album`, `artist`, `track`, `year`, `upc`, `tag:hipster`, `tag:new`, `isrc`, and `genre`. Each field filter only applies to certain result types.
+
+ The `artist` and `year` filters can be used while searching albums, artists and tracks. You can filter on a single `year` or a range (e.g. 1955-1960).
+ The `album` filter can be used while searching albums and tracks.
+ The `genre` filter can be used while searching artists and tracks.
+ The `isrc` and `track` filters can be used while searching tracks.
+ The `upc`, `tag:new` and `tag:hipster` filters can only be used while searching albums. The `tag:new` filter will return albums released in the past two weeks and `tag:hipster` can be used to return only albums with the lowest 10% popularity.
+ example: remaster%20track:Doxy%20artist:Miles%20Davis
+ title: Query
+ type: string
+ - explode: false
+ in: query
+ name: type
+ required: true
+ schema:
+ description: |
+ A comma-separated list of item types to search across. Search results include hits
+ from all the specified item types. For example: `q=abacab&type=album,track` returns
+ both albums and tracks matching "abacab".
+ items:
+ enum:
+ - album
+ - artist
+ - playlist
+ - track
+ - show
+ - episode
+ - audiobook
+ type: string
+ title: Item type
+ type: array
+ - $ref: "#/components/parameters/QueryMarket"
+ - in: query
+ name: limit
+ required: false
+ schema:
+ default: 20
+ description: |
+ The maximum number of results to return in each item type.
+ example: 10
+ maximum: 50
+ minimum: 0
+ title: Limit
+ type: integer
+ - in: query
+ name: offset
+ required: false
+ schema:
+ default: 0
+ description: |
+ The index of the first result to return. Use
+ with limit to get the next page of search results.
+ example: 5
+ maximum: 1000
+ minimum: 0
+ title: Offset
+ type: integer
+ - in: query
+ name: include_external
+ required: false
+ schema:
+ description: |
+ If `include_external=audio` is specified it signals that the client can play externally hosted audio content, and marks
+ the content as playable in the response. By default externally hosted audio content is marked as unplayable in the response.
+ enum:
+ - audio
+ title: Include External
+ type: string
+ responses:
+ "200":
+ $ref: "#/components/responses/SearchItems"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Search for Item
+ tags:
+ - Search
+ x-spotify-docs-console-url: /console/get-search-item/?q=tania+bowra&type=artist
+ x-spotify-docs-endpoint-name: Search for an Item
+ x-spotify-docs-category: Search
+ x-spotify-docs-display-name: search-item
+ /shows:
+ get:
+ description: |
+ Get Spotify catalog information for several shows based on their Spotify IDs.
+ operationId: get-multiple-shows
+ parameters:
+ - $ref: "#/components/parameters/QueryMarket"
+ - $ref: "#/components/parameters/QueryShowIds"
+ responses:
+ "200":
+ $ref: "#/components/responses/ManySimplifiedShows"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Several Shows
+ tags:
+ - Shows
+ x-spotify-docs-console-url: /console/get-several-shows/?ids=5CfCWKI5pZ28U0uOzXkDHe,5as3aKmN2k11yfDDDSrvaZ
+ x-spotify-docs-endpoint-name: Get Multiple Shows
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Shows
+ x-spotify-docs-display-name: several-shows
+ "/shows/{id}":
+ get:
+ description: |
+ Get Spotify catalog information for a single show identified by its
+ unique Spotify ID.
+ operationId: get-a-show
+ parameters:
+ - $ref: "#/components/parameters/QueryMarket"
+ - $ref: "#/components/parameters/PathShowId"
+ responses:
+ "200":
+ $ref: "#/components/responses/OneShow"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-read-playback-position
+ summary: |
+ Get Show
+ tags:
+ - Shows
+ x-spotify-docs-console-url: /console/get-show/?id=38bS44xjbVVZ3No3ByF1dJ
+ x-spotify-docs-endpoint-name: Get a Show
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Shows
+ x-spotify-docs-display-name: show
+ "/shows/{id}/episodes":
+ get:
+ description: |
+ Get Spotify catalog information about an show’s episodes. Optional parameters can be used to limit the number of episodes returned.
+ operationId: get-a-shows-episodes
+ parameters:
+ - $ref: "#/components/parameters/PathShowId"
+ - $ref: "#/components/parameters/QueryMarket"
+ - $ref: "#/components/parameters/QueryLimit"
+ - $ref: "#/components/parameters/QueryOffset"
+ responses:
+ "200":
+ $ref: "#/components/responses/PagingSimplifiedEpisodeObject"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - user-read-playback-position
+ summary: |
+ Get Show Episodes
+ tags:
+ - Shows
+ - Episodes
+ x-spotify-docs-console-url: /console/get-show-episodes/
+ x-spotify-docs-endpoint-name: Get a Show's Episodes
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Shows
+ x-spotify-docs-display-name: show-episodes
+ /tracks:
+ get:
+ description: |
+ Get Spotify catalog information for multiple tracks based on their Spotify IDs.
+ operationId: get-several-tracks
+ parameters:
+ - $ref: "#/components/parameters/QueryMarket"
+ - $ref: "#/components/parameters/QueryTrackIds"
+ responses:
+ "200":
+ $ref: "#/components/responses/ManyTracks"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Several Tracks
+ tags:
+ - Tracks
+ x-spotify-docs-console-url: /console/get-several-tracks/?ids=3n3Ppam7vgaVa1iaRUc9Lp,3twNvmDtFQtAd5gMKedhLD
+ x-spotify-docs-endpoint-name: Get Several Tracks
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Tracks
+ x-spotify-docs-display-name: several-tracks
+ "/tracks/{id}":
+ get:
+ description: |
+ Get Spotify catalog information for a single track identified by its
+ unique Spotify ID.
+ operationId: get-track
+ parameters:
+ - in: path
+ name: id
+ required: true
+ schema:
+ description: |
+ The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids)
+ for the track.
+ example: 11dFghVXANMlKmJXsNCbNl
+ title: Spotify Track ID
+ type: string
+ - $ref: "#/components/parameters/QueryMarket"
+ responses:
+ "200":
+ $ref: "#/components/responses/OneTrack"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get Track
+ tags:
+ - Tracks
+ x-spotify-docs-console-url: /console/get-track/?id=3n3Ppam7vgaVa1iaRUc9Lp
+ x-spotify-docs-endpoint-name: Get a Track
+ x-spotify-policy-list:
+ $ref: "#/components/x-spotify-policy/metadataPolicyList"
+ x-spotify-docs-category: Tracks
+ x-spotify-docs-display-name: track
+ "/users/{user_id}":
+ get:
+ description: |
+ Get public profile information about a Spotify user.
+ operationId: get-users-profile
+ parameters:
+ - $ref: "#/components/parameters/PathUserId"
+ responses:
+ "200":
+ $ref: "#/components/responses/OnePublicUser"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0: []
+ summary: |
+ Get User's Profile
+ tags:
+ - Users
+ x-spotify-docs-console-url: /console/get-users-profile/?user_id=wizzler
+ x-spotify-docs-endpoint-name: Get a User's Profile
+ x-spotify-docs-category: Users Profile
+ x-spotify-docs-display-name: users-profile
+ "/users/{user_id}/playlists":
+ get:
+ description: |
+ Get a list of the playlists owned or followed by a Spotify user.
+ operationId: get-list-users-playlists
+ parameters:
+ - $ref: "#/components/parameters/PathUserId"
+ - $ref: "#/components/parameters/QueryLimit"
+ - in: query
+ name: offset
+ required: false
+ schema:
+ default: 0
+ description: |
+ The index of the first playlist to return. Default:
+ 0 (the first object). Maximum offset: 100.000\. Use with `limit` to get the
+ next set of playlists.
+ example: 5
+ title: Offset
+ type: integer
+ responses:
+ "200":
+ $ref: "#/components/responses/PagedPlaylists"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - playlist-read-private
+ - playlist-read-collaborative
+ summary: |
+ Get User's Playlists
+ tags:
+ - Playlists
+ - Users
+ x-spotify-docs-console-url: /console/get-playlists/?user_id=wizzler
+ x-spotify-docs-endpoint-name: Get a List of a User's Playlists
+ post:
+ description: |
+ Create a playlist for a Spotify user. (The playlist will be empty until
+ you [add tracks](/documentation/web-api/reference/#/operations/add-tracks-to-playlist).)
+ operationId: create-playlist
+ parameters:
+ - $ref: "#/components/parameters/PathUserId"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ example:
+ description: New playlist description
+ name: New Playlist
+ public: false
+ properties:
+ collaborative:
+ description: |
+ Defaults to `false`. If `true` the playlist will be collaborative. _**Note**: to create a collaborative playlist you must also set `public` to `false`. To create collaborative playlists you must have granted `playlist-modify-private` and `playlist-modify-public` [scopes](/documentation/general/guides/authorization-guide/#list-of-scopes)._
+ type: boolean
+ description:
+ description: |
+ value for playlist description as displayed in Spotify Clients and in the Web API.
+ type: string
+ name:
+ description: |
+ The name for the new playlist, for example `"Your Coolest Playlist"`. This name does not need to be unique; a user may have several playlists with the same name.
+ type: string
+ public:
+ description: |
+ Defaults to `true`. If `true` the playlist will be public, if `false` it will be private. To be able to create private playlists, the user must have granted the `playlist-modify-private` [scope](/documentation/general/guides/authorization-guide/#list-of-scopes)
+ type: boolean
+ required:
+ - name
+ type: object
+ responses:
+ "201":
+ $ref: "#/components/responses/OnePlaylist"
+ "401":
+ $ref: "#/components/responses/Unauthorized"
+ "403":
+ $ref: "#/components/responses/Forbidden"
+ "429":
+ $ref: "#/components/responses/TooManyRequests"
+ security:
+ - oauth_2_0:
+ - playlist-modify-public
+ - playlist-modify-private
+ summary: |
+ Create Playlist
+ tags:
+ - Playlists
+ - Library
+ x-spotify-docs-console-url: /console/post-playlists/
+ x-spotify-docs-endpoint-name: Create a Playlist
+ x-spotify-docs-category: Playlists
+ x-spotify-docs-display-name: playlists
+components:
+ parameters:
+ PathAlbumId:
+ in: path
+ name: id
+ required: true
+ schema:
+ description: |
+ The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) of the album.
+ example: 4aawyAB9vmqN3uQ7FjRGTy
+ title: Spotify Album ID
+ type: string
+ PathArtistId:
+ in: path
+ name: id
+ required: true
+ schema:
+ description: |
+ The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) of the artist.
+ example: 0TnOYISbd1XYRBk9myaseg
+ title: Spotify Artist ID
+ type: string
+ PathAudiobookId:
+ in: path
+ name: id
+ required: true
+ schema:
+ description: |
+ The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids)
+ for the audiobook.
+ example: 7iHfbu1YPACw6oZPAFJtqe
+ title: Spotify Audiobook ID
+ type: string
+ PathChapterId:
+ in: path
+ name: id
+ required: true
+ schema:
+ description: |
+ The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids)
+ for the chapter.
+ example: 0D5wENdkdwbqlrHoaJ9g29
+ title: Spotify Chapter ID
+ type: string
+ PathPlaylistId:
+ in: path
+ name: playlist_id
+ required: true
+ schema:
+ description: |
+ The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) of the playlist.
+ example: 3cEYpjA9oz9GiPac4AsH4n
+ title: Playlist ID
+ type: string
+ PathShowId:
+ in: path
+ name: id
+ required: true
+ schema:
+ description: |
+ The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids)
+ for the show.
+ example: 38bS44xjbVVZ3No3ByF1dJ
+ title: Spotify Show ID
+ type: string
+ PathUserId:
+ in: path
+ name: user_id
+ required: true
+ schema:
+ description: |
+ The user's [Spotify user ID](/documentation/web-api/#spotify-uris-and-ids).
+ example: smedjan
+ title: User ID
+ type: string
+ QueryAdditionalTypes:
+ in: query
+ name: additional_types
+ required: false
+ schema:
+ description: |
+ A comma-separated list of item types that your client supports besides the default `track` type. Valid types are: `track` and `episode`.
+ _**Note**: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future._
+ In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against the `type` field of each object.
+ title: Additional Types
+ type: string
+ QueryAlbumIds:
+ in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids) for the albums. Maximum: 20 IDs.
+ example: 382ObEPsp2rxGrnsizN5TX,1A2GTWGtFfWp7KSQTwWOyo,2noRn2Aes5aoNVsU6iWThc
+ title: Spotify Album IDs
+ type: string
+ QueryAudiobookIds:
+ in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids). For example: `ids=18yVqkdbdRvS24c0Ilj2ci,1HGw3J3NxZO1TP1BTtVhpZ`. Maximum: 50 IDs.
+ example: 18yVqkdbdRvS24c0Ilj2ci,1HGw3J3NxZO1TP1BTtVhpZ,7iHfbu1YPACw6oZPAFJtqe
+ title: Spotify Audiobook IDs
+ type: string
+ QueryChapterIds:
+ in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids). For example: `ids=0IsXVP0JmcB2adSE338GkK,3ZXb8FKZGU0EHALYX6uCzU`. Maximum: 50 IDs.
+ example: 0IsXVP0JmcB2adSE338GkK,3ZXb8FKZGU0EHALYX6uCzU,0D5wENdkdwbqlrHoaJ9g29
+ title: Spotify Chapter IDs
+ type: string
+ QueryIncludeGroups:
+ in: query
+ name: include_groups
+ required: false
+ schema:
+ description: |
+ A comma-separated list of keywords that will be used to filter the response. If not supplied, all album types will be returned.
+ Valid values are:
- `album`
- `single`
- `appears_on`
- `compilation`
For example: `include_groups=album,single`.
+ example: single,appears_on
+ title: Groups to include (single, album, appears_on, compilation)
+ type: string
+ QueryLimit:
+ in: query
+ name: limit
+ required: false
+ schema:
+ default: 20
+ description: |
+ The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
+ example: 10
+ maximum: 50
+ minimum: 0
+ title: Limit
+ type: integer
+ QueryMarket:
+ in: query
+ name: market
+ required: false
+ schema:
+ description: |
+ An [ISO 3166-1 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
+ If a country code is specified, only content that is available in that market will be returned.
+ If a valid user access token is specified in the request header, the country associated with
+ the user account will take priority over this parameter.
+ _**Note**: If neither market or user country are provided, the content is considered unavailable for the client._
+ Users can view the country that is associated with their account in the [account settings](https://www.spotify.com/se/account/overview/).
+ example: ES
+ title: Market
+ type: string
+ QueryOffset:
+ in: query
+ name: offset
+ required: false
+ schema:
+ default: 0
+ description: |
+ The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
+ example: 5
+ title: Offset
+ type: integer
+ QueryShowIds:
+ in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids) for the shows. Maximum: 50 IDs.
+ example: 5CfCWKI5pZ28U0uOzXkDHe,5as3aKmN2k11yfDDDSrvaZ
+ title: Ids
+ type: string
+ QueryTrackIds:
+ in: query
+ name: ids
+ required: true
+ schema:
+ description: |
+ A comma-separated list of the [Spotify IDs](/documentation/web-api/#spotify-uris-and-ids). For example: `ids=4iV5W9uYEdYUVa79Axb7Rh,1301WleyT98MSxVHPZCA6M`. Maximum: 50 IDs.
+ example: 7ouMYWpwJ422jRcDASZB7P,4VqPOruhp5EdPBeR92t6lQ,2takcwOaAZWiXQijPHIx7B
+ title: Spotify Track IDs
+ type: string
+ responses:
+ ArrayOfBooleans:
+ content:
+ application/json:
+ schema:
+ example:
+ - false
+ - true
+ items:
+ type: boolean
+ type: array
+ description: Array of booleans
+ ArrayOfImages:
+ content:
+ application/json:
+ schema:
+ items:
+ $ref: "#/components/schemas/ImageObject"
+ type: array
+ description: A set of images
+ CursorPagedArtists:
+ content:
+ application/json:
+ schema:
+ properties:
+ artists:
+ $ref: "#/components/schemas/CursorPagingSimplifiedArtistObject"
+ required:
+ - artists
+ type: object
+ description: A paged set of artists
+ CursorPagedPlayHistory:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/CursorPagingPlayHistoryObject"
+ description: A paged set of tracks
+ Forbidden:
+ content:
+ application/json:
+ schema:
+ properties:
+ error:
+ $ref: "#/components/schemas/ErrorObject"
+ required:
+ - error
+ type: object
+ description: |
+ Bad OAuth request (wrong consumer key, bad nonce, expired
+ timestamp...). Unfortunately, re-authenticating the user won't help here.
+ ManyAlbums:
+ content:
+ application/json:
+ schema:
+ properties:
+ albums:
+ items:
+ $ref: "#/components/schemas/AlbumObject"
+ type: array
+ required:
+ - albums
+ type: object
+ description: A set of albums
+ ManyArtists:
+ content:
+ application/json:
+ schema:
+ properties:
+ artists:
+ items:
+ $ref: "#/components/schemas/ArtistObject"
+ type: array
+ required:
+ - artists
+ type: object
+ description: A set of artists
+ ManyAudioFeatures:
+ content:
+ application/json:
+ schema:
+ properties:
+ audio_features:
+ items:
+ $ref: "#/components/schemas/AudioFeaturesObject"
+ type: array
+ required:
+ - audio_features
+ type: object
+ description: A set of audio features
+ ManyAudiobooks:
+ content:
+ application/json:
+ schema:
+ properties:
+ audiobooks:
+ items:
+ $ref: "#/components/schemas/AudiobookObject"
+ type: array
+ required:
+ - audiobooks
+ type: object
+ description: A set of audiobooks
+ ManyChapters:
+ content:
+ application/json:
+ schema:
+ properties:
+ chapters:
+ items:
+ $ref: "#/components/schemas/ChapterObject"
+ type: array
+ required:
+ - chapters
+ type: object
+ description: A set of chapters
+ ManyDevices:
+ content:
+ application/json:
+ schema:
+ properties:
+ devices:
+ items:
+ $ref: "#/components/schemas/DeviceObject"
+ type: array
+ required:
+ - devices
+ type: object
+ description: A set of devices
+ ManyEpisodes:
+ content:
+ application/json:
+ schema:
+ properties:
+ episodes:
+ items:
+ $ref: "#/components/schemas/EpisodeObject"
+ type: array
+ required:
+ - episodes
+ type: object
+ description: A set of episodes
+ ManyGenres:
+ content:
+ application/json:
+ schema:
+ properties:
+ genres:
+ example:
+ - alternative
+ - samba
+ items:
+ type: string
+ type: array
+ required:
+ - genres
+ type: object
+ description: A set of genres
+ ManySimplifiedShows:
+ content:
+ application/json:
+ schema:
+ properties:
+ shows:
+ items:
+ $ref: "#/components/schemas/SimplifiedShowObject"
+ type: array
+ required:
+ - shows
+ type: object
+ description: A set of shows
+ ManyTracks:
+ content:
+ application/json:
+ schema:
+ properties:
+ tracks:
+ items:
+ $ref: "#/components/schemas/TrackObject"
+ type: array
+ required:
+ - tracks
+ type: object
+ description: A set of tracks
+ OneAlbum:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/AlbumObject"
+ description: An album
+ OneArtist:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ArtistObject"
+ description: An artist
+ OneAudioAnalysis:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/AudioAnalysisObject"
+ description: Audio analysis for one track
+ OneAudioFeatures:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/AudioFeaturesObject"
+ description: Audio features for one track
+ OneAudiobook:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/AudiobookObject"
+ description: An Audiobook
+ OneCategory:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/CategoryObject"
+ description: A category
+ OneChapter:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ChapterObject"
+ description: A Chapter
+ OneCurrentlyPlaying:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/CurrentlyPlayingContextObject"
+ description: Information about playback
+ OneCurrentlyPlayingTrack:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/CurrentlyPlayingContextObject"
+ description: Information about the currently playing track
+ OneEpisode:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/EpisodeObject"
+ description: An episode
+ OnePlaylist:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PlaylistObject"
+ description: A playlist
+ OnePrivateUser:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PrivateUserObject"
+ description: A user
+ OnePublicUser:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PublicUserObject"
+ description: A user
+ OneRecommendations:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/RecommendationsObject"
+ description: A set of recommendations
+ OneShow:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ShowObject"
+ description: A show
+ OneTrack:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/TrackObject"
+ description: A track
+ PagedAlbums:
+ content:
+ application/json:
+ schema:
+ properties:
+ albums:
+ $ref: "#/components/schemas/PagingSimplifiedAlbumObject"
+ required:
+ - albums
+ type: object
+ description: A paged set of albums
+ PagedCategories:
+ content:
+ application/json:
+ schema:
+ properties:
+ categories:
+ $ref: "#/components/schemas/PagingObject"
+ required:
+ - categories
+ type: object
+ description: A paged set of categories
+ PagedFeaturedPlaylists:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingFeaturedPlaylistObject"
+ description: A paged set of playlists
+ PagedPlaylists:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingPlaylistObject"
+ description: A paged set of playlists
+ PagingArtistOrTrackObject:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: "#/components/schemas/PagingObject"
+ - properties:
+ items:
+ items:
+ discriminator:
+ propertyName: type
+ oneOf:
+ - $ref: "#/components/schemas/ArtistObject"
+ - $ref: "#/components/schemas/TrackObject"
+ type: object
+ type: array
+ type: object
+ type: object
+ description: Pages of artists or tracks
+ PagingPlaylistTrackObject:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingPlaylistTrackObject"
+ description: Pages of tracks
+ PagingSavedAlbumObject:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingSavedAlbumObject"
+ description: Pages of albums
+ PagingSavedEpisodeObject:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingSavedEpisodeObject"
+ description: Pages of episodes
+ PagingSavedShowObject:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingSavedShowObject"
+ description: Pages of shows
+ PagingSavedTrackObject:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingSavedTrackObject"
+ description: Pages of tracks
+ PagingSimplifiedAlbumObject:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingSimplifiedAlbumObject"
+ description: Pages of albums
+ PagingSimplifiedArtistObject:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingSimplifiedArtistObject"
+ description: Pages of artists
+ PagingSimplifiedAudiobookObject:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingSimplifiedAudiobookObject"
+ description: Pages of audiobooks
+ PagingSimplifiedChapterObject:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingSimplifiedChapterObject"
+ description: Pages of chapters
+ PagingSimplifiedEpisodeObject:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingSimplifiedEpisodeObject"
+ description: Pages of episodes
+ PagingSimplifiedShowObject:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingSimplifiedShowObject"
+ description: Pages of shows
+ PagingSimplifiedTrackObject:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PagingSimplifiedTrackObject"
+ description: Pages of tracks
+ PlaylistSnapshotId:
+ content:
+ application/json:
+ schema:
+ properties:
+ snapshot_id:
+ example: abc
+ type: string
+ type: object
+ description: A snapshot ID for the playlist
+ Queue:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/QueueObject"
+ description: Information about the queue
+ SearchItems:
+ content:
+ application/json:
+ schema:
+ properties:
+ albums:
+ $ref: "#/components/schemas/PagingSimplifiedAlbumObject"
+ artists:
+ $ref: "#/components/schemas/PagingArtistObject"
+ audiobooks:
+ $ref: "#/components/schemas/PagingSimplifiedAudiobookObject"
+ episodes:
+ $ref: "#/components/schemas/PagingSimplifiedEpisodeObject"
+ playlists:
+ $ref: "#/components/schemas/PagingPlaylistObject"
+ shows:
+ $ref: "#/components/schemas/PagingSimplifiedShowObject"
+ tracks:
+ $ref: "#/components/schemas/PagingTrackObject"
+ type: object
+ description: Search response
+ TooManyRequests:
+ content:
+ application/json:
+ schema:
+ properties:
+ error:
+ $ref: "#/components/schemas/ErrorObject"
+ required:
+ - error
+ type: object
+ description: |
+ The app has exceeded its rate limits.
+ Unauthorized:
+ content:
+ application/json:
+ schema:
+ properties:
+ error:
+ $ref: "#/components/schemas/ErrorObject"
+ required:
+ - error
+ type: object
+ description: |
+ Bad or expired token. This can happen if the user revoked a token or
+ the access token has expired. You should re-authenticate the user.
+ schemas:
+ AlbumBase:
+ properties:
+ album_type:
+ description: |
+ The type of the album.
+ enum:
+ - album
+ - single
+ - compilation
+ example: compilation
+ type: string
+ available_markets:
+ description: |
+ The markets in which the album is available: [ISO 3166-1 alpha-2 country codes](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). _**NOTE**: an album is considered available in a market when at least 1 of its tracks is available in that market._
+ example:
+ - CA
+ - BR
+ - IT
+ items:
+ type: string
+ type: array
+ copyrights:
+ description: |
+ The copyright statements of the album.
+ items:
+ $ref: "#/components/schemas/CopyrightObject"
+ type: array
+ external_ids:
+ allOf:
+ - $ref: "#/components/schemas/ExternalIdObject"
+ description: |
+ Known external IDs for the album.
+ external_urls:
+ allOf:
+ - $ref: "#/components/schemas/ExternalUrlObject"
+ description: |
+ Known external URLs for this album.
+ genres:
+ description: |
+ A list of the genres the album is associated with. If not yet classified, the array is empty.
+ example:
+ - Egg punk
+ - Noise rock
+ items:
+ type: string
+ type: array
+ href:
+ description: |
+ A link to the Web API endpoint providing full details of the album.
+ type: string
+ id:
+ description: |
+ The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the album.
+ example: 2up3OPMp9Tb4dAKM2erWXQ
+ type: string
+ images:
+ description: |
+ The cover art for the album in various sizes, widest first.
+ items:
+ $ref: "#/components/schemas/ImageObject"
+ type: array
+ label:
+ description: |
+ The label associated with the album.
+ type: string
+ name:
+ description: |
+ The name of the album. In case of an album takedown, the value may be an empty string.
+ type: string
+ popularity:
+ description: |
+ The popularity of the album. The value will be between 0 and 100, with 100 being the most popular.
+ type: integer
+ release_date:
+ description: |
+ The date the album was first released.
+ example: 1981-12
+ type: string
+ release_date_precision:
+ description: |
+ The precision with which `release_date` value is known.
+ enum:
+ - year
+ - month
+ - day
+ example: year
+ type: string
+ restrictions:
+ allOf:
+ - $ref: "#/components/schemas/AlbumRestrictionObject"
+ description: |
+ Included in the response when a content restriction is applied.
+ total_tracks:
+ description: The number of tracks in the album.
+ example: 9
+ type: integer
+ type:
+ description: |
+ The object type.
+ enum:
+ - album
+ type: string
+ uri:
+ description: |
+ The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the album.
+ example: spotify:album:2up3OPMp9Tb4dAKM2erWXQ
+ type: string
+ required:
+ - album_type
+ - total_tracks
+ - available_markets
+ - external_urls
+ - href
+ - id
+ - images
+ - name
+ - release_date
+ - release_date_precision
+ - type
+ - uri
+ type: object
+ AlbumObject:
+ allOf:
+ - $ref: "#/components/schemas/AlbumBase"
+ - properties:
+ artists:
+ description: |
+ The artists of the album. Each artist object includes a link in `href` to more detailed information about the artist.
+ items:
+ $ref: "#/components/schemas/ArtistObject"
+ type: array
+ tracks:
+ $ref: "#/components/schemas/PagingSimplifiedTrackObject"
+ description: |
+ The tracks of the album.
+ type: object
+ x-spotify-docs-type: AlbumObject
+ AlbumRestrictionObject:
+ properties:
+ reason:
+ description: |
+ The reason for the restriction. Albums may be restricted if the content is not available in a given market, to the user's subscription type, or when the user's account is set to not play explicit content.
+ Additional reasons may be added in the future.
+ enum:
+ - market
+ - product
+ - explicit
+ type: string
+ type: object
+ x-spotify-docs-type: AlbumRestrictionObject
+ ArtistObject:
+ properties:
+ external_urls:
+ allOf:
+ - $ref: "#/components/schemas/ExternalUrlObject"
+ description: |
+ Known external URLs for this artist.
+ followers:
+ allOf:
+ - $ref: "#/components/schemas/FollowersObject"
+ description: |
+ Information about the followers of the artist.
+ genres:
+ description: |
+ A list of the genres the artist is associated with. If not yet classified, the array is empty.
+ example:
+ - Prog rock
+ - Grunge
+ items:
+ type: string
+ type: array
+ href:
+ description: |
+ A link to the Web API endpoint providing full details of the artist.
+ type: string
+ id:
+ description: |
+ The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the artist.
+ type: string
+ images:
+ description: |
+ Images of the artist in various sizes, widest first.
+ items:
+ $ref: "#/components/schemas/ImageObject"
+ type: array
+ name:
+ description: |
+ The name of the artist.
+ type: string
+ popularity:
+ description: |
+ The popularity of the artist. The value will be between 0 and 100, with 100 being the most popular. The artist's popularity is calculated from the popularity of all the artist's tracks.
+ type: integer
+ type:
+ description: |
+ The object type.
+ enum:
+ - artist
+ type: string
+ uri:
+ description: |
+ The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the artist.
+ type: string
+ type: object
+ x-spotify-docs-type: ArtistObject
+ AudioAnalysisObject:
+ properties:
+ bars:
+ description: The time intervals of the bars throughout the track. A bar (or measure) is a segment of time defined as a given number of beats.
+ items:
+ $ref: "#/components/schemas/TimeIntervalObject"
+ type: array
+ beats:
+ description: The time intervals of beats throughout the track. A beat is the basic time unit of a piece of music; for example, each tick of a metronome. Beats are typically multiples of tatums.
+ items:
+ $ref: "#/components/schemas/TimeIntervalObject"
+ type: array
+ meta:
+ properties:
+ analysis_time:
+ description: The amount of time taken to analyze this track.
+ example: 6.93906
+ type: number
+ analyzer_version:
+ description: The version of the Analyzer used to analyze this track.
+ example: 4.0.0
+ type: string
+ detailed_status:
+ description: A detailed status code for this track. If analysis data is missing, this code may explain why.
+ example: OK
+ type: string
+ input_process:
+ description: The method used to read the track's audio data.
+ example: libvorbisfile L+R 44100->22050
+ type: string
+ platform:
+ description: The platform used to read the track's audio data.
+ example: Linux
+ type: string
+ status_code:
+ description: The return code of the analyzer process. 0 if successful, 1 if any errors occurred.
+ example: 0
+ type: integer
+ timestamp:
+ description: The Unix timestamp (in seconds) at which this track was analyzed.
+ example: 1495193577
+ type: integer
+ type: object
+ sections:
+ description: Sections are defined by large variations in rhythm or timbre, e.g. chorus, verse, bridge, guitar solo, etc. Each section contains its own descriptions of tempo, key, mode, time_signature, and loudness.
+ items:
+ $ref: "#/components/schemas/SectionObject"
+ type: array
+ segments:
+ description: Each segment contains a roughly conisistent sound throughout its duration.
+ items:
+ $ref: "#/components/schemas/SegmentObject"
+ type: array
+ tatums:
+ description: A tatum represents the lowest regular pulse train that a listener intuitively infers from the timing of perceived musical events (segments).
+ items:
+ $ref: "#/components/schemas/TimeIntervalObject"
+ type: array
+ track:
+ properties:
+ analysis_channels:
+ description: The number of channels used for analysis. If 1, all channels are summed together to mono before analysis.
+ example: 1
+ type: integer
+ analysis_sample_rate:
+ description: The sample rate used to decode and analyze this track. May differ from the actual sample rate of this track available on Spotify.
+ example: 22050
+ type: integer
+ code_version:
+ description: A version number for the Echo Nest Musical Fingerprint format used in the codestring field.
+ example: 3.15
+ type: number
+ codestring:
+ description: An [Echo Nest Musical Fingerprint (ENMFP)](https://academiccommons.columbia.edu/doi/10.7916/D8Q248M4) codestring for this track.
+ type: string
+ duration:
+ description: Length of the track in seconds.
+ example: 207.95985
+ type: number
+ echoprint_version:
+ description: A version number for the EchoPrint format used in the echoprintstring field.
+ example: 4.15
+ type: number
+ echoprintstring:
+ description: An [EchoPrint](https://github.com/spotify/echoprint-codegen) codestring for this track.
+ type: string
+ end_of_fade_in:
+ description: The time, in seconds, at which the track's fade-in period ends. If the track has no fade-in, this will be 0.0.
+ example: 0
+ type: number
+ key:
+ $ref: "#/components/schemas/Key"
+ key_confidence:
+ description: The confidence, from 0.0 to 1.0, of the reliability of the `key`.
+ example: 0.408
+ maximum: 1
+ minimum: 0
+ type: number
+ loudness:
+ $ref: "#/components/schemas/Loudness"
+ mode:
+ $ref: "#/components/schemas/Mode"
+ mode_confidence:
+ description: The confidence, from 0.0 to 1.0, of the reliability of the `mode`.
+ example: 0.485
+ maximum: 1
+ minimum: 0
+ type: number
+ num_samples:
+ description: The exact number of audio samples analyzed from this track. See also `analysis_sample_rate`.
+ example: 4585515
+ type: integer
+ offset_seconds:
+ description: An offset to the start of the region of the track that was analyzed. (As the entire track is analyzed, this should always be 0.)
+ example: 0
+ type: integer
+ rhythm_version:
+ description: A version number for the Rhythmstring used in the rhythmstring field.
+ example: 1
+ type: number
+ rhythmstring:
+ description: A Rhythmstring for this track. The format of this string is similar to the Synchstring.
+ type: string
+ sample_md5:
+ description: This field will always contain the empty string.
+ type: string
+ start_of_fade_out:
+ description: The time, in seconds, at which the track's fade-out period starts. If the track has no fade-out, this should match the track's length.
+ example: 201.13705
+ type: number
+ synch_version:
+ description: A version number for the Synchstring used in the synchstring field.
+ example: 1
+ type: number
+ synchstring:
+ description: A [Synchstring](https://github.com/echonest/synchdata) for this track.
+ type: string
+ tempo:
+ $ref: "#/components/schemas/Tempo"
+ tempo_confidence:
+ description: The confidence, from 0.0 to 1.0, of the reliability of the `tempo`.
+ example: 0.73
+ maximum: 1
+ minimum: 0
+ type: number
+ time_signature:
+ $ref: "#/components/schemas/TimeSignature"
+ time_signature_confidence:
+ description: The confidence, from 0.0 to 1.0, of the reliability of the `time_signature`.
+ example: 0.994
+ maximum: 1
+ minimum: 0
+ type: number
+ window_seconds:
+ description: The length of the region of the track was analyzed, if a subset of the track was analyzed. (As the entire track is analyzed, this should always be 0.)
+ example: 0
+ type: integer
+ type: object
+ type: object
+ x-spotify-docs-type: AudioAnalysisObject
+ AudioFeaturesObject:
+ properties:
+ acousticness:
+ description: |
+ A confidence measure from 0.0 to 1.0 of whether the track is acoustic. 1.0 represents high confidence the track is acoustic.
+ example: 0.00242
+ format: float
+ maximum: 1
+ minimum: 0
+ type: number
+ x-spotify-docs-type: Float
+ analysis_url:
+ description: |
+ A URL to access the full audio analysis of this track. An access token is required to access this data.
+ example: |
+ https://api.spotify.com/v1/audio-analysis/2takcwOaAZWiXQijPHIx7B
+ type: string
+ danceability:
+ description: |
+ Danceability describes how suitable a track is for dancing based on a combination of musical elements including tempo, rhythm stability, beat strength, and overall regularity. A value of 0.0 is least danceable and 1.0 is most danceable.
+ example: 0.585
+ format: float
+ type: number
+ x-spotify-docs-type: Float
+ duration_ms:
+ description: |
+ The duration of the track in milliseconds.
+ example: 237040
+ type: integer
+ energy:
+ description: |
+ Energy is a measure from 0.0 to 1.0 and represents a perceptual measure of intensity and activity. Typically, energetic tracks feel fast, loud, and noisy. For example, death metal has high energy, while a Bach prelude scores low on the scale. Perceptual features contributing to this attribute include dynamic range, perceived loudness, timbre, onset rate, and general entropy.
+ example: 0.842
+ format: float
+ type: number
+ x-spotify-docs-type: Float
+ id:
+ description: |
+ The Spotify ID for the track.
+ example: 2takcwOaAZWiXQijPHIx7B
+ type: string
+ instrumentalness:
+ description: |
+ Predicts whether a track contains no vocals. "Ooh" and "aah" sounds are treated as instrumental in this context. Rap or spoken word tracks are clearly "vocal". The closer the instrumentalness value is to 1.0, the greater likelihood the track contains no vocal content. Values above 0.5 are intended to represent instrumental tracks, but confidence is higher as the value approaches 1.0.
+ example: 0.00686
+ format: float
+ type: number
+ x-spotify-docs-type: Float
+ key:
+ $ref: "#/components/schemas/Key"
+ liveness:
+ description: |
+ Detects the presence of an audience in the recording. Higher liveness values represent an increased probability that the track was performed live. A value above 0.8 provides strong likelihood that the track is live.
+ example: 0.0866
+ format: float
+ type: number
+ x-spotify-docs-type: Float
+ loudness:
+ $ref: "#/components/schemas/Loudness"
+ mode:
+ $ref: "#/components/schemas/Mode"
+ speechiness:
+ description: |
+ Speechiness detects the presence of spoken words in a track. The more exclusively speech-like the recording (e.g. talk show, audio book, poetry), the closer to 1.0 the attribute value. Values above 0.66 describe tracks that are probably made entirely of spoken words. Values between 0.33 and 0.66 describe tracks that may contain both music and speech, either in sections or layered, including such cases as rap music. Values below 0.33 most likely represent music and other non-speech-like tracks.
+ example: 0.0556
+ format: float
+ type: number
+ x-spotify-docs-type: Float
+ tempo:
+ $ref: "#/components/schemas/Tempo"
+ time_signature:
+ $ref: "#/components/schemas/TimeSignature"
+ track_href:
+ description: |
+ A link to the Web API endpoint providing full details of the track.
+ example: |
+ https://api.spotify.com/v1/tracks/2takcwOaAZWiXQijPHIx7B
+ type: string
+ type:
+ description: |
+ The object type.
+ enum:
+ - audio_features
+ type: string
+ uri:
+ description: |
+ The Spotify URI for the track.
+ example: spotify:track:2takcwOaAZWiXQijPHIx7B
+ type: string
+ valence:
+ description: |
+ A measure from 0.0 to 1.0 describing the musical positiveness conveyed by a track. Tracks with high valence sound more positive (e.g. happy, cheerful, euphoric), while tracks with low valence sound more negative (e.g. sad, depressed, angry).
+ example: 0.428
+ format: float
+ maximum: 1
+ minimum: 0
+ type: number
+ x-spotify-docs-type: Float
+ type: object
+ x-spotify-docs-type: AudioFeaturesObject
+ AudiobookBase:
+ properties:
+ authors:
+ description: |
+ The author(s) for the audiobook.
+ items:
+ $ref: "#/components/schemas/AuthorObject"
+ type: array
+ available_markets:
+ description: |
+ A list of the countries in which the audiobook can be played, identified by their [ISO 3166-1 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
+ items:
+ type: string
+ type: array
+ copyrights:
+ description: |
+ The copyright statements of the audiobook.
+ items:
+ $ref: "#/components/schemas/CopyrightObject"
+ type: array
+ description:
+ description: |
+ A description of the audiobook. HTML tags are stripped away from this field, use `html_description` field in case HTML tags are needed.
+ type: string
+ edition:
+ description: |
+ The edition of the audiobook.
+ example: Unabridged
+ type: string
+ explicit:
+ description: |
+ Whether or not the audiobook has explicit content (true = yes it does; false = no it does not OR unknown).
+ type: boolean
+ external_urls:
+ allOf:
+ - $ref: "#/components/schemas/ExternalUrlObject"
+ description: |
+ External URLs for this audiobook.
+ href:
+ description: |
+ A link to the Web API endpoint providing full details of the audiobook.
+ type: string
+ html_description:
+ description: |
+ A description of the audiobook. This field may contain HTML tags.
+ type: string
+ id:
+ description: |
+ The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the audiobook.
+ type: string
+ images:
+ description: |
+ The cover art for the audiobook in various sizes, widest first.
+ items:
+ $ref: "#/components/schemas/ImageObject"
+ type: array
+ languages:
+ description: |
+ A list of the languages used in the audiobook, identified by their [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code.
+ items:
+ type: string
+ type: array
+ media_type:
+ description: |
+ The media type of the audiobook.
+ type: string
+ name:
+ description: |
+ The name of the audiobook.
+ type: string
+ narrators:
+ description: |
+ The narrator(s) for the audiobook.
+ items:
+ $ref: "#/components/schemas/NarratorObject"
+ type: array
+ publisher:
+ description: |
+ The publisher of the audiobook.
+ type: string
+ total_chapters:
+ description: |
+ The number of chapters in this audiobook.
+ type: integer
+ type:
+ description: |
+ The object type.
+ enum:
+ - audiobook
+ type: string
+ uri:
+ description: |
+ The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the audiobook.
+ type: string
+ required:
+ - authors
+ - available_markets
+ - copyrights
+ - description
+ - explicit
+ - external_urls
+ - href
+ - html_description
+ - id
+ - images
+ - languages
+ - media_type
+ - name
+ - narrators
+ - publisher
+ - total_chapters
+ - type
+ - uri
+ type: object
+ AudiobookObject:
+ allOf:
+ - $ref: "#/components/schemas/AudiobookBase"
+ - properties:
+ chapters:
+ allOf:
+ - $ref: "#/components/schemas/PagingSimplifiedChapterObject"
+ description: |
+ The chapters of the audiobook.
+ type: object
+ required:
+ - chapters
+ type: object
+ x-spotify-docs-type: AudiobookObject
+ AuthorObject:
+ properties:
+ name:
+ description: |
+ The name of the author.
+ type: string
+ type: object
+ x-spotify-docs-type: AuthorObject
+ CategoryObject:
+ properties:
+ href:
+ description: |
+ A link to the Web API endpoint returning full details of the category.
+ type: string
+ icons:
+ description: |
+ The category icon, in various sizes.
+ items:
+ $ref: "#/components/schemas/ImageObject"
+ type: array
+ id:
+ description: |
+ The [Spotify category ID](/documentation/web-api/#spotify-uris-and-ids) of the category.
+ example: equal
+ type: string
+ name:
+ description: |
+ The name of the category.
+ example: EQUAL
+ type: string
+ required:
+ - href
+ - icons
+ - id
+ - name
+ type: object
+ x-spotify-docs-type: CategoryObject
+ ChapterBase:
+ properties:
+ audio_preview_url:
+ description: |
+ A URL to a 30 second preview (MP3 format) of the episode. `null` if not available.
+ example: https://p.scdn.co/mp3-preview/2f37da1d4221f40b9d1a98cd191f4d6f1646ad17
+ type: string
+ x-spotify-policy-list:
+ - $ref: "#/components/x-spotify-policy/StandalonePreview"
+ available_markets:
+ description: |
+ A list of the countries in which the chapter can be played, identified by their [ISO 3166-1 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
+ items:
+ type: string
+ type: array
+ chapter_number:
+ description: |
+ The number of the chapter
+ example: 1
+ type: integer
+ description:
+ description: |
+ A description of the episode. HTML tags are stripped away from this field, use `html_description` field in case HTML tags are needed.
+ example: |
+ A Spotify podcast sharing fresh insights on important topics of the moment—in a way only Spotify can. You’ll hear from experts in the music, podcast and tech industries as we discover and uncover stories about our work and the world around us.
+ type: string
+ duration_ms:
+ description: |
+ The episode length in milliseconds.
+ example: 1686230
+ type: integer
+ explicit:
+ description: |
+ Whether or not the episode has explicit content (true = yes it does; false = no it does not OR unknown).
+ type: boolean
+ external_urls:
+ allOf:
+ - $ref: "#/components/schemas/ExternalUrlObject"
+ description: |
+ External URLs for this episode.
+ href:
+ description: |
+ A link to the Web API endpoint providing full details of the episode.
+ example: https://api.spotify.com/v1/episodes/5Xt5DXGzch68nYYamXrNxZ
+ type: string
+ html_description:
+ description: |
+ A description of the episode. This field may contain HTML tags.
+ example: |
+
A Spotify podcast sharing fresh insights on important topics of the moment—in a way only Spotify can. You’ll hear from experts in the music, podcast and tech industries as we discover and uncover stories about our work and the world around us.
+ type: string + id: + description: | + The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the episode. + example: 5Xt5DXGzch68nYYamXrNxZ + type: string + images: + description: | + The cover art for the episode in various sizes, widest first. + items: + $ref: "#/components/schemas/ImageObject" + type: array + is_playable: + description: | + True if the episode is playable in the given market. Otherwise false. + type: boolean + languages: + description: | + A list of the languages used in the episode, identified by their [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639) code. + example: + - fr + - en + items: + type: string + type: array + name: + description: | + The name of the episode. + example: | + Starting Your Own Podcast: Tips, Tricks, and Advice From Anchor Creators + type: string + release_date: + description: | + The date the episode was first released, for example `"1981-12-15"`. Depending on the precision, it might be shown as `"1981"` or `"1981-12"`. + example: 1981-12-15 + type: string + release_date_precision: + description: | + The precision with which `release_date` value is known. + enum: + - year + - month + - day + example: day + type: string + restrictions: + allOf: + - $ref: "#/components/schemas/ChapterRestrictionObject" + description: | + Included in the response when a content restriction is applied. + resume_point: + allOf: + - $ref: "#/components/schemas/ResumePointObject" + description: | + The user's most recent position in the episode. Set if the supplied access token is a user token and has the scope 'user-read-playback-position'. + type: + description: | + The object type. + enum: + - episode + type: string + uri: + description: | + The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the episode. + example: spotify:episode:0zLhl3WsOCQHbe1BPTiHgr + type: string + required: + - audio_preview_url + - chapter_number + - description + - html_description + - duration_ms + - explicit + - external_urls + - href + - id + - images + - is_playable + - languages + - name + - release_date + - release_date_precision + - resume_point + - type + - uri + type: object + ChapterObject: + allOf: + - $ref: "#/components/schemas/ChapterBase" + - properties: + audiobook: + $ref: "#/components/schemas/SimplifiedAudiobookObject" + description: | + The audiobook for which the chapter belongs. + required: + - audiobook + type: object + type: object + x-spotify-docs-type: ChapterObject + ChapterRestrictionObject: + properties: + reason: + description: | + The reason for the restriction. Supported values: + - `market` - The content item is not available in the given market. + - `product` - The content item is not available for the user's subscription type. + - `explicit` - The content item is explicit and the user's account is set to not play explicit content. + - `payment_required` - Payment is required to play the content item. + + Additional reasons may be added in the future. + **Note**: If you use this field, make sure that your application safely handles unknown values. + type: string + type: object + x-spotify-docs-type: ChapterRestrictionObject + ContextObject: + properties: + external_urls: + allOf: + - $ref: "#/components/schemas/ExternalUrlObject" + description: External URLs for this context. + href: + description: A link to the Web API endpoint providing full details of the track. + type: string + type: + description: | + The object type, e.g. "artist", "playlist", "album", "show". + type: string + uri: + description: | + The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the context. + type: string + type: object + x-spotify-docs-type: ContextObject + CopyrightObject: + properties: + text: + description: | + The copyright text for this content. + type: string + type: + description: | + The type of copyright: `C` = the copyright, `P` = the sound recording (performance) copyright. + type: string + type: object + x-spotify-docs-type: CopyrightObject + CurrentlyPlayingContextObject: + properties: + actions: + allOf: + - $ref: "#/components/schemas/DisallowsObject" + description: | + Allows to update the user interface based on which playback actions are available within the current context. + context: + allOf: + - $ref: "#/components/schemas/ContextObject" + description: A Context Object. Can be `null`. + currently_playing_type: + description: | + The object type of the currently playing item. Can be one of `track`, `episode`, `ad` or `unknown`. + type: string + device: + allOf: + - $ref: "#/components/schemas/DeviceObject" + description: | + The device that is currently active. + is_playing: + description: If something is currently playing, return `true`. + type: boolean + item: + description: The currently playing track or episode. Can be `null`. + discriminator: + propertyName: type + oneOf: + - $ref: "#/components/schemas/TrackObject" + - $ref: "#/components/schemas/EpisodeObject" + x-spotify-docs-type: TrackObject | EpisodeObject + progress_ms: + description: Progress into the currently playing track or episode. Can be `null`. + type: integer + repeat_state: + description: off, track, context + type: string + shuffle_state: + description: If shuffle is on or off. + type: boolean + timestamp: + description: Unix Millisecond Timestamp when data was fetched. + type: integer + type: object + x-spotify-docs-type: CurrentlyPlayingContextObject + CurrentlyPlayingObject: + properties: + context: + allOf: + - $ref: "#/components/schemas/ContextObject" + description: A Context Object. Can be `null`. + currently_playing_type: + description: | + The object type of the currently playing item. Can be one of `track`, `episode`, `ad` or `unknown`. + type: string + is_playing: + description: If something is currently playing, return `true`. + type: boolean + item: + description: The currently playing track or episode. Can be `null`. + discriminator: + propertyName: type + oneOf: + - $ref: "#/components/schemas/TrackObject" + - $ref: "#/components/schemas/EpisodeObject" + x-spotify-docs-type: TrackObject | EpisodeObject + progress_ms: + description: Progress into the currently playing track or episode. Can be `null`. + type: integer + timestamp: + description: Unix Millisecond Timestamp when data was fetched + type: integer + type: object + x-spotify-docs-type: CurrentlyPlayingObject + CursorObject: + properties: + after: + description: The cursor to use as key to find the next page of items. + type: string + before: + description: The cursor to use as key to find the previous page of items. + type: string + type: object + x-spotify-docs-type: CursorObject + CursorPagingObject: + properties: + cursors: + allOf: + - $ref: "#/components/schemas/CursorObject" + description: The cursors used to find the next set of items. + href: + description: A link to the Web API endpoint returning the full result of the request. + type: string + limit: + description: The maximum number of items in the response (as set in the query or by default). + type: integer + next: + description: URL to the next page of items. ( `null` if none) + type: string + total: + description: The total number of items available to return. + type: integer + type: object + x-spotify-docs-type: CursorPagingObject + CursorPagingPlayHistoryObject: + allOf: + - $ref: "#/components/schemas/CursorPagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/PlayHistoryObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingTrackObject + CursorPagingSimplifiedArtistObject: + allOf: + - $ref: "#/components/schemas/CursorPagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/ArtistObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingArtistObject + DeviceObject: + properties: + id: + description: The device ID. + nullable: true + type: string + is_active: + description: If this device is the currently active device. + type: boolean + is_private_session: + description: If this device is currently in a private session. + type: boolean + is_restricted: + description: Whether controlling this device is restricted. At present if this is "true" then no Web API commands will be accepted by this device. + type: boolean + name: + description: A human-readable name for the device. Some devices have a name that the user can configure (e.g. \"Loudest speaker\") and some devices have a generic name associated with the manufacturer or device model. + example: Kitchen speaker + type: string + type: + description: Device type, such as "computer", "smartphone" or "speaker". + example: computer + type: string + volume_percent: + description: The current volume in percent. + example: 59 + maximum: 100 + minimum: 0 + nullable: true + type: integer + type: object + x-spotify-docs-type: DeviceObject + DevicesObject: + properties: + devices: + description: A list of 0..n Device objects + items: + $ref: "#/components/schemas/DeviceObject" + type: array + type: object + x-spotify-docs-type: DevicesObject + DisallowsObject: + properties: + interrupting_playback: + description: Interrupting playback. Optional field. + type: boolean + pausing: + description: Pausing. Optional field. + type: boolean + resuming: + description: Resuming. Optional field. + type: boolean + seeking: + description: Seeking playback location. Optional field. + type: boolean + skipping_next: + description: Skipping to the next context. Optional field. + type: boolean + skipping_prev: + description: Skipping to the previous context. Optional field. + type: boolean + toggling_repeat_context: + description: Toggling repeat context flag. Optional field. + type: boolean + toggling_repeat_track: + description: Toggling repeat track flag. Optional field. + type: boolean + toggling_shuffle: + description: Toggling shuffle flag. Optional field. + type: boolean + transferring_playback: + description: Transfering playback between devices. Optional field. + type: boolean + type: object + x-spotify-docs-type: DisallowsObject + EpisodeBase: + properties: + audio_preview_url: + description: | + A URL to a 30 second preview (MP3 format) of the episode. `null` if not available. + example: https://p.scdn.co/mp3-preview/2f37da1d4221f40b9d1a98cd191f4d6f1646ad17 + type: string + x-spotify-policy-list: + - $ref: "#/components/x-spotify-policy/StandalonePreview" + description: + description: | + A description of the episode. HTML tags are stripped away from this field, use `html_description` field in case HTML tags are needed. + example: | + A Spotify podcast sharing fresh insights on important topics of the moment—in a way only Spotify can. You’ll hear from experts in the music, podcast and tech industries as we discover and uncover stories about our work and the world around us. + type: string + duration_ms: + description: | + The episode length in milliseconds. + example: 1686230 + type: integer + explicit: + description: | + Whether or not the episode has explicit content (true = yes it does; false = no it does not OR unknown). + type: boolean + external_urls: + allOf: + - $ref: "#/components/schemas/ExternalUrlObject" + description: | + External URLs for this episode. + href: + description: | + A link to the Web API endpoint providing full details of the episode. + example: https://api.spotify.com/v1/episodes/5Xt5DXGzch68nYYamXrNxZ + type: string + html_description: + description: | + A description of the episode. This field may contain HTML tags. + example: | +A Spotify podcast sharing fresh insights on important topics of the moment—in a way only Spotify can. You’ll hear from experts in the music, podcast and tech industries as we discover and uncover stories about our work and the world around us.
+ type: string + id: + description: | + The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the episode. + example: 5Xt5DXGzch68nYYamXrNxZ + type: string + images: + description: | + The cover art for the episode in various sizes, widest first. + items: + $ref: "#/components/schemas/ImageObject" + type: array + is_externally_hosted: + description: | + True if the episode is hosted outside of Spotify's CDN. + type: boolean + is_playable: + description: | + True if the episode is playable in the given market. Otherwise false. + type: boolean + language: + deprecated: true + description: | + The language used in the episode, identified by a [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code. This field is deprecated and might be removed in the future. Please use the `languages` field instead. + example: en + type: string + languages: + description: | + A list of the languages used in the episode, identified by their [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639) code. + example: + - fr + - en + items: + type: string + type: array + name: + description: | + The name of the episode. + example: | + Starting Your Own Podcast: Tips, Tricks, and Advice From Anchor Creators + type: string + release_date: + description: | + The date the episode was first released, for example `"1981-12-15"`. Depending on the precision, it might be shown as `"1981"` or `"1981-12"`. + example: 1981-12-15 + type: string + release_date_precision: + description: | + The precision with which `release_date` value is known. + enum: + - year + - month + - day + example: day + type: string + restrictions: + allOf: + - $ref: "#/components/schemas/EpisodeRestrictionObject" + description: | + Included in the response when a content restriction is applied. + resume_point: + allOf: + - $ref: "#/components/schemas/ResumePointObject" + description: | + The user's most recent position in the episode. Set if the supplied access token is a user token and has the scope 'user-read-playback-position'. + type: + description: | + The object type. + enum: + - episode + type: string + uri: + description: | + The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the episode. + example: spotify:episode:0zLhl3WsOCQHbe1BPTiHgr + type: string + required: + - audio_preview_url + - description + - html_description + - duration_ms + - explicit + - external_urls + - href + - id + - images + - is_externally_hosted + - is_playable + - languages + - name + - release_date + - release_date_precision + - resume_point + - type + - uri + type: object + EpisodeObject: + allOf: + - $ref: "#/components/schemas/EpisodeBase" + - properties: + show: + $ref: "#/components/schemas/SimplifiedShowObject" + description: | + The show on which the episode belongs. + required: + - show + type: object + type: object + x-spotify-docs-type: EpisodeObject + EpisodeRestrictionObject: + properties: + reason: + description: | + The reason for the restriction. Supported values: + - `market` - The content item is not available in the given market. + - `product` - The content item is not available for the user's subscription type. + - `explicit` - The content item is explicit and the user's account is set to not play explicit content. + + Additional reasons may be added in the future. + **Note**: If you use this field, make sure that your application safely handles unknown values. + type: string + type: object + x-spotify-docs-type: EpisodeRestrictionObject + ErrorObject: + properties: + message: + description: | + A short description of the cause of the error. + type: string + status: + description: | + The HTTP status code (also returned in the response header; see [Response Status Codes](/documentation/web-api/#response-status-codes) for more information). + maximum: 599 + minimum: 400 + type: integer + required: + - status + - message + type: object + x-spotify-docs-type: ErrorObject + ExplicitContentSettingsObject: + properties: + filter_enabled: + description: | + When `true`, indicates that explicit content should not be played. + type: boolean + filter_locked: + description: | + When `true`, indicates that the explicit content setting is locked and can't be changed by the user. + type: boolean + type: object + x-spotify-docs-type: ExplicitContentSettingsObject + ExternalIdObject: + properties: + ean: + description: | + [International Article Number](http://en.wikipedia.org/wiki/International_Article_Number_%28EAN%29) + type: string + isrc: + description: | + [International Standard Recording Code](http://en.wikipedia.org/wiki/International_Standard_Recording_Code) + type: string + upc: + description: | + [Universal Product Code](http://en.wikipedia.org/wiki/Universal_Product_Code) + type: string + type: object + x-spotify-docs-type: ExternalIdObject + ExternalUrlObject: + properties: + spotify: + description: | + The [Spotify URL](/documentation/web-api/#spotify-uris-and-ids) for the object. + type: string + type: object + x-spotify-docs-type: ExternalUrlObject + FollowersObject: + properties: + href: + description: | + This will always be set to null, as the Web API does not support it at the moment. + nullable: true + type: string + total: + description: | + The total number of followers. + type: integer + type: object + x-spotify-docs-type: FollowersObject + ImageObject: + properties: + height: + description: | + The image height in pixels. + example: 300 + nullable: true + type: integer + url: + description: | + The source URL of the image. + example: | + https://i.scdn.co/image/ab67616d00001e02ff9ca10b55ce82ae553c8228 + type: string + width: + description: | + The image width in pixels. + example: 300 + nullable: true + type: integer + required: + - url + - height + - width + type: object + x-spotify-docs-type: ImageObject + Key: + description: | + The key the track is in. Integers map to pitches using standard [Pitch Class notation](https://en.wikipedia.org/wiki/Pitch_class). E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on. If no key was detected, the value is -1. + example: 9 + maximum: 11 + minimum: -1 + type: integer + LinkedTrackObject: + properties: + external_urls: + allOf: + - $ref: "#/components/schemas/ExternalUrlObject" + description: | + Known external URLs for this track. + href: + description: | + A link to the Web API endpoint providing full details of the track. + type: string + id: + description: | + The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the track. + type: string + type: + description: | + The object type: "track". + type: string + uri: + description: | + The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the track. + type: string + type: object + x-spotify-docs-type: LinkedTrackObject + Loudness: + description: | + The overall loudness of a track in decibels (dB). Loudness values are averaged across the entire track and are useful for comparing relative loudness of tracks. Loudness is the quality of a sound that is the primary psychological correlate of physical strength (amplitude). Values typically range between -60 and 0 db. + example: -5.883 + format: float + type: number + x-spotify-docs-type: Float + Mode: + description: | + Mode indicates the modality (major or minor) of a track, the type of scale from which its melodic content is derived. Major is represented by 1 and minor is 0. + example: 0 + type: integer + NarratorObject: + properties: + name: + description: | + The name of the Narrator. + type: string + type: object + x-spotify-docs-type: NarratorObject + PagingArtistObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/ArtistObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingArtistObject + PagingFeaturedPlaylistObject: + properties: + message: + type: string + playlists: + $ref: "#/components/schemas/PagingPlaylistObject" + type: object + x-spotify-docs-type: PagingFeaturedPlaylistObject + PagingObject: + properties: + href: + description: | + A link to the Web API endpoint returning the full result of the request + example: | + https://api.spotify.com/v1/me/shows?offset=0&limit=20 + type: string + limit: + description: | + The maximum number of items in the response (as set in the query or by default). + example: 20 + type: integer + next: + description: | + URL to the next page of items. ( `null` if none) + example: https://api.spotify.com/v1/me/shows?offset=1&limit=1 + nullable: true + type: string + offset: + description: | + The offset of the items returned (as set in the query or by default) + example: 0 + type: integer + previous: + description: | + URL to the previous page of items. ( `null` if none) + example: https://api.spotify.com/v1/me/shows?offset=1&limit=1 + nullable: true + type: string + total: + description: | + The total number of items available to return. + example: 4 + type: integer + required: + - href + - items + - limit + - next + - offset + - previous + - total + type: object + x-spotify-docs-type: PagingObject + PagingPlaylistObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/SimplifiedPlaylistObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingPlaylistObject + PagingPlaylistTrackObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/PlaylistTrackObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingPlaylistTrackObject + PagingSavedAlbumObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/SavedAlbumObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingSavedAlbumObject + PagingSavedEpisodeObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/SavedEpisodeObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingEpisodeObject + PagingSavedShowObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/SavedShowObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingShowObject + PagingSavedTrackObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/SavedTrackObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingTrackObject + PagingSimplifiedAlbumObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/SimplifiedAlbumObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingAlbumObject + PagingSimplifiedArtistObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/SimplifiedArtistObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingArtistObject + PagingSimplifiedAudiobookObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/SimplifiedAudiobookObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingAudiobookObject + PagingSimplifiedChapterObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/SimplifiedChapterObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingSimplifiedChapterObject + PagingSimplifiedEpisodeObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/SimplifiedEpisodeObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingEpisodeObject + PagingSimplifiedShowObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/SimplifiedShowObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingShowObject + PagingSimplifiedTrackObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/SimplifiedTrackObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingTrackObject + PagingTrackObject: + allOf: + - $ref: "#/components/schemas/PagingObject" + - properties: + items: + items: + $ref: "#/components/schemas/TrackObject" + type: array + type: object + type: object + x-spotify-docs-type: PagingTrackObject + PlayHistoryObject: + properties: + context: + allOf: + - $ref: "#/components/schemas/ContextObject" + description: The context the track was played from. + played_at: + description: The date and time the track was played. + format: date-time + type: string + x-spotify-docs-type: Timestamp + track: + allOf: + - $ref: "#/components/schemas/TrackObject" + description: The track the user listened to. + type: object + x-spotify-docs-type: PlayHistoryObject + PlayerErrorObject: + properties: + message: + description: | + A short description of the cause of the error. + type: string + reason: + allOf: + - $ref: "#/components/schemas/PlayerErrorReasons" + status: + description: | + The HTTP status code. Either `404 NOT FOUND` or `403 FORBIDDEN`. Also returned in the response header. + type: integer + type: object + x-spotify-docs-type: PlayerErrorObject + PlayerErrorReasons: + description: | + * `NO_PREV_TRACK` - The command requires a previous track, but there is none in the context. + * `NO_NEXT_TRACK` - The command requires a next track, but there is none in the context. + * `NO_SPECIFIC_TRACK` - The requested track does not exist. + * `ALREADY_PAUSED` - The command requires playback to not be paused. + * `NOT_PAUSED` - The command requires playback to be paused. + * `NOT_PLAYING_LOCALLY` - The command requires playback on the local device. + * `NOT_PLAYING_TRACK` - The command requires that a track is currently playing. + * `NOT_PLAYING_CONTEXT` - The command requires that a context is currently playing. + * `ENDLESS_CONTEXT` - The shuffle command cannot be applied on an endless context. + * `CONTEXT_DISALLOW` - The command could not be performed on the context. + * `ALREADY_PLAYING` - The track should not be restarted if the same track and context is already playing, and there is a resume point. + * `RATE_LIMITED` - The user is rate limited due to too frequent track play, also known as cat-on-the-keyboard spamming. + * `REMOTE_CONTROL_DISALLOW` - The context cannot be remote-controlled. + * `DEVICE_NOT_CONTROLLABLE` - Not possible to remote control the device. + * `VOLUME_CONTROL_DISALLOW` - Not possible to remote control the device's volume. + * `NO_ACTIVE_DEVICE` - Requires an active device and the user has none. + * `PREMIUM_REQUIRED` - The request is prohibited for non-premium users. + * `UNKNOWN` - Certain actions are restricted because of unknown reasons. + enum: + - NO_PREV_TRACK + - NO_NEXT_TRACK + - NO_SPECIFIC_TRACK + - ALREADY_PAUSED + - NOT_PAUSED + - NOT_PLAYING_LOCALLY + - NOT_PLAYING_TRACK + - NOT_PLAYING_CONTEXT + - ENDLESS_CONTEXT + - CONTEXT_DISALLOW + - ALREADY_PLAYING + - RATE_LIMITED + - REMOTE_CONTROL_DISALLOW + - DEVICE_NOT_CONTROLLABLE + - VOLUME_CONTROL_DISALLOW + - NO_ACTIVE_DEVICE + - PREMIUM_REQUIRED + - UNKNOWN + type: string + PlaylistObject: + properties: + collaborative: + description: | + `true` if the owner allows other users to modify the playlist. + type: boolean + description: + description: | + The playlist description. _Only returned for modified, verified playlists, otherwise_ `null`. + nullable: true + type: string + external_urls: + allOf: + - $ref: "#/components/schemas/ExternalUrlObject" + description: | + Known external URLs for this playlist. + followers: + allOf: + - $ref: "#/components/schemas/FollowersObject" + description: Information about the followers of the playlist. + href: + description: | + A link to the Web API endpoint providing full details of the playlist. + type: string + id: + description: | + The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the playlist. + type: string + images: + description: | + Images for the playlist. The array may be empty or contain up to three images. The images are returned by size in descending order. See [Working with Playlists](/documentation/general/guides/working-with-playlists/). _**Note**: If returned, the source URL for the image (`url`) is temporary and will expire in less than a day._ + items: + $ref: "#/components/schemas/ImageObject" + type: array + name: + description: | + The name of the playlist. + type: string + owner: + allOf: + - $ref: "#/components/schemas/PlaylistOwnerObject" + description: | + The user who owns the playlist + public: + description: | + The playlist's public/private status: `true` the playlist is public, `false` the playlist is private, `null` the playlist status is not relevant. For more about public/private status, see [Working with Playlists](/documentation/general/guides/working-with-playlists/) + type: boolean + snapshot_id: + description: | + The version identifier for the current playlist. Can be supplied in other requests to target a specific playlist version + type: string + tracks: + allOf: + - $ref: "#/components/schemas/PagingPlaylistTrackObject" + description: | + The tracks of the playlist. + type: object + type: + description: | + The object type: "playlist" + type: string + uri: + description: | + The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the playlist. + type: string + type: object + x-spotify-docs-type: PlaylistObject + PlaylistOwnerObject: + allOf: + - $ref: "#/components/schemas/PlaylistUserObject" + - properties: + display_name: + description: | + The name displayed on the user's profile. `null` if not available. + nullable: true + type: string + type: object + PlaylistTrackObject: + properties: + added_at: + description: | + The date and time the track or episode was added. _**Note**: some very old playlists may return `null` in this field._ + format: date-time + type: string + x-spotify-docs-type: Timestamp + added_by: + allOf: + - $ref: "#/components/schemas/PlaylistUserObject" + description: | + The Spotify user who added the track or episode. _**Note**: some very old playlists may return `null` in this field._ + is_local: + description: | + Whether this track or episode is a [local file](https://developer.spotify.com/web-api/local-files-spotify-playlists/) or not. + type: boolean + track: + description: Information about the track or episode. + discriminator: + propertyName: type + oneOf: + - $ref: "#/components/schemas/TrackObject" + - $ref: "#/components/schemas/EpisodeObject" + x-spotify-docs-type: TrackObject | EpisodeObject + type: object + x-spotify-docs-type: PlaylistTrackObject + PlaylistTracksRefObject: + properties: + href: + description: | + A link to the Web API endpoint where full details of the playlist's tracks can be retrieved. + type: string + total: + description: | + Number of tracks in the playlist. + type: integer + type: object + x-spotify-docs-type: PlaylistTracksRefObject + PlaylistUserObject: + properties: + external_urls: + allOf: + - $ref: "#/components/schemas/ExternalUrlObject" + description: | + Known public external URLs for this user. + followers: + allOf: + - $ref: "#/components/schemas/FollowersObject" + description: | + Information about the followers of this user. + href: + description: | + A link to the Web API endpoint for this user. + type: string + id: + description: | + The [Spotify user ID](/documentation/web-api/#spotify-uris-and-ids) for this user. + type: string + type: + description: | + The object type. + enum: + - user + type: string + uri: + description: | + The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for this user. + type: string + type: object + x-spotify-docs-type: PlaylistUserObject + PrivateUserObject: + properties: + country: + description: | + The country of the user, as set in the user's account profile. An [ISO 3166-1 alpha-2 country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). _This field is only available when the current user has granted access to the [user-read-private](/documentation/general/guides/authorization-guide/#list-of-scopes) scope._ + type: string + display_name: + description: | + The name displayed on the user's profile. `null` if not available. + type: string + email: + description: | + The user's email address, as entered by the user when creating their account. _**Important!** This email address is unverified; there is no proof that it actually belongs to the user._ _This field is only available when the current user has granted access to the [user-read-email](/documentation/general/guides/authorization-guide/#list-of-scopes) scope._ + type: string + explicit_content: + allOf: + - $ref: "#/components/schemas/ExplicitContentSettingsObject" + description: | + The user's explicit content settings. _This field is only available when the current user has granted access to the [user-read-private](/documentation/general/guides/authorization-guide/#list-of-scopes) scope._ + external_urls: + allOf: + - $ref: "#/components/schemas/ExternalUrlObject" + description: Known external URLs for this user. + followers: + allOf: + - $ref: "#/components/schemas/FollowersObject" + description: Information about the followers of the user. + href: + description: | + A link to the Web API endpoint for this user. + type: string + id: + description: | + The [Spotify user ID](/documentation/web-api/#spotify-uris-and-ids) for the user. + type: string + images: + description: The user's profile image. + items: + $ref: "#/components/schemas/ImageObject" + type: array + product: + description: | + The user's Spotify subscription level: "premium", "free", etc. (The subscription level "open" can be considered the same as "free".) _This field is only available when the current user has granted access to the [user-read-private](/documentation/general/guides/authorization-guide/#list-of-scopes) scope._ + type: string + type: + description: | + The object type: "user" + type: string + uri: + description: | + The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the user. + type: string + type: object + x-spotify-docs-type: PrivateUserObject + PublicUserObject: + properties: + display_name: + description: | + The name displayed on the user's profile. `null` if not available. + nullable: true + type: string + external_urls: + allOf: + - $ref: "#/components/schemas/ExternalUrlObject" + description: | + Known public external URLs for this user. + followers: + allOf: + - $ref: "#/components/schemas/FollowersObject" + description: | + Information about the followers of this user. + href: + description: | + A link to the Web API endpoint for this user. + type: string + id: + description: | + The [Spotify user ID](/documentation/web-api/#spotify-uris-and-ids) for this user. + type: string + images: + description: | + The user's profile image. + items: + $ref: "#/components/schemas/ImageObject" + type: array + type: + description: | + The object type. + enum: + - user + type: string + uri: + description: | + The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for this user. + type: string + type: object + x-spotify-docs-type: PublicUserObject + QueueObject: + properties: + currently_playing: + description: The currently playing track or episode. Can be `null`. + discriminator: + propertyName: type + oneOf: + - $ref: "#/components/schemas/TrackObject" + - $ref: "#/components/schemas/EpisodeObject" + x-spotify-docs-type: TrackObject | EpisodeObject + queue: + description: The tracks or episodes in the queue. Can be empty. + items: + discriminator: + propertyName: type + oneOf: + - $ref: "#/components/schemas/TrackObject" + - $ref: "#/components/schemas/EpisodeObject" + x-spotify-docs-type: TrackObject | EpisodeObject + type: array + type: object + x-spotify-docs-type: QueueObject + RecommendationSeedObject: + properties: + afterFilteringSize: + description: | + The number of tracks available after min\_\* and max\_\* filters have been applied. + type: integer + afterRelinkingSize: + description: | + The number of tracks available after relinking for regional availability. + type: integer + href: + description: | + A link to the full track or artist data for this seed. For tracks this will be a link to a Track Object. For artists a link to an Artist Object. For genre seeds, this value will be `null`. + type: string + id: + description: | + The id used to select this seed. This will be the same as the string used in the `seed_artists`, `seed_tracks` or `seed_genres` parameter. + type: string + initialPoolSize: + description: | + The number of recommended tracks available for this seed. + type: integer + type: + description: | + The entity type of this seed. One of `artist`, `track` or `genre`. + type: string + type: object + x-spotify-docs-type: RecommendationSeedObject + RecommendationsObject: + properties: + seeds: + description: | + An array of recommendation seed objects. + items: + $ref: "#/components/schemas/RecommendationSeedObject" + type: array + tracks: + description: | + An array of track object (simplified) ordered according to the parameters supplied. + items: + $ref: "#/components/schemas/TrackObject" + type: array + required: + - seeds + - tracks + type: object + x-spotify-docs-type: RecommendationsObject + ResumePointObject: + properties: + fully_played: + description: | + Whether or not the episode has been fully played by the user. + type: boolean + resume_position_ms: + description: | + The user's most recent position in the episode in milliseconds. + type: integer + type: object + x-spotify-docs-type: ResumePointObject + SavedAlbumObject: + properties: + added_at: + description: | + The date and time the album was saved + Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. + If the time is imprecise (for example, the date/time of an album release), an additional field indicates the precision; see for example, release_date in an album object. + format: date-time + type: string + x-spotify-docs-type: Timestamp + album: + allOf: + - $ref: "#/components/schemas/AlbumObject" + description: Information about the album. + type: object + x-spotify-docs-type: SavedAlbumObject + SavedEpisodeObject: + properties: + added_at: + description: | + The date and time the episode was saved. + Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. + format: date-time + type: string + x-spotify-docs-type: Timestamp + episode: + allOf: + - $ref: "#/components/schemas/EpisodeObject" + description: Information about the episode. + type: object + x-spotify-docs-type: SavedEpisodeObject + SavedShowObject: + properties: + added_at: + description: | + The date and time the show was saved. + Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. + If the time is imprecise (for example, the date/time of an album release), an additional field indicates the precision; see for example, release_date in an album object. + format: date-time + type: string + x-spotify-docs-type: Timestamp + show: + allOf: + - $ref: "#/components/schemas/SimplifiedShowObject" + description: Information about the show. + type: object + x-spotify-docs-type: SavedShowObject + SavedTrackObject: + properties: + added_at: + description: | + The date and time the track was saved. + Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. + If the time is imprecise (for example, the date/time of an album release), an additional field indicates the precision; see for example, release_date in an album object. + format: date-time + type: string + x-spotify-docs-type: Timestamp + track: + allOf: + - $ref: "#/components/schemas/TrackObject" + description: Information about the track. + type: object + x-spotify-docs-type: SavedTrackObject + SectionObject: + properties: + confidence: + description: The confidence, from 0.0 to 1.0, of the reliability of the section's "designation". + example: 1 + maximum: 1 + minimum: 0 + type: number + duration: + description: The duration (in seconds) of the section. + example: 6.97092 + type: number + key: + description: The estimated overall key of the section. The values in this field ranging from 0 to 11 mapping to pitches using standard Pitch Class notation (E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on). If no key was detected, the value is -1. + example: 9 + type: integer + key_confidence: + description: The confidence, from 0.0 to 1.0, of the reliability of the key. Songs with many key changes may correspond to low values in this field. + example: 0.297 + maximum: 1 + minimum: 0 + type: number + loudness: + description: The overall loudness of the section in decibels (dB). Loudness values are useful for comparing relative loudness of sections within tracks. + example: -14.938 + type: number + mode: + description: Indicates the modality (major or minor) of a section, the type of scale from which its melodic content is derived. This field will contain a 0 for "minor", a 1 for "major", or a -1 for no result. Note that the major key (e.g. C major) could more likely be confused with the minor key at 3 semitones lower (e.g. A minor) as both keys carry the same pitches. + enum: + - -1 + - 0 + - 1 + type: number + mode_confidence: + description: The confidence, from 0.0 to 1.0, of the reliability of the `mode`. + example: 0.471 + maximum: 1 + minimum: 0 + type: number + start: + description: The starting point (in seconds) of the section. + example: 0 + type: number + tempo: + description: The overall estimated tempo of the section in beats per minute (BPM). In musical terminology, tempo is the speed or pace of a given piece and derives directly from the average beat duration. + example: 113.178 + type: number + tempo_confidence: + description: The confidence, from 0.0 to 1.0, of the reliability of the tempo. Some tracks contain tempo changes or sounds which don't contain tempo (like pure speech) which would correspond to a low value in this field. + example: 0.647 + maximum: 1 + minimum: 0 + type: number + time_signature: + $ref: "#/components/schemas/TimeSignature" + time_signature_confidence: + description: The confidence, from 0.0 to 1.0, of the reliability of the `time_signature`. Sections with time signature changes may correspond to low values in this field. + example: 1 + maximum: 1 + minimum: 0 + type: number + type: object + SegmentObject: + properties: + confidence: + description: | + The confidence, from 0.0 to 1.0, of the reliability of the segmentation. Segments of the song which are difficult to logically segment (e.g: noise) may correspond to low values in this field. + example: 0.435 + maximum: 1 + minimum: 0 + type: number + duration: + description: The duration (in seconds) of the segment. + example: 0.19891 + type: number + loudness_end: + description: The offset loudness of the segment in decibels (dB). This value should be equivalent to the loudness_start of the following segment. + example: 0 + type: number + loudness_max: + description: The peak loudness of the segment in decibels (dB). Combined with `loudness_start` and `loudness_max_time`, these components can be used to describe the "attack" of the segment. + example: -14.25 + type: number + loudness_max_time: + description: The segment-relative offset of the segment peak loudness in seconds. Combined with `loudness_start` and `loudness_max`, these components can be used to desctibe the "attack" of the segment. + example: 0.07305 + type: number + loudness_start: + description: The onset loudness of the segment in decibels (dB). Combined with `loudness_max` and `loudness_max_time`, these components can be used to describe the "attack" of the segment. + example: -23.053 + type: number + pitches: + description: | + Pitch content is given by a “chroma” vector, corresponding to the 12 pitch classes C, C#, D to B, with values ranging from 0 to 1 that describe the relative dominance of every pitch in the chromatic scale. For example a C Major chord would likely be represented by large values of C, E and G (i.e. classes 0, 4, and 7). + + Vectors are normalized to 1 by their strongest dimension, therefore noisy sounds are likely represented by values that are all close to 1, while pure tones are described by one value at 1 (the pitch) and others near 0. + As can be seen below, the 12 vector indices are a combination of low-power spectrum values at their respective pitch frequencies. +  + example: + - 0.212 + - 0.141 + - 0.294 + items: + maximum: 1 + minimum: 0 + type: number + type: array + start: + description: The starting point (in seconds) of the segment. + example: 0.70154 + type: number + timbre: + description: | + Timbre is the quality of a musical note or sound that distinguishes different types of musical instruments, or voices. It is a complex notion also referred to as sound color, texture, or tone quality, and is derived from the shape of a segment’s spectro-temporal surface, independently of pitch and loudness. The timbre feature is a vector that includes 12 unbounded values roughly centered around 0. Those values are high level abstractions of the spectral surface, ordered by degree of importance. + + For completeness however, the first dimension represents the average loudness of the segment; second emphasizes brightness; third is more closely correlated to the flatness of a sound; fourth to sounds with a stronger attack; etc. See an image below representing the 12 basis functions (i.e. template segments). +  + + The actual timbre of the segment is best described as a linear combination of these 12 basis functions weighted by the coefficient values: timbre = c1 x b1 + c2 x b2 + ... + c12 x b12, where c1 to c12 represent the 12 coefficients and b1 to b12 the 12 basis functions as displayed below. Timbre vectors are best used in comparison with each other. + example: + - 42.115 + - 64.373 + - -0.233 + items: + type: number + type: array + type: object + ShowBase: + properties: + available_markets: + description: | + A list of the countries in which the show can be played, identified by their [ISO 3166-1 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code. + items: + type: string + type: array + copyrights: + description: | + The copyright statements of the show. + items: + $ref: "#/components/schemas/CopyrightObject" + type: array + description: + description: | + A description of the show. HTML tags are stripped away from this field, use `html_description` field in case HTML tags are needed. + type: string + explicit: + description: | + Whether or not the show has explicit content (true = yes it does; false = no it does not OR unknown). + type: boolean + external_urls: + allOf: + - $ref: "#/components/schemas/ExternalUrlObject" + description: | + External URLs for this show. + href: + description: | + A link to the Web API endpoint providing full details of the show. + type: string + html_description: + description: | + A description of the show. This field may contain HTML tags. + type: string + id: + description: | + The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the show. + type: string + images: + description: | + The cover art for the show in various sizes, widest first. + items: + $ref: "#/components/schemas/ImageObject" + type: array + is_externally_hosted: + description: | + True if all of the shows episodes are hosted outside of Spotify's CDN. This field might be `null` in some cases. + type: boolean + languages: + description: | + A list of the languages used in the show, identified by their [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code. + items: + type: string + type: array + media_type: + description: | + The media type of the show. + type: string + name: + description: | + The name of the episode. + type: string + publisher: + description: | + The publisher of the show. + type: string + total_episodes: + description: | + The total number of episodes in the show. + type: integer + type: + description: | + The object type. + enum: + - show + type: string + uri: + description: | + The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the show. + type: string + required: + - available_markets + - copyrights + - description + - explicit + - external_urls + - href + - html_description + - id + - images + - is_externally_hosted + - languages + - media_type + - name + - publisher + - total_episodes + - type + - uri + type: object + ShowObject: + allOf: + - $ref: "#/components/schemas/ShowBase" + - properties: + episodes: + allOf: + - $ref: "#/components/schemas/PagingSimplifiedEpisodeObject" + description: | + The episodes of the show. + type: object + required: + - episodes + type: object + x-spotify-docs-type: ShowObject + SimplifiedAlbumObject: + allOf: + - $ref: "#/components/schemas/AlbumBase" + - properties: + album_group: + description: | + The field is present when getting an artist's albums. Compare to album_type this field represents relationship between the artist and the album. + enum: + - album + - single + - compilation + - appears_on + example: compilation + type: string + artists: + description: | + The artists of the album. Each artist object includes a link in `href` to more detailed information about the artist. + items: + $ref: "#/components/schemas/SimplifiedArtistObject" + type: array + required: + - artists + type: object + x-spotify-docs-type: SimplifiedAlbumObject + SimplifiedArtistObject: + properties: + external_urls: + allOf: + - $ref: "#/components/schemas/ExternalUrlObject" + description: | + Known external URLs for this artist. + href: + description: | + A link to the Web API endpoint providing full details of the artist. + type: string + id: + description: | + The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the artist. + type: string + name: + description: | + The name of the artist. + type: string + type: + description: | + The object type. + enum: + - artist + type: string + uri: + description: | + The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the artist. + type: string + type: object + x-spotify-docs-type: SimplifiedArtistObject + SimplifiedAudiobookObject: + allOf: + - $ref: "#/components/schemas/AudiobookBase" + - type: object + x-spotify-docs-type: SimplifiedAudiobookObject + SimplifiedChapterObject: + allOf: + - $ref: "#/components/schemas/ChapterBase" + - type: object + type: object + x-spotify-docs-type: SimplifiedChapterObject + SimplifiedEpisodeObject: + allOf: + - $ref: "#/components/schemas/EpisodeBase" + - type: object + type: object + x-spotify-docs-type: SimplifiedEpisodeObject + SimplifiedPlaylistObject: + properties: + collaborative: + description: | + `true` if the owner allows other users to modify the playlist. + type: boolean + description: + description: | + The playlist description. _Only returned for modified, verified playlists, otherwise_ `null`. + type: string + external_urls: + allOf: + - $ref: "#/components/schemas/ExternalUrlObject" + description: | + Known external URLs for this playlist. + href: + description: | + A link to the Web API endpoint providing full details of the playlist. + type: string + id: + description: | + The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the playlist. + type: string + images: + description: | + Images for the playlist. The array may be empty or contain up to three images. The images are returned by size in descending order. See [Working with Playlists](/documentation/general/guides/working-with-playlists/). _**Note**: If returned, the source URL for the image (`url`) is temporary and will expire in less than a day._ + items: + $ref: "#/components/schemas/ImageObject" + type: array + name: + description: | + The name of the playlist. + type: string + owner: + allOf: + - $ref: "#/components/schemas/PlaylistOwnerObject" + description: | + The user who owns the playlist + public: + description: | + The playlist's public/private status: `true` the playlist is public, `false` the playlist is private, `null` the playlist status is not relevant. For more about public/private status, see [Working with Playlists](/documentation/general/guides/working-with-playlists/) + type: boolean + snapshot_id: + description: | + The version identifier for the current playlist. Can be supplied in other requests to target a specific playlist version + type: string + tracks: + allOf: + - $ref: "#/components/schemas/PlaylistTracksRefObject" + description: | + A collection containing a link ( `href` ) to the Web API endpoint where full details of the playlist's tracks can be retrieved, along with the `total` number of tracks in the playlist. Note, a track object may be `null`. This can happen if a track is no longer available. + type: + description: | + The object type: "playlist" + type: string + uri: + description: | + The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the playlist. + type: string + type: object + x-spotify-docs-type: SimplifiedPlaylistObject + SimplifiedShowObject: + allOf: + - $ref: "#/components/schemas/ShowBase" + - type: object + x-spotify-docs-type: SimplifiedShowObject + SimplifiedTrackObject: + properties: + artists: + description: The artists who performed the track. Each artist object includes a link in `href` to more detailed information about the artist. + items: + $ref: "#/components/schemas/SimplifiedArtistObject" + type: array + available_markets: + description: | + A list of the countries in which the track can be played, identified by their [ISO 3166-1 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code. + items: + type: string + type: array + disc_number: + description: The disc number (usually `1` unless the album consists of more than one disc). + type: integer + duration_ms: + description: The track length in milliseconds. + type: integer + explicit: + description: Whether or not the track has explicit lyrics ( `true` = yes it does; `false` = no it does not OR unknown). + type: boolean + external_urls: + allOf: + - $ref: "#/components/schemas/ExternalUrlObject" + description: | + External URLs for this track. + href: + description: A link to the Web API endpoint providing full details of the track. + type: string + id: + description: | + The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the track. + type: string + is_local: + description: | + Whether or not the track is from a local file. + type: boolean + is_playable: + description: | + Part of the response when [Track Relinking](/documentation/general/guides/track-relinking-guide/) is applied. If `true`, the track is playable in the given market. Otherwise `false`. + type: boolean + linked_from: + allOf: + - $ref: "#/components/schemas/LinkedTrackObject" + description: Part of the response when [Track Relinking](/documentation/general/guides/track-relinking-guide/) is applied and is only part of the response if the track linking, in fact, exists. The requested track has been replaced with a different track. The track in the `linked_from` object contains information about the originally requested track. + name: + description: The name of the track. + type: string + preview_url: + description: | + A URL to a 30 second preview (MP3 format) of the track. + type: string + x-spotify-policy-list: + - $ref: "#/components/x-spotify-policy/StandalonePreview" + restrictions: + allOf: + - $ref: "#/components/schemas/TrackRestrictionObject" + description: | + Included in the response when a content restriction is applied. + track_number: + description: | + The number of the track. If an album has several discs, the track number is the number on the specified disc. + type: integer + type: + description: | + The object type: "track". + type: string + uri: + description: | + The [Spotify URI](/documentation/web-api/#spotify-uris-and-ids) for the track. + type: string + type: object + x-spotify-docs-type: SimplifiedTrackObject + Tempo: + description: | + The overall estimated tempo of a track in beats per minute (BPM). In musical terminology, tempo is the speed or pace of a given piece and derives directly from the average beat duration. + example: 118.211 + format: float + type: number + x-spotify-docs-type: Float + TimeIntervalObject: + properties: + confidence: + description: The confidence, from 0.0 to 1.0, of the reliability of the interval. + example: 0.925 + maximum: 1 + minimum: 0 + type: number + duration: + description: The duration (in seconds) of the time interval. + example: 2.18749 + type: number + start: + description: The starting point (in seconds) of the time interval. + example: 0.49567 + type: number + type: object + TimeSignature: + description: An estimated time signature. The time signature (meter) is a notational convention to specify how many beats are in each bar (or measure). The time signature ranges from 3 to 7 indicating time signatures of "3/4", to "7/4". + example: 4 + maximum: 7 + minimum: 3 + type: integer + TrackObject: + properties: + album: + allOf: + - $ref: "#/components/schemas/SimplifiedAlbumObject" + description: | + The album on which the track appears. The album object includes a link in `href` to full information about the album. + artists: + description: | + The artists who performed the track. Each artist object includes a link in `href` to more detailed information about the artist. + items: + $ref: "#/components/schemas/ArtistObject" + type: array + available_markets: + description: | + A list of the countries in which the track can be played, identified by their [ISO 3166-1 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code. + items: + type: string + type: array + disc_number: + description: | + The disc number (usually `1` unless the album consists of more than one disc). + type: integer + duration_ms: + description: | + The track length in milliseconds. + type: integer + explicit: + description: | + Whether or not the track has explicit lyrics ( `true` = yes it does; `false` = no it does not OR unknown). + type: boolean + external_ids: + allOf: + - $ref: "#/components/schemas/ExternalIdObject" + description: | + Known external IDs for the track. + external_urls: + allOf: + - $ref: "#/components/schemas/ExternalUrlObject" + description: | + Known external URLs for this track. + href: + description: | + A link to the Web API endpoint providing full details of the track. + type: string + id: + description: | + The [Spotify ID](/documentation/web-api/#spotify-uris-and-ids) for the track. + type: string + is_local: + description: | + Whether or not the track is from a local file. + type: boolean + is_playable: + description: | + Part of the response when [Track Relinking](/documentation/general/guides/track-relinking-guide/) is applied. If `true`, the track is playable in the given market. Otherwise `false`. + type: boolean + linked_from: + description: | + Part of the response when [Track Relinking](/documentation/general/guides/track-relinking-guide/) is applied, and the requested track has been replaced with different track. The track in the `linked_from` object contains information about the originally requested track. + type: object + name: + description: | + The name of the track. + type: string + popularity: + description: | + The popularity of the track. The value will be between 0 and 100, with 100 being the most popular.{formatted_prompt}:
--- """ - - -class MlflowLogger: - """Callback Handler that logs metrics and artifacts to mlflow server. - - Parameters: - name (str): Name of the run. - experiment (str): Name of the experiment. - tags (dict): Tags to be attached for the run. - tracking_uri (str): MLflow tracking server uri. - - This handler implements the helper functions to initialize, - log metrics and artifacts to the mlflow server. - """ - - def __init__(self, **kwargs: Any): - self.mlflow = import_mlflow() - tracking_uri = get_from_dict_or_env( - kwargs, "tracking_uri", "MLFLOW_TRACKING_URI", "" - ) - self.mlflow.set_tracking_uri(tracking_uri) - - # User can set other env variables described here - # > https://www.mlflow.org/docs/latest/tracking.html#logging-to-a-tracking-server - - experiment_name = get_from_dict_or_env( - kwargs, "experiment_name", "MLFLOW_EXPERIMENT_NAME" - ) - self.mlf_exp = self.mlflow.get_experiment_by_name(experiment_name) - if self.mlf_exp is not None: - self.mlf_expid = self.mlf_exp.experiment_id - else: - self.mlf_expid = self.mlflow.create_experiment(experiment_name) - - self.start_run(kwargs["run_name"], kwargs["run_tags"]) - - def start_run(self, name: str, tags: Dict[str, str]) -> None: - """To start a new run, auto generates the random suffix for name""" - if name.endswith("-%"): - rname = "".join(random.choices(string.ascii_uppercase + string.digits, k=7)) - name = name.replace("%", rname) - self.run = self.mlflow.MlflowClient().create_run( - self.mlf_expid, run_name=name, tags=tags - ) - - def finish_run(self) -> None: - """To finish the run.""" - with self.mlflow.start_run( - run_id=self.run.info.run_id, experiment_id=self.mlf_expid - ): - self.mlflow.end_run() - - def metric(self, key: str, value: float) -> None: - """To log metric to mlflow server.""" - with self.mlflow.start_run( - run_id=self.run.info.run_id, experiment_id=self.mlf_expid - ): - self.mlflow.log_metric(key, value) - - def metrics( - self, data: Union[Dict[str, float], Dict[str, int]], step: Optional[int] = 0 - ) -> None: - """To log all metrics in the input dict.""" - with self.mlflow.start_run( - run_id=self.run.info.run_id, experiment_id=self.mlf_expid - ): - self.mlflow.log_metrics(data) - - def jsonf(self, data: Dict[str, Any], filename: str) -> None: - """To log the input data as json file artifact.""" - with self.mlflow.start_run( - run_id=self.run.info.run_id, experiment_id=self.mlf_expid - ): - self.mlflow.log_dict(data, f"{filename}.json") - - def table(self, name: str, dataframe) -> None: # type: ignore - """To log the input pandas dataframe as a html table""" - self.html(dataframe.to_html(), f"table_{name}") - - def html(self, html: str, filename: str) -> None: - """To log the input html string as html file artifact.""" - with self.mlflow.start_run( - run_id=self.run.info.run_id, experiment_id=self.mlf_expid - ): - self.mlflow.log_text(html, f"{filename}.html") - - def text(self, text: str, filename: str) -> None: - """To log the input text as text file artifact.""" - with self.mlflow.start_run( - run_id=self.run.info.run_id, experiment_id=self.mlf_expid - ): - self.mlflow.log_text(text, f"{filename}.txt") - - def artifact(self, path: str) -> None: - """To upload the file from given path as artifact.""" - with self.mlflow.start_run( - run_id=self.run.info.run_id, experiment_id=self.mlf_expid - ): - self.mlflow.log_artifact(path) - - def langchain_artifact(self, chain: Any) -> None: - with self.mlflow.start_run( - run_id=self.run.info.run_id, experiment_id=self.mlf_expid - ): - self.mlflow.langchain.log_model(chain, "langchain-model") - - -class MlflowCallbackHandler(BaseMetadataCallbackHandler, BaseCallbackHandler): - """Callback Handler that logs metrics and artifacts to mlflow server. - - Parameters: - name (str): Name of the run. - experiment (str): Name of the experiment. - tags (dict): Tags to be attached for the run. - tracking_uri (str): MLflow tracking server uri. - - This handler will utilize the associated callback method called and formats - the input of each callback function with metadata regarding the state of LLM run, - and adds the response to the list of records for both the {method}_records and - action. It then logs the response to mlflow server. - """ - - def __init__( - self, - name: Optional[str] = "langchainrun-%", - experiment: Optional[str] = "langchain", - tags: Optional[Dict] = {}, - tracking_uri: Optional[str] = None, - ) -> None: - """Initialize callback handler.""" - import_pandas() - import_textstat() - import_mlflow() - spacy = import_spacy() - super().__init__() - - self.name = name - self.experiment = experiment - self.tags = tags - self.tracking_uri = tracking_uri - - self.temp_dir = tempfile.TemporaryDirectory() - - self.mlflg = MlflowLogger( - tracking_uri=self.tracking_uri, - experiment_name=self.experiment, - run_name=self.name, - run_tags=self.tags, - ) - - self.action_records: list = [] - self.nlp = spacy.load("en_core_web_sm") - - self.metrics = { - "step": 0, - "starts": 0, - "ends": 0, - "errors": 0, - "text_ctr": 0, - "chain_starts": 0, - "chain_ends": 0, - "llm_starts": 0, - "llm_ends": 0, - "llm_streams": 0, - "tool_starts": 0, - "tool_ends": 0, - "agent_ends": 0, - } - - self.records: Dict[str, Any] = { - "on_llm_start_records": [], - "on_llm_token_records": [], - "on_llm_end_records": [], - "on_chain_start_records": [], - "on_chain_end_records": [], - "on_tool_start_records": [], - "on_tool_end_records": [], - "on_text_records": [], - "on_agent_finish_records": [], - "on_agent_action_records": [], - "action_records": [], - } - - def _reset(self) -> None: - for k, v in self.metrics.items(): - self.metrics[k] = 0 - for k, v in self.records.items(): - self.records[k] = [] - - def on_llm_start( - self, serialized: Dict[str, Any], prompts: List[str], **kwargs: Any - ) -> None: - """Run when LLM starts.""" - self.metrics["step"] += 1 - self.metrics["llm_starts"] += 1 - self.metrics["starts"] += 1 - - llm_starts = self.metrics["llm_starts"] - - resp: Dict[str, Any] = {} - resp.update({"action": "on_llm_start"}) - resp.update(flatten_dict(serialized)) - resp.update(self.metrics) - - self.mlflg.metrics(self.metrics, step=self.metrics["step"]) - - for idx, prompt in enumerate(prompts): - prompt_resp = deepcopy(resp) - prompt_resp["prompt"] = prompt - self.records["on_llm_start_records"].append(prompt_resp) - self.records["action_records"].append(prompt_resp) - self.mlflg.jsonf(prompt_resp, f"llm_start_{llm_starts}_prompt_{idx}") - - def on_llm_new_token(self, token: str, **kwargs: Any) -> None: - """Run when LLM generates a new token.""" - self.metrics["step"] += 1 - self.metrics["llm_streams"] += 1 - - llm_streams = self.metrics["llm_streams"] - - resp: Dict[str, Any] = {} - resp.update({"action": "on_llm_new_token", "token": token}) - resp.update(self.metrics) - - self.mlflg.metrics(self.metrics, step=self.metrics["step"]) - - self.records["on_llm_token_records"].append(resp) - self.records["action_records"].append(resp) - self.mlflg.jsonf(resp, f"llm_new_tokens_{llm_streams}") - - def on_llm_end(self, response: LLMResult, **kwargs: Any) -> None: - """Run when LLM ends running.""" - self.metrics["step"] += 1 - self.metrics["llm_ends"] += 1 - self.metrics["ends"] += 1 - - llm_ends = self.metrics["llm_ends"] - - resp: Dict[str, Any] = {} - resp.update({"action": "on_llm_end"}) - resp.update(flatten_dict(response.llm_output or {})) - resp.update(self.metrics) - - self.mlflg.metrics(self.metrics, step=self.metrics["step"]) - - for generations in response.generations: - for idx, generation in enumerate(generations): - generation_resp = deepcopy(resp) - generation_resp.update(flatten_dict(generation.dict())) - generation_resp.update( - analyze_text( - generation.text, - nlp=self.nlp, - ) - ) - complexity_metrics: Dict[str, float] = generation_resp.pop("text_complexity_metrics") # type: ignore # noqa: E501 - self.mlflg.metrics( - complexity_metrics, - step=self.metrics["step"], - ) - self.records["on_llm_end_records"].append(generation_resp) - self.records["action_records"].append(generation_resp) - self.mlflg.jsonf(resp, f"llm_end_{llm_ends}_generation_{idx}") - dependency_tree = generation_resp["dependency_tree"] - entities = generation_resp["entities"] - self.mlflg.html(dependency_tree, "dep-" + hash_string(generation.text)) - self.mlflg.html(entities, "ent-" + hash_string(generation.text)) - - def on_llm_error( - self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any - ) -> None: - """Run when LLM errors.""" - self.metrics["step"] += 1 - self.metrics["errors"] += 1 - - def on_chain_start( - self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any - ) -> None: - """Run when chain starts running.""" - self.metrics["step"] += 1 - self.metrics["chain_starts"] += 1 - self.metrics["starts"] += 1 - - chain_starts = self.metrics["chain_starts"] - - resp: Dict[str, Any] = {} - resp.update({"action": "on_chain_start"}) - resp.update(flatten_dict(serialized)) - resp.update(self.metrics) - - self.mlflg.metrics(self.metrics, step=self.metrics["step"]) - - chain_input = ",".join([f"{k}={v}" for k, v in inputs.items()]) - input_resp = deepcopy(resp) - input_resp["inputs"] = chain_input - self.records["on_chain_start_records"].append(input_resp) - self.records["action_records"].append(input_resp) - self.mlflg.jsonf(input_resp, f"chain_start_{chain_starts}") - - def on_chain_end(self, outputs: Dict[str, Any], **kwargs: Any) -> None: - """Run when chain ends running.""" - self.metrics["step"] += 1 - self.metrics["chain_ends"] += 1 - self.metrics["ends"] += 1 - - chain_ends = self.metrics["chain_ends"] - - resp: Dict[str, Any] = {} - chain_output = ",".join([f"{k}={v}" for k, v in outputs.items()]) - resp.update({"action": "on_chain_end", "outputs": chain_output}) - resp.update(self.metrics) - - self.mlflg.metrics(self.metrics, step=self.metrics["step"]) - - self.records["on_chain_end_records"].append(resp) - self.records["action_records"].append(resp) - self.mlflg.jsonf(resp, f"chain_end_{chain_ends}") - - def on_chain_error( - self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any - ) -> None: - """Run when chain errors.""" - self.metrics["step"] += 1 - self.metrics["errors"] += 1 - - def on_tool_start( - self, serialized: Dict[str, Any], input_str: str, **kwargs: Any - ) -> None: - """Run when tool starts running.""" - self.metrics["step"] += 1 - self.metrics["tool_starts"] += 1 - self.metrics["starts"] += 1 - - tool_starts = self.metrics["tool_starts"] - - resp: Dict[str, Any] = {} - resp.update({"action": "on_tool_start", "input_str": input_str}) - resp.update(flatten_dict(serialized)) - resp.update(self.metrics) - - self.mlflg.metrics(self.metrics, step=self.metrics["step"]) - - self.records["on_tool_start_records"].append(resp) - self.records["action_records"].append(resp) - self.mlflg.jsonf(resp, f"tool_start_{tool_starts}") - - def on_tool_end(self, output: str, **kwargs: Any) -> None: - """Run when tool ends running.""" - self.metrics["step"] += 1 - self.metrics["tool_ends"] += 1 - self.metrics["ends"] += 1 - - tool_ends = self.metrics["tool_ends"] - - resp: Dict[str, Any] = {} - resp.update({"action": "on_tool_end", "output": output}) - resp.update(self.metrics) - - self.mlflg.metrics(self.metrics, step=self.metrics["step"]) - - self.records["on_tool_end_records"].append(resp) - self.records["action_records"].append(resp) - self.mlflg.jsonf(resp, f"tool_end_{tool_ends}") - - def on_tool_error( - self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any - ) -> None: - """Run when tool errors.""" - self.metrics["step"] += 1 - self.metrics["errors"] += 1 - - def on_text(self, text: str, **kwargs: Any) -> None: - """ - Run when agent is ending. - """ - self.metrics["step"] += 1 - self.metrics["text_ctr"] += 1 - - text_ctr = self.metrics["text_ctr"] - - resp: Dict[str, Any] = {} - resp.update({"action": "on_text", "text": text}) - resp.update(self.metrics) - - self.mlflg.metrics(self.metrics, step=self.metrics["step"]) - - self.records["on_text_records"].append(resp) - self.records["action_records"].append(resp) - self.mlflg.jsonf(resp, f"on_text_{text_ctr}") - - def on_agent_finish(self, finish: AgentFinish, **kwargs: Any) -> None: - """Run when agent ends running.""" - self.metrics["step"] += 1 - self.metrics["agent_ends"] += 1 - self.metrics["ends"] += 1 - - agent_ends = self.metrics["agent_ends"] - resp: Dict[str, Any] = {} - resp.update( - { - "action": "on_agent_finish", - "output": finish.return_values["output"], - "log": finish.log, - } - ) - resp.update(self.metrics) - - self.mlflg.metrics(self.metrics, step=self.metrics["step"]) - - self.records["on_agent_finish_records"].append(resp) - self.records["action_records"].append(resp) - self.mlflg.jsonf(resp, f"agent_finish_{agent_ends}") - - def on_agent_action(self, action: AgentAction, **kwargs: Any) -> Any: - """Run on agent action.""" - self.metrics["step"] += 1 - self.metrics["tool_starts"] += 1 - self.metrics["starts"] += 1 - - tool_starts = self.metrics["tool_starts"] - resp: Dict[str, Any] = {} - resp.update( - { - "action": "on_agent_action", - "tool": action.tool, - "tool_input": action.tool_input, - "log": action.log, - } - ) - resp.update(self.metrics) - self.mlflg.metrics(self.metrics, step=self.metrics["step"]) - self.records["on_agent_action_records"].append(resp) - self.records["action_records"].append(resp) - self.mlflg.jsonf(resp, f"agent_action_{tool_starts}") - - def _create_session_analysis_df(self) -> Any: - """Create a dataframe with all the information from the session.""" - pd = import_pandas() - on_llm_start_records_df = pd.DataFrame(self.records["on_llm_start_records"]) - on_llm_end_records_df = pd.DataFrame(self.records["on_llm_end_records"]) - - llm_input_columns = ["step", "prompt"] - if "name" in on_llm_start_records_df.columns: - llm_input_columns.append("name") - elif "id" in on_llm_start_records_df.columns: - # id is llm class's full import path. For example: - # ["langchain", "llms", "openai", "AzureOpenAI"] - on_llm_start_records_df["name"] = on_llm_start_records_df["id"].apply( - lambda id_: id_[-1] - ) - llm_input_columns.append("name") - llm_input_prompts_df = ( - on_llm_start_records_df[llm_input_columns] - .dropna(axis=1) - .rename({"step": "prompt_step"}, axis=1) - ) - complexity_metrics_columns = [] - visualizations_columns = [] - - complexity_metrics_columns = [ - "flesch_reading_ease", - "flesch_kincaid_grade", - "smog_index", - "coleman_liau_index", - "automated_readability_index", - "dale_chall_readability_score", - "difficult_words", - "linsear_write_formula", - "gunning_fog", - # "text_standard", - "fernandez_huerta", - "szigriszt_pazos", - "gutierrez_polini", - "crawford", - "gulpease_index", - "osman", - ] - - visualizations_columns = ["dependency_tree", "entities"] - - llm_outputs_df = ( - on_llm_end_records_df[ - [ - "step", - "text", - "token_usage_total_tokens", - "token_usage_prompt_tokens", - "token_usage_completion_tokens", - ] - + complexity_metrics_columns - + visualizations_columns - ] - .dropna(axis=1) - .rename({"step": "output_step", "text": "output"}, axis=1) - ) - session_analysis_df = pd.concat([llm_input_prompts_df, llm_outputs_df], axis=1) - session_analysis_df["chat_html"] = session_analysis_df[ - ["prompt", "output"] - ].apply( - lambda row: construct_html_from_prompt_and_generation( - row["prompt"], row["output"] - ), - axis=1, - ) - return session_analysis_df - - def flush_tracker(self, langchain_asset: Any = None, finish: bool = False) -> None: - pd = import_pandas() - self.mlflg.table("action_records", pd.DataFrame(self.records["action_records"])) - session_analysis_df = self._create_session_analysis_df() - chat_html = session_analysis_df.pop("chat_html") - chat_html = chat_html.replace("\n", "", regex=True) - self.mlflg.table("session_analysis", pd.DataFrame(session_analysis_df)) - self.mlflg.html("".join(chat_html.tolist()), "chat_html") - - if langchain_asset: - # To avoid circular import error - # mlflow only supports LLMChain asset - if "langchain.chains.llm.LLMChain" in str(type(langchain_asset)): - self.mlflg.langchain_artifact(langchain_asset) - else: - langchain_asset_path = str(Path(self.temp_dir.name, "model.json")) - try: - langchain_asset.save(langchain_asset_path) - self.mlflg.artifact(langchain_asset_path) - except ValueError: - try: - langchain_asset.save_agent(langchain_asset_path) - self.mlflg.artifact(langchain_asset_path) - except AttributeError: - print("Could not save model.") - traceback.print_exc() - pass - except NotImplementedError: - print("Could not save model.") - traceback.print_exc() - pass - except NotImplementedError: - print("Could not save model.") - traceback.print_exc() - pass - if finish: - self.mlflg.finish_run() - self._reset() +import random +import string +import tempfile +import traceback +from copy import deepcopy +from pathlib import Path +from typing import Any, Dict, List, Optional, Union + +from langchain.callbacks.base import BaseCallbackHandler +from langchain.callbacks.utils import ( + BaseMetadataCallbackHandler, + flatten_dict, + hash_string, + import_pandas, + import_spacy, + import_textstat, +) +from langchain.schema import AgentAction, AgentFinish, LLMResult +from langchain.utils import get_from_dict_or_env + + +def import_mlflow() -> Any: + """Import the mlflow python package and raise an error if it is not installed.""" + try: + import mlflow + except ImportError: + raise ImportError( + "To use the mlflow callback manager you need to have the `mlflow` python " + "package installed. Please install it with `pip install mlflow>=2.3.0`" + ) + return mlflow + + +def analyze_text( + text: str, + nlp: Any = None, +) -> dict: + """Analyze text using textstat and spacy. + + Parameters: + text (str): The text to analyze. + nlp (spacy.lang): The spacy language model to use for visualization. + + Returns: + (dict): A dictionary containing the complexity metrics and visualization + files serialized to HTML string. + """ + resp: Dict[str, Any] = {} + textstat = import_textstat() + spacy = import_spacy() + text_complexity_metrics = { + "flesch_reading_ease": textstat.flesch_reading_ease(text), + "flesch_kincaid_grade": textstat.flesch_kincaid_grade(text), + "smog_index": textstat.smog_index(text), + "coleman_liau_index": textstat.coleman_liau_index(text), + "automated_readability_index": textstat.automated_readability_index(text), + "dale_chall_readability_score": textstat.dale_chall_readability_score(text), + "difficult_words": textstat.difficult_words(text), + "linsear_write_formula": textstat.linsear_write_formula(text), + "gunning_fog": textstat.gunning_fog(text), + # "text_standard": textstat.text_standard(text), + "fernandez_huerta": textstat.fernandez_huerta(text), + "szigriszt_pazos": textstat.szigriszt_pazos(text), + "gutierrez_polini": textstat.gutierrez_polini(text), + "crawford": textstat.crawford(text), + "gulpease_index": textstat.gulpease_index(text), + "osman": textstat.osman(text), + } + resp.update({"text_complexity_metrics": text_complexity_metrics}) + resp.update(text_complexity_metrics) + + if nlp is not None: + doc = nlp(text) + + dep_out = spacy.displacy.render( # type: ignore + doc, style="dep", jupyter=False, page=True + ) + + ent_out = spacy.displacy.render( # type: ignore + doc, style="ent", jupyter=False, page=True + ) + + text_visualizations = { + "dependency_tree": dep_out, + "entities": ent_out, + } + + resp.update(text_visualizations) + + return resp + + +def construct_html_from_prompt_and_generation(prompt: str, generation: str) -> Any: + """Construct an html element from a prompt and a generation. + + Parameters: + prompt (str): The prompt. + generation (str): The generation. + + Returns: + (str): The html string.""" + formatted_prompt = prompt.replace("\n", "- {formatted_generation} -
-
{formatted_prompt}:
+++ """ + + +class MlflowLogger: + """Callback Handler that logs metrics and artifacts to mlflow server. + + Parameters: + name (str): Name of the run. + experiment (str): Name of the experiment. + tags (dict): Tags to be attached for the run. + tracking_uri (str): MLflow tracking server uri. + + This handler implements the helper functions to initialize, + log metrics and artifacts to the mlflow server. + """ + + def __init__(self, **kwargs: Any): + self.mlflow = import_mlflow() + tracking_uri = get_from_dict_or_env( + kwargs, "tracking_uri", "MLFLOW_TRACKING_URI", "" + ) + self.mlflow.set_tracking_uri(tracking_uri) + + # User can set other env variables described here + # > https://www.mlflow.org/docs/latest/tracking.html#logging-to-a-tracking-server + + experiment_name = get_from_dict_or_env( + kwargs, "experiment_name", "MLFLOW_EXPERIMENT_NAME" + ) + self.mlf_exp = self.mlflow.get_experiment_by_name(experiment_name) + if self.mlf_exp is not None: + self.mlf_expid = self.mlf_exp.experiment_id + else: + self.mlf_expid = self.mlflow.create_experiment(experiment_name) + + self.start_run(kwargs["run_name"], kwargs["run_tags"]) + + def start_run(self, name: str, tags: Dict[str, str]) -> None: + """To start a new run, auto generates the random suffix for name""" + if name.endswith("-%"): + rname = "".join(random.choices(string.ascii_uppercase + string.digits, k=7)) + name = name.replace("%", rname) + self.run = self.mlflow.MlflowClient().create_run( + self.mlf_expid, run_name=name, tags=tags + ) + + def finish_run(self) -> None: + """To finish the run.""" + with self.mlflow.start_run( + run_id=self.run.info.run_id, experiment_id=self.mlf_expid + ): + self.mlflow.end_run() + + def metric(self, key: str, value: float) -> None: + """To log metric to mlflow server.""" + with self.mlflow.start_run( + run_id=self.run.info.run_id, experiment_id=self.mlf_expid + ): + self.mlflow.log_metric(key, value) + + def metrics( + self, data: Union[Dict[str, float], Dict[str, int]], step: Optional[int] = 0 + ) -> None: + """To log all metrics in the input dict.""" + with self.mlflow.start_run( + run_id=self.run.info.run_id, experiment_id=self.mlf_expid + ): + self.mlflow.log_metrics(data) + + def jsonf(self, data: Dict[str, Any], filename: str) -> None: + """To log the input data as json file artifact.""" + with self.mlflow.start_run( + run_id=self.run.info.run_id, experiment_id=self.mlf_expid + ): + self.mlflow.log_dict(data, f"{filename}.json") + + def table(self, name: str, dataframe) -> None: # type: ignore + """To log the input pandas dataframe as a html table""" + self.html(dataframe.to_html(), f"table_{name}") + + def html(self, html: str, filename: str) -> None: + """To log the input html string as html file artifact.""" + with self.mlflow.start_run( + run_id=self.run.info.run_id, experiment_id=self.mlf_expid + ): + self.mlflow.log_text(html, f"{filename}.html") + + def text(self, text: str, filename: str) -> None: + """To log the input text as text file artifact.""" + with self.mlflow.start_run( + run_id=self.run.info.run_id, experiment_id=self.mlf_expid + ): + self.mlflow.log_text(text, f"{filename}.txt") + + def artifact(self, path: str) -> None: + """To upload the file from given path as artifact.""" + with self.mlflow.start_run( + run_id=self.run.info.run_id, experiment_id=self.mlf_expid + ): + self.mlflow.log_artifact(path) + + def langchain_artifact(self, chain: Any) -> None: + with self.mlflow.start_run( + run_id=self.run.info.run_id, experiment_id=self.mlf_expid + ): + self.mlflow.langchain.log_model(chain, "langchain-model") + + +class MlflowCallbackHandler(BaseMetadataCallbackHandler, BaseCallbackHandler): + """Callback Handler that logs metrics and artifacts to mlflow server. + + Parameters: + name (str): Name of the run. + experiment (str): Name of the experiment. + tags (dict): Tags to be attached for the run. + tracking_uri (str): MLflow tracking server uri. + + This handler will utilize the associated callback method called and formats + the input of each callback function with metadata regarding the state of LLM run, + and adds the response to the list of records for both the {method}_records and + action. It then logs the response to mlflow server. + """ + + def __init__( + self, + name: Optional[str] = "langchainrun-%", + experiment: Optional[str] = "langchain", + tags: Optional[Dict] = {}, + tracking_uri: Optional[str] = None, + ) -> None: + """Initialize callback handler.""" + import_pandas() + import_textstat() + import_mlflow() + spacy = import_spacy() + super().__init__() + + self.name = name + self.experiment = experiment + self.tags = tags + self.tracking_uri = tracking_uri + + self.temp_dir = tempfile.TemporaryDirectory() + + self.mlflg = MlflowLogger( + tracking_uri=self.tracking_uri, + experiment_name=self.experiment, + run_name=self.name, + run_tags=self.tags, + ) + + self.action_records: list = [] + self.nlp = spacy.load("en_core_web_sm") + + self.metrics = { + "step": 0, + "starts": 0, + "ends": 0, + "errors": 0, + "text_ctr": 0, + "chain_starts": 0, + "chain_ends": 0, + "llm_starts": 0, + "llm_ends": 0, + "llm_streams": 0, + "tool_starts": 0, + "tool_ends": 0, + "agent_ends": 0, + } + + self.records: Dict[str, Any] = { + "on_llm_start_records": [], + "on_llm_token_records": [], + "on_llm_end_records": [], + "on_chain_start_records": [], + "on_chain_end_records": [], + "on_tool_start_records": [], + "on_tool_end_records": [], + "on_text_records": [], + "on_agent_finish_records": [], + "on_agent_action_records": [], + "action_records": [], + } + + def _reset(self) -> None: + for k, v in self.metrics.items(): + self.metrics[k] = 0 + for k, v in self.records.items(): + self.records[k] = [] + + def on_llm_start( + self, serialized: Dict[str, Any], prompts: List[str], **kwargs: Any + ) -> None: + """Run when LLM starts.""" + self.metrics["step"] += 1 + self.metrics["llm_starts"] += 1 + self.metrics["starts"] += 1 + + llm_starts = self.metrics["llm_starts"] + + resp: Dict[str, Any] = {} + resp.update({"action": "on_llm_start"}) + resp.update(flatten_dict(serialized)) + resp.update(self.metrics) + + self.mlflg.metrics(self.metrics, step=self.metrics["step"]) + + for idx, prompt in enumerate(prompts): + prompt_resp = deepcopy(resp) + prompt_resp["prompt"] = prompt + self.records["on_llm_start_records"].append(prompt_resp) + self.records["action_records"].append(prompt_resp) + self.mlflg.jsonf(prompt_resp, f"llm_start_{llm_starts}_prompt_{idx}") + + def on_llm_new_token(self, token: str, **kwargs: Any) -> None: + """Run when LLM generates a new token.""" + self.metrics["step"] += 1 + self.metrics["llm_streams"] += 1 + + llm_streams = self.metrics["llm_streams"] + + resp: Dict[str, Any] = {} + resp.update({"action": "on_llm_new_token", "token": token}) + resp.update(self.metrics) + + self.mlflg.metrics(self.metrics, step=self.metrics["step"]) + + self.records["on_llm_token_records"].append(resp) + self.records["action_records"].append(resp) + self.mlflg.jsonf(resp, f"llm_new_tokens_{llm_streams}") + + def on_llm_end(self, response: LLMResult, **kwargs: Any) -> None: + """Run when LLM ends running.""" + self.metrics["step"] += 1 + self.metrics["llm_ends"] += 1 + self.metrics["ends"] += 1 + + llm_ends = self.metrics["llm_ends"] + + resp: Dict[str, Any] = {} + resp.update({"action": "on_llm_end"}) + resp.update(flatten_dict(response.llm_output or {})) + resp.update(self.metrics) + + self.mlflg.metrics(self.metrics, step=self.metrics["step"]) + + for generations in response.generations: + for idx, generation in enumerate(generations): + generation_resp = deepcopy(resp) + generation_resp.update(flatten_dict(generation.dict())) + generation_resp.update( + analyze_text( + generation.text, + nlp=self.nlp, + ) + ) + complexity_metrics: Dict[str, float] = generation_resp.pop("text_complexity_metrics") # type: ignore # noqa: E501 + self.mlflg.metrics( + complexity_metrics, + step=self.metrics["step"], + ) + self.records["on_llm_end_records"].append(generation_resp) + self.records["action_records"].append(generation_resp) + self.mlflg.jsonf(resp, f"llm_end_{llm_ends}_generation_{idx}") + dependency_tree = generation_resp["dependency_tree"] + entities = generation_resp["entities"] + self.mlflg.html(dependency_tree, "dep-" + hash_string(generation.text)) + self.mlflg.html(entities, "ent-" + hash_string(generation.text)) + + def on_llm_error( + self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any + ) -> None: + """Run when LLM errors.""" + self.metrics["step"] += 1 + self.metrics["errors"] += 1 + + def on_chain_start( + self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any + ) -> None: + """Run when chain starts running.""" + self.metrics["step"] += 1 + self.metrics["chain_starts"] += 1 + self.metrics["starts"] += 1 + + chain_starts = self.metrics["chain_starts"] + + resp: Dict[str, Any] = {} + resp.update({"action": "on_chain_start"}) + resp.update(flatten_dict(serialized)) + resp.update(self.metrics) + + self.mlflg.metrics(self.metrics, step=self.metrics["step"]) + + chain_input = ",".join([f"{k}={v}" for k, v in inputs.items()]) + input_resp = deepcopy(resp) + input_resp["inputs"] = chain_input + self.records["on_chain_start_records"].append(input_resp) + self.records["action_records"].append(input_resp) + self.mlflg.jsonf(input_resp, f"chain_start_{chain_starts}") + + def on_chain_end(self, outputs: Dict[str, Any], **kwargs: Any) -> None: + """Run when chain ends running.""" + self.metrics["step"] += 1 + self.metrics["chain_ends"] += 1 + self.metrics["ends"] += 1 + + chain_ends = self.metrics["chain_ends"] + + resp: Dict[str, Any] = {} + chain_output = ",".join([f"{k}={v}" for k, v in outputs.items()]) + resp.update({"action": "on_chain_end", "outputs": chain_output}) + resp.update(self.metrics) + + self.mlflg.metrics(self.metrics, step=self.metrics["step"]) + + self.records["on_chain_end_records"].append(resp) + self.records["action_records"].append(resp) + self.mlflg.jsonf(resp, f"chain_end_{chain_ends}") + + def on_chain_error( + self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any + ) -> None: + """Run when chain errors.""" + self.metrics["step"] += 1 + self.metrics["errors"] += 1 + + def on_tool_start( + self, serialized: Dict[str, Any], input_str: str, **kwargs: Any + ) -> None: + """Run when tool starts running.""" + self.metrics["step"] += 1 + self.metrics["tool_starts"] += 1 + self.metrics["starts"] += 1 + + tool_starts = self.metrics["tool_starts"] + + resp: Dict[str, Any] = {} + resp.update({"action": "on_tool_start", "input_str": input_str}) + resp.update(flatten_dict(serialized)) + resp.update(self.metrics) + + self.mlflg.metrics(self.metrics, step=self.metrics["step"]) + + self.records["on_tool_start_records"].append(resp) + self.records["action_records"].append(resp) + self.mlflg.jsonf(resp, f"tool_start_{tool_starts}") + + def on_tool_end(self, output: str, **kwargs: Any) -> None: + """Run when tool ends running.""" + self.metrics["step"] += 1 + self.metrics["tool_ends"] += 1 + self.metrics["ends"] += 1 + + tool_ends = self.metrics["tool_ends"] + + resp: Dict[str, Any] = {} + resp.update({"action": "on_tool_end", "output": output}) + resp.update(self.metrics) + + self.mlflg.metrics(self.metrics, step=self.metrics["step"]) + + self.records["on_tool_end_records"].append(resp) + self.records["action_records"].append(resp) + self.mlflg.jsonf(resp, f"tool_end_{tool_ends}") + + def on_tool_error( + self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any + ) -> None: + """Run when tool errors.""" + self.metrics["step"] += 1 + self.metrics["errors"] += 1 + + def on_text(self, text: str, **kwargs: Any) -> None: + """ + Run when agent is ending. + """ + self.metrics["step"] += 1 + self.metrics["text_ctr"] += 1 + + text_ctr = self.metrics["text_ctr"] + + resp: Dict[str, Any] = {} + resp.update({"action": "on_text", "text": text}) + resp.update(self.metrics) + + self.mlflg.metrics(self.metrics, step=self.metrics["step"]) + + self.records["on_text_records"].append(resp) + self.records["action_records"].append(resp) + self.mlflg.jsonf(resp, f"on_text_{text_ctr}") + + def on_agent_finish(self, finish: AgentFinish, **kwargs: Any) -> None: + """Run when agent ends running.""" + self.metrics["step"] += 1 + self.metrics["agent_ends"] += 1 + self.metrics["ends"] += 1 + + agent_ends = self.metrics["agent_ends"] + resp: Dict[str, Any] = {} + resp.update( + { + "action": "on_agent_finish", + "output": finish.return_values["output"], + "log": finish.log, + } + ) + resp.update(self.metrics) + + self.mlflg.metrics(self.metrics, step=self.metrics["step"]) + + self.records["on_agent_finish_records"].append(resp) + self.records["action_records"].append(resp) + self.mlflg.jsonf(resp, f"agent_finish_{agent_ends}") + + def on_agent_action(self, action: AgentAction, **kwargs: Any) -> Any: + """Run on agent action.""" + self.metrics["step"] += 1 + self.metrics["tool_starts"] += 1 + self.metrics["starts"] += 1 + + tool_starts = self.metrics["tool_starts"] + resp: Dict[str, Any] = {} + resp.update( + { + "action": "on_agent_action", + "tool": action.tool, + "tool_input": action.tool_input, + "log": action.log, + } + ) + resp.update(self.metrics) + self.mlflg.metrics(self.metrics, step=self.metrics["step"]) + self.records["on_agent_action_records"].append(resp) + self.records["action_records"].append(resp) + self.mlflg.jsonf(resp, f"agent_action_{tool_starts}") + + def _create_session_analysis_df(self) -> Any: + """Create a dataframe with all the information from the session.""" + pd = import_pandas() + on_llm_start_records_df = pd.DataFrame(self.records["on_llm_start_records"]) + on_llm_end_records_df = pd.DataFrame(self.records["on_llm_end_records"]) + + llm_input_columns = ["step", "prompt"] + if "name" in on_llm_start_records_df.columns: + llm_input_columns.append("name") + elif "id" in on_llm_start_records_df.columns: + # id is llm class's full import path. For example: + # ["langchain", "llms", "openai", "AzureOpenAI"] + on_llm_start_records_df["name"] = on_llm_start_records_df["id"].apply( + lambda id_: id_[-1] + ) + llm_input_columns.append("name") + llm_input_prompts_df = ( + on_llm_start_records_df[llm_input_columns] + .dropna(axis=1) + .rename({"step": "prompt_step"}, axis=1) + ) + complexity_metrics_columns = [] + visualizations_columns = [] + + complexity_metrics_columns = [ + "flesch_reading_ease", + "flesch_kincaid_grade", + "smog_index", + "coleman_liau_index", + "automated_readability_index", + "dale_chall_readability_score", + "difficult_words", + "linsear_write_formula", + "gunning_fog", + # "text_standard", + "fernandez_huerta", + "szigriszt_pazos", + "gutierrez_polini", + "crawford", + "gulpease_index", + "osman", + ] + + visualizations_columns = ["dependency_tree", "entities"] + + llm_outputs_df = ( + on_llm_end_records_df[ + [ + "step", + "text", + "token_usage_total_tokens", + "token_usage_prompt_tokens", + "token_usage_completion_tokens", + ] + + complexity_metrics_columns + + visualizations_columns + ] + .dropna(axis=1) + .rename({"step": "output_step", "text": "output"}, axis=1) + ) + session_analysis_df = pd.concat([llm_input_prompts_df, llm_outputs_df], axis=1) + session_analysis_df["chat_html"] = session_analysis_df[ + ["prompt", "output"] + ].apply( + lambda row: construct_html_from_prompt_and_generation( + row["prompt"], row["output"] + ), + axis=1, + ) + return session_analysis_df + + def flush_tracker(self, langchain_asset: Any = None, finish: bool = False) -> None: + pd = import_pandas() + self.mlflg.table("action_records", pd.DataFrame(self.records["action_records"])) + session_analysis_df = self._create_session_analysis_df() + chat_html = session_analysis_df.pop("chat_html") + chat_html = chat_html.replace("\n", "", regex=True) + self.mlflg.table("session_analysis", pd.DataFrame(session_analysis_df)) + self.mlflg.html("".join(chat_html.tolist()), "chat_html") + + if langchain_asset: + # To avoid circular import error + # mlflow only supports LLMChain asset + if "langchain.chains.llm.LLMChain" in str(type(langchain_asset)): + self.mlflg.langchain_artifact(langchain_asset) + else: + langchain_asset_path = str(Path(self.temp_dir.name, "model.json")) + try: + langchain_asset.save(langchain_asset_path) + self.mlflg.artifact(langchain_asset_path) + except ValueError: + try: + langchain_asset.save_agent(langchain_asset_path) + self.mlflg.artifact(langchain_asset_path) + except AttributeError: + print("Could not save model.") + traceback.print_exc() + pass + except NotImplementedError: + print("Could not save model.") + traceback.print_exc() + pass + except NotImplementedError: + print("Could not save model.") + traceback.print_exc() + pass + if finish: + self.mlflg.finish_run() + self._reset() diff --git a/langchain/callbacks/openai_info.py b/libs/langchain/langchain/callbacks/openai_info.py similarity index 100% rename from langchain/callbacks/openai_info.py rename to libs/langchain/langchain/callbacks/openai_info.py diff --git a/langchain/callbacks/promptlayer_callback.py b/libs/langchain/langchain/callbacks/promptlayer_callback.py similarity index 100% rename from langchain/callbacks/promptlayer_callback.py rename to libs/langchain/langchain/callbacks/promptlayer_callback.py diff --git a/langchain/callbacks/stdout.py b/libs/langchain/langchain/callbacks/stdout.py similarity index 100% rename from langchain/callbacks/stdout.py rename to libs/langchain/langchain/callbacks/stdout.py diff --git a/langchain/callbacks/streaming_aiter.py b/libs/langchain/langchain/callbacks/streaming_aiter.py similarity index 100% rename from langchain/callbacks/streaming_aiter.py rename to libs/langchain/langchain/callbacks/streaming_aiter.py diff --git a/langchain/callbacks/streaming_aiter_final_only.py b/libs/langchain/langchain/callbacks/streaming_aiter_final_only.py similarity index 100% rename from langchain/callbacks/streaming_aiter_final_only.py rename to libs/langchain/langchain/callbacks/streaming_aiter_final_only.py diff --git a/langchain/callbacks/streaming_stdout.py b/libs/langchain/langchain/callbacks/streaming_stdout.py similarity index 100% rename from langchain/callbacks/streaming_stdout.py rename to libs/langchain/langchain/callbacks/streaming_stdout.py diff --git a/langchain/callbacks/streaming_stdout_final_only.py b/libs/langchain/langchain/callbacks/streaming_stdout_final_only.py similarity index 100% rename from langchain/callbacks/streaming_stdout_final_only.py rename to libs/langchain/langchain/callbacks/streaming_stdout_final_only.py diff --git a/langchain/callbacks/streamlit/__init__.py b/libs/langchain/langchain/callbacks/streamlit/__init__.py similarity index 100% rename from langchain/callbacks/streamlit/__init__.py rename to libs/langchain/langchain/callbacks/streamlit/__init__.py diff --git a/langchain/callbacks/streamlit/mutable_expander.py b/libs/langchain/langchain/callbacks/streamlit/mutable_expander.py similarity index 100% rename from langchain/callbacks/streamlit/mutable_expander.py rename to libs/langchain/langchain/callbacks/streamlit/mutable_expander.py diff --git a/langchain/callbacks/streamlit/streamlit_callback_handler.py b/libs/langchain/langchain/callbacks/streamlit/streamlit_callback_handler.py similarity index 100% rename from langchain/callbacks/streamlit/streamlit_callback_handler.py rename to libs/langchain/langchain/callbacks/streamlit/streamlit_callback_handler.py diff --git a/langchain/callbacks/tracers/__init__.py b/libs/langchain/langchain/callbacks/tracers/__init__.py similarity index 100% rename from langchain/callbacks/tracers/__init__.py rename to libs/langchain/langchain/callbacks/tracers/__init__.py diff --git a/langchain/callbacks/tracers/base.py b/libs/langchain/langchain/callbacks/tracers/base.py similarity index 100% rename from langchain/callbacks/tracers/base.py rename to libs/langchain/langchain/callbacks/tracers/base.py diff --git a/langchain/callbacks/tracers/evaluation.py b/libs/langchain/langchain/callbacks/tracers/evaluation.py similarity index 100% rename from langchain/callbacks/tracers/evaluation.py rename to libs/langchain/langchain/callbacks/tracers/evaluation.py diff --git a/langchain/callbacks/tracers/langchain.py b/libs/langchain/langchain/callbacks/tracers/langchain.py similarity index 100% rename from langchain/callbacks/tracers/langchain.py rename to libs/langchain/langchain/callbacks/tracers/langchain.py diff --git a/langchain/callbacks/tracers/langchain_v1.py b/libs/langchain/langchain/callbacks/tracers/langchain_v1.py similarity index 100% rename from langchain/callbacks/tracers/langchain_v1.py rename to libs/langchain/langchain/callbacks/tracers/langchain_v1.py diff --git a/langchain/callbacks/tracers/run_collector.py b/libs/langchain/langchain/callbacks/tracers/run_collector.py similarity index 100% rename from langchain/callbacks/tracers/run_collector.py rename to libs/langchain/langchain/callbacks/tracers/run_collector.py diff --git a/langchain/callbacks/tracers/schemas.py b/libs/langchain/langchain/callbacks/tracers/schemas.py similarity index 100% rename from langchain/callbacks/tracers/schemas.py rename to libs/langchain/langchain/callbacks/tracers/schemas.py diff --git a/langchain/callbacks/tracers/stdout.py b/libs/langchain/langchain/callbacks/tracers/stdout.py similarity index 100% rename from langchain/callbacks/tracers/stdout.py rename to libs/langchain/langchain/callbacks/tracers/stdout.py diff --git a/langchain/callbacks/tracers/wandb.py b/libs/langchain/langchain/callbacks/tracers/wandb.py similarity index 100% rename from langchain/callbacks/tracers/wandb.py rename to libs/langchain/langchain/callbacks/tracers/wandb.py diff --git a/langchain/callbacks/utils.py b/libs/langchain/langchain/callbacks/utils.py similarity index 100% rename from langchain/callbacks/utils.py rename to libs/langchain/langchain/callbacks/utils.py diff --git a/langchain/callbacks/wandb_callback.py b/libs/langchain/langchain/callbacks/wandb_callback.py similarity index 100% rename from langchain/callbacks/wandb_callback.py rename to libs/langchain/langchain/callbacks/wandb_callback.py diff --git a/langchain/callbacks/whylabs_callback.py b/libs/langchain/langchain/callbacks/whylabs_callback.py similarity index 100% rename from langchain/callbacks/whylabs_callback.py rename to libs/langchain/langchain/callbacks/whylabs_callback.py diff --git a/langchain/chains/__init__.py b/libs/langchain/langchain/chains/__init__.py similarity index 100% rename from langchain/chains/__init__.py rename to libs/langchain/langchain/chains/__init__.py diff --git a/langchain/chains/api/__init__.py b/libs/langchain/langchain/chains/api/__init__.py similarity index 100% rename from langchain/chains/api/__init__.py rename to libs/langchain/langchain/chains/api/__init__.py diff --git a/langchain/chains/api/base.py b/libs/langchain/langchain/chains/api/base.py similarity index 100% rename from langchain/chains/api/base.py rename to libs/langchain/langchain/chains/api/base.py diff --git a/langchain/chains/api/news_docs.py b/libs/langchain/langchain/chains/api/news_docs.py similarity index 100% rename from langchain/chains/api/news_docs.py rename to libs/langchain/langchain/chains/api/news_docs.py diff --git a/langchain/chains/api/open_meteo_docs.py b/libs/langchain/langchain/chains/api/open_meteo_docs.py similarity index 100% rename from langchain/chains/api/open_meteo_docs.py rename to libs/langchain/langchain/chains/api/open_meteo_docs.py diff --git a/langchain/chains/api/openapi/__init__.py b/libs/langchain/langchain/chains/api/openapi/__init__.py similarity index 100% rename from langchain/chains/api/openapi/__init__.py rename to libs/langchain/langchain/chains/api/openapi/__init__.py diff --git a/langchain/chains/api/openapi/chain.py b/libs/langchain/langchain/chains/api/openapi/chain.py similarity index 100% rename from langchain/chains/api/openapi/chain.py rename to libs/langchain/langchain/chains/api/openapi/chain.py diff --git a/langchain/chains/api/openapi/prompts.py b/libs/langchain/langchain/chains/api/openapi/prompts.py similarity index 100% rename from langchain/chains/api/openapi/prompts.py rename to libs/langchain/langchain/chains/api/openapi/prompts.py diff --git a/langchain/chains/api/openapi/requests_chain.py b/libs/langchain/langchain/chains/api/openapi/requests_chain.py similarity index 100% rename from langchain/chains/api/openapi/requests_chain.py rename to libs/langchain/langchain/chains/api/openapi/requests_chain.py diff --git a/langchain/chains/api/openapi/response_chain.py b/libs/langchain/langchain/chains/api/openapi/response_chain.py similarity index 100% rename from langchain/chains/api/openapi/response_chain.py rename to libs/langchain/langchain/chains/api/openapi/response_chain.py diff --git a/langchain/chains/api/podcast_docs.py b/libs/langchain/langchain/chains/api/podcast_docs.py similarity index 100% rename from langchain/chains/api/podcast_docs.py rename to libs/langchain/langchain/chains/api/podcast_docs.py diff --git a/langchain/chains/api/prompt.py b/libs/langchain/langchain/chains/api/prompt.py similarity index 100% rename from langchain/chains/api/prompt.py rename to libs/langchain/langchain/chains/api/prompt.py diff --git a/langchain/chains/api/tmdb_docs.py b/libs/langchain/langchain/chains/api/tmdb_docs.py similarity index 100% rename from langchain/chains/api/tmdb_docs.py rename to libs/langchain/langchain/chains/api/tmdb_docs.py diff --git a/langchain/chains/base.py b/libs/langchain/langchain/chains/base.py similarity index 100% rename from langchain/chains/base.py rename to libs/langchain/langchain/chains/base.py diff --git a/langchain/chains/chat_vector_db/__init__.py b/libs/langchain/langchain/chains/chat_vector_db/__init__.py similarity index 100% rename from langchain/chains/chat_vector_db/__init__.py rename to libs/langchain/langchain/chains/chat_vector_db/__init__.py diff --git a/langchain/chains/chat_vector_db/prompts.py b/libs/langchain/langchain/chains/chat_vector_db/prompts.py similarity index 100% rename from langchain/chains/chat_vector_db/prompts.py rename to libs/langchain/langchain/chains/chat_vector_db/prompts.py diff --git a/langchain/chains/combine_documents/__init__.py b/libs/langchain/langchain/chains/combine_documents/__init__.py similarity index 100% rename from langchain/chains/combine_documents/__init__.py rename to libs/langchain/langchain/chains/combine_documents/__init__.py diff --git a/langchain/chains/combine_documents/base.py b/libs/langchain/langchain/chains/combine_documents/base.py similarity index 100% rename from langchain/chains/combine_documents/base.py rename to libs/langchain/langchain/chains/combine_documents/base.py diff --git a/langchain/chains/combine_documents/map_reduce.py b/libs/langchain/langchain/chains/combine_documents/map_reduce.py similarity index 100% rename from langchain/chains/combine_documents/map_reduce.py rename to libs/langchain/langchain/chains/combine_documents/map_reduce.py diff --git a/langchain/chains/combine_documents/map_rerank.py b/libs/langchain/langchain/chains/combine_documents/map_rerank.py similarity index 100% rename from langchain/chains/combine_documents/map_rerank.py rename to libs/langchain/langchain/chains/combine_documents/map_rerank.py diff --git a/langchain/chains/combine_documents/reduce.py b/libs/langchain/langchain/chains/combine_documents/reduce.py similarity index 100% rename from langchain/chains/combine_documents/reduce.py rename to libs/langchain/langchain/chains/combine_documents/reduce.py diff --git a/langchain/chains/combine_documents/refine.py b/libs/langchain/langchain/chains/combine_documents/refine.py similarity index 100% rename from langchain/chains/combine_documents/refine.py rename to libs/langchain/langchain/chains/combine_documents/refine.py diff --git a/langchain/chains/combine_documents/stuff.py b/libs/langchain/langchain/chains/combine_documents/stuff.py similarity index 100% rename from langchain/chains/combine_documents/stuff.py rename to libs/langchain/langchain/chains/combine_documents/stuff.py diff --git a/langchain/chains/constitutional_ai/__init__.py b/libs/langchain/langchain/chains/constitutional_ai/__init__.py similarity index 100% rename from langchain/chains/constitutional_ai/__init__.py rename to libs/langchain/langchain/chains/constitutional_ai/__init__.py diff --git a/langchain/chains/constitutional_ai/base.py b/libs/langchain/langchain/chains/constitutional_ai/base.py similarity index 100% rename from langchain/chains/constitutional_ai/base.py rename to libs/langchain/langchain/chains/constitutional_ai/base.py diff --git a/langchain/chains/constitutional_ai/models.py b/libs/langchain/langchain/chains/constitutional_ai/models.py similarity index 100% rename from langchain/chains/constitutional_ai/models.py rename to libs/langchain/langchain/chains/constitutional_ai/models.py diff --git a/langchain/chains/constitutional_ai/principles.py b/libs/langchain/langchain/chains/constitutional_ai/principles.py similarity index 100% rename from langchain/chains/constitutional_ai/principles.py rename to libs/langchain/langchain/chains/constitutional_ai/principles.py diff --git a/langchain/chains/constitutional_ai/prompts.py b/libs/langchain/langchain/chains/constitutional_ai/prompts.py similarity index 100% rename from langchain/chains/constitutional_ai/prompts.py rename to libs/langchain/langchain/chains/constitutional_ai/prompts.py diff --git a/langchain/chains/conversation/__init__.py b/libs/langchain/langchain/chains/conversation/__init__.py similarity index 100% rename from langchain/chains/conversation/__init__.py rename to libs/langchain/langchain/chains/conversation/__init__.py diff --git a/langchain/chains/conversation/base.py b/libs/langchain/langchain/chains/conversation/base.py similarity index 100% rename from langchain/chains/conversation/base.py rename to libs/langchain/langchain/chains/conversation/base.py diff --git a/langchain/chains/conversation/memory.py b/libs/langchain/langchain/chains/conversation/memory.py similarity index 100% rename from langchain/chains/conversation/memory.py rename to libs/langchain/langchain/chains/conversation/memory.py diff --git a/langchain/chains/conversation/prompt.py b/libs/langchain/langchain/chains/conversation/prompt.py similarity index 100% rename from langchain/chains/conversation/prompt.py rename to libs/langchain/langchain/chains/conversation/prompt.py diff --git a/langchain/chains/conversational_retrieval/__init__.py b/libs/langchain/langchain/chains/conversational_retrieval/__init__.py similarity index 100% rename from langchain/chains/conversational_retrieval/__init__.py rename to libs/langchain/langchain/chains/conversational_retrieval/__init__.py diff --git a/langchain/chains/conversational_retrieval/base.py b/libs/langchain/langchain/chains/conversational_retrieval/base.py similarity index 100% rename from langchain/chains/conversational_retrieval/base.py rename to libs/langchain/langchain/chains/conversational_retrieval/base.py diff --git a/langchain/chains/conversational_retrieval/prompts.py b/libs/langchain/langchain/chains/conversational_retrieval/prompts.py similarity index 100% rename from langchain/chains/conversational_retrieval/prompts.py rename to libs/langchain/langchain/chains/conversational_retrieval/prompts.py diff --git a/langchain/chains/elasticsearch_database/__init__.py b/libs/langchain/langchain/chains/elasticsearch_database/__init__.py similarity index 100% rename from langchain/chains/elasticsearch_database/__init__.py rename to libs/langchain/langchain/chains/elasticsearch_database/__init__.py diff --git a/langchain/chains/elasticsearch_database/base.py b/libs/langchain/langchain/chains/elasticsearch_database/base.py similarity index 100% rename from langchain/chains/elasticsearch_database/base.py rename to libs/langchain/langchain/chains/elasticsearch_database/base.py diff --git a/langchain/chains/elasticsearch_database/prompts.py b/libs/langchain/langchain/chains/elasticsearch_database/prompts.py similarity index 100% rename from langchain/chains/elasticsearch_database/prompts.py rename to libs/langchain/langchain/chains/elasticsearch_database/prompts.py diff --git a/langchain/chains/flare/__init__.py b/libs/langchain/langchain/chains/flare/__init__.py similarity index 100% rename from langchain/chains/flare/__init__.py rename to libs/langchain/langchain/chains/flare/__init__.py diff --git a/langchain/chains/flare/base.py b/libs/langchain/langchain/chains/flare/base.py similarity index 100% rename from langchain/chains/flare/base.py rename to libs/langchain/langchain/chains/flare/base.py diff --git a/langchain/chains/flare/prompts.py b/libs/langchain/langchain/chains/flare/prompts.py similarity index 100% rename from langchain/chains/flare/prompts.py rename to libs/langchain/langchain/chains/flare/prompts.py diff --git a/langchain/chains/graph_qa/__init__.py b/libs/langchain/langchain/chains/graph_qa/__init__.py similarity index 100% rename from langchain/chains/graph_qa/__init__.py rename to libs/langchain/langchain/chains/graph_qa/__init__.py diff --git a/langchain/chains/graph_qa/base.py b/libs/langchain/langchain/chains/graph_qa/base.py similarity index 100% rename from langchain/chains/graph_qa/base.py rename to libs/langchain/langchain/chains/graph_qa/base.py diff --git a/langchain/chains/graph_qa/cypher.py b/libs/langchain/langchain/chains/graph_qa/cypher.py similarity index 100% rename from langchain/chains/graph_qa/cypher.py rename to libs/langchain/langchain/chains/graph_qa/cypher.py diff --git a/langchain/chains/graph_qa/hugegraph.py b/libs/langchain/langchain/chains/graph_qa/hugegraph.py similarity index 100% rename from langchain/chains/graph_qa/hugegraph.py rename to libs/langchain/langchain/chains/graph_qa/hugegraph.py diff --git a/langchain/chains/graph_qa/kuzu.py b/libs/langchain/langchain/chains/graph_qa/kuzu.py similarity index 100% rename from langchain/chains/graph_qa/kuzu.py rename to libs/langchain/langchain/chains/graph_qa/kuzu.py diff --git a/langchain/chains/graph_qa/nebulagraph.py b/libs/langchain/langchain/chains/graph_qa/nebulagraph.py similarity index 100% rename from langchain/chains/graph_qa/nebulagraph.py rename to libs/langchain/langchain/chains/graph_qa/nebulagraph.py diff --git a/langchain/chains/graph_qa/prompts.py b/libs/langchain/langchain/chains/graph_qa/prompts.py similarity index 100% rename from langchain/chains/graph_qa/prompts.py rename to libs/langchain/langchain/chains/graph_qa/prompts.py diff --git a/langchain/chains/graph_qa/sparql.py b/libs/langchain/langchain/chains/graph_qa/sparql.py similarity index 100% rename from langchain/chains/graph_qa/sparql.py rename to libs/langchain/langchain/chains/graph_qa/sparql.py diff --git a/langchain/chains/hyde/__init__.py b/libs/langchain/langchain/chains/hyde/__init__.py similarity index 100% rename from langchain/chains/hyde/__init__.py rename to libs/langchain/langchain/chains/hyde/__init__.py diff --git a/langchain/chains/hyde/base.py b/libs/langchain/langchain/chains/hyde/base.py similarity index 100% rename from langchain/chains/hyde/base.py rename to libs/langchain/langchain/chains/hyde/base.py diff --git a/langchain/chains/hyde/prompts.py b/libs/langchain/langchain/chains/hyde/prompts.py similarity index 100% rename from langchain/chains/hyde/prompts.py rename to libs/langchain/langchain/chains/hyde/prompts.py diff --git a/langchain/chains/llm.py b/libs/langchain/langchain/chains/llm.py similarity index 100% rename from langchain/chains/llm.py rename to libs/langchain/langchain/chains/llm.py diff --git a/langchain/chains/llm_bash/__init__.py b/libs/langchain/langchain/chains/llm_bash/__init__.py similarity index 100% rename from langchain/chains/llm_bash/__init__.py rename to libs/langchain/langchain/chains/llm_bash/__init__.py diff --git a/langchain/chains/llm_bash/base.py b/libs/langchain/langchain/chains/llm_bash/base.py similarity index 100% rename from langchain/chains/llm_bash/base.py rename to libs/langchain/langchain/chains/llm_bash/base.py diff --git a/langchain/chains/llm_bash/prompt.py b/libs/langchain/langchain/chains/llm_bash/prompt.py similarity index 100% rename from langchain/chains/llm_bash/prompt.py rename to libs/langchain/langchain/chains/llm_bash/prompt.py diff --git a/langchain/chains/llm_checker/__init__.py b/libs/langchain/langchain/chains/llm_checker/__init__.py similarity index 100% rename from langchain/chains/llm_checker/__init__.py rename to libs/langchain/langchain/chains/llm_checker/__init__.py diff --git a/langchain/chains/llm_checker/base.py b/libs/langchain/langchain/chains/llm_checker/base.py similarity index 100% rename from langchain/chains/llm_checker/base.py rename to libs/langchain/langchain/chains/llm_checker/base.py diff --git a/langchain/chains/llm_checker/prompt.py b/libs/langchain/langchain/chains/llm_checker/prompt.py similarity index 100% rename from langchain/chains/llm_checker/prompt.py rename to libs/langchain/langchain/chains/llm_checker/prompt.py diff --git a/langchain/chains/llm_math/__init__.py b/libs/langchain/langchain/chains/llm_math/__init__.py similarity index 100% rename from langchain/chains/llm_math/__init__.py rename to libs/langchain/langchain/chains/llm_math/__init__.py diff --git a/langchain/chains/llm_math/base.py b/libs/langchain/langchain/chains/llm_math/base.py similarity index 100% rename from langchain/chains/llm_math/base.py rename to libs/langchain/langchain/chains/llm_math/base.py diff --git a/langchain/chains/llm_math/prompt.py b/libs/langchain/langchain/chains/llm_math/prompt.py similarity index 100% rename from langchain/chains/llm_math/prompt.py rename to libs/langchain/langchain/chains/llm_math/prompt.py diff --git a/langchain/chains/llm_requests.py b/libs/langchain/langchain/chains/llm_requests.py similarity index 100% rename from langchain/chains/llm_requests.py rename to libs/langchain/langchain/chains/llm_requests.py diff --git a/langchain/chains/llm_summarization_checker/__init__.py b/libs/langchain/langchain/chains/llm_summarization_checker/__init__.py similarity index 100% rename from langchain/chains/llm_summarization_checker/__init__.py rename to libs/langchain/langchain/chains/llm_summarization_checker/__init__.py diff --git a/langchain/chains/llm_summarization_checker/base.py b/libs/langchain/langchain/chains/llm_summarization_checker/base.py similarity index 100% rename from langchain/chains/llm_summarization_checker/base.py rename to libs/langchain/langchain/chains/llm_summarization_checker/base.py diff --git a/langchain/chains/llm_summarization_checker/prompts/are_all_true_prompt.txt b/libs/langchain/langchain/chains/llm_summarization_checker/prompts/are_all_true_prompt.txt similarity index 100% rename from langchain/chains/llm_summarization_checker/prompts/are_all_true_prompt.txt rename to libs/langchain/langchain/chains/llm_summarization_checker/prompts/are_all_true_prompt.txt diff --git a/langchain/chains/llm_summarization_checker/prompts/check_facts.txt b/libs/langchain/langchain/chains/llm_summarization_checker/prompts/check_facts.txt similarity index 100% rename from langchain/chains/llm_summarization_checker/prompts/check_facts.txt rename to libs/langchain/langchain/chains/llm_summarization_checker/prompts/check_facts.txt diff --git a/langchain/chains/llm_summarization_checker/prompts/create_facts.txt b/libs/langchain/langchain/chains/llm_summarization_checker/prompts/create_facts.txt similarity index 100% rename from langchain/chains/llm_summarization_checker/prompts/create_facts.txt rename to libs/langchain/langchain/chains/llm_summarization_checker/prompts/create_facts.txt diff --git a/langchain/chains/llm_summarization_checker/prompts/revise_summary.txt b/libs/langchain/langchain/chains/llm_summarization_checker/prompts/revise_summary.txt similarity index 100% rename from langchain/chains/llm_summarization_checker/prompts/revise_summary.txt rename to libs/langchain/langchain/chains/llm_summarization_checker/prompts/revise_summary.txt diff --git a/langchain/chains/llm_symbolic_math/__init__.py b/libs/langchain/langchain/chains/llm_symbolic_math/__init__.py similarity index 100% rename from langchain/chains/llm_symbolic_math/__init__.py rename to libs/langchain/langchain/chains/llm_symbolic_math/__init__.py diff --git a/langchain/chains/llm_symbolic_math/base.py b/libs/langchain/langchain/chains/llm_symbolic_math/base.py similarity index 100% rename from langchain/chains/llm_symbolic_math/base.py rename to libs/langchain/langchain/chains/llm_symbolic_math/base.py diff --git a/langchain/chains/llm_symbolic_math/prompt.py b/libs/langchain/langchain/chains/llm_symbolic_math/prompt.py similarity index 100% rename from langchain/chains/llm_symbolic_math/prompt.py rename to libs/langchain/langchain/chains/llm_symbolic_math/prompt.py diff --git a/langchain/chains/loading.py b/libs/langchain/langchain/chains/loading.py similarity index 100% rename from langchain/chains/loading.py rename to libs/langchain/langchain/chains/loading.py diff --git a/langchain/chains/mapreduce.py b/libs/langchain/langchain/chains/mapreduce.py similarity index 100% rename from langchain/chains/mapreduce.py rename to libs/langchain/langchain/chains/mapreduce.py diff --git a/langchain/chains/moderation.py b/libs/langchain/langchain/chains/moderation.py similarity index 100% rename from langchain/chains/moderation.py rename to libs/langchain/langchain/chains/moderation.py diff --git a/langchain/chains/natbot/__init__.py b/libs/langchain/langchain/chains/natbot/__init__.py similarity index 100% rename from langchain/chains/natbot/__init__.py rename to libs/langchain/langchain/chains/natbot/__init__.py diff --git a/langchain/chains/natbot/base.py b/libs/langchain/langchain/chains/natbot/base.py similarity index 100% rename from langchain/chains/natbot/base.py rename to libs/langchain/langchain/chains/natbot/base.py diff --git a/langchain/chains/natbot/crawler.py b/libs/langchain/langchain/chains/natbot/crawler.py similarity index 100% rename from langchain/chains/natbot/crawler.py rename to libs/langchain/langchain/chains/natbot/crawler.py diff --git a/langchain/chains/natbot/prompt.py b/libs/langchain/langchain/chains/natbot/prompt.py similarity index 100% rename from langchain/chains/natbot/prompt.py rename to libs/langchain/langchain/chains/natbot/prompt.py diff --git a/langchain/chains/openai_functions/__init__.py b/libs/langchain/langchain/chains/openai_functions/__init__.py similarity index 100% rename from langchain/chains/openai_functions/__init__.py rename to libs/langchain/langchain/chains/openai_functions/__init__.py diff --git a/langchain/chains/openai_functions/base.py b/libs/langchain/langchain/chains/openai_functions/base.py similarity index 100% rename from langchain/chains/openai_functions/base.py rename to libs/langchain/langchain/chains/openai_functions/base.py diff --git a/langchain/chains/openai_functions/citation_fuzzy_match.py b/libs/langchain/langchain/chains/openai_functions/citation_fuzzy_match.py similarity index 100% rename from langchain/chains/openai_functions/citation_fuzzy_match.py rename to libs/langchain/langchain/chains/openai_functions/citation_fuzzy_match.py diff --git a/langchain/chains/openai_functions/extraction.py b/libs/langchain/langchain/chains/openai_functions/extraction.py similarity index 100% rename from langchain/chains/openai_functions/extraction.py rename to libs/langchain/langchain/chains/openai_functions/extraction.py diff --git a/langchain/chains/openai_functions/openapi.py b/libs/langchain/langchain/chains/openai_functions/openapi.py similarity index 100% rename from langchain/chains/openai_functions/openapi.py rename to libs/langchain/langchain/chains/openai_functions/openapi.py diff --git a/langchain/chains/openai_functions/qa_with_structure.py b/libs/langchain/langchain/chains/openai_functions/qa_with_structure.py similarity index 100% rename from langchain/chains/openai_functions/qa_with_structure.py rename to libs/langchain/langchain/chains/openai_functions/qa_with_structure.py diff --git a/langchain/chains/openai_functions/tagging.py b/libs/langchain/langchain/chains/openai_functions/tagging.py similarity index 100% rename from langchain/chains/openai_functions/tagging.py rename to libs/langchain/langchain/chains/openai_functions/tagging.py diff --git a/langchain/chains/openai_functions/utils.py b/libs/langchain/langchain/chains/openai_functions/utils.py similarity index 100% rename from langchain/chains/openai_functions/utils.py rename to libs/langchain/langchain/chains/openai_functions/utils.py diff --git a/langchain/chains/pal/__init__.py b/libs/langchain/langchain/chains/pal/__init__.py similarity index 100% rename from langchain/chains/pal/__init__.py rename to libs/langchain/langchain/chains/pal/__init__.py diff --git a/langchain/chains/pal/base.py b/libs/langchain/langchain/chains/pal/base.py similarity index 100% rename from langchain/chains/pal/base.py rename to libs/langchain/langchain/chains/pal/base.py diff --git a/langchain/chains/pal/colored_object_prompt.py b/libs/langchain/langchain/chains/pal/colored_object_prompt.py similarity index 100% rename from langchain/chains/pal/colored_object_prompt.py rename to libs/langchain/langchain/chains/pal/colored_object_prompt.py diff --git a/langchain/chains/pal/math_prompt.py b/libs/langchain/langchain/chains/pal/math_prompt.py similarity index 100% rename from langchain/chains/pal/math_prompt.py rename to libs/langchain/langchain/chains/pal/math_prompt.py diff --git a/langchain/chains/prompt_selector.py b/libs/langchain/langchain/chains/prompt_selector.py similarity index 100% rename from langchain/chains/prompt_selector.py rename to libs/langchain/langchain/chains/prompt_selector.py diff --git a/langchain/chains/qa_generation/__init__.py b/libs/langchain/langchain/chains/qa_generation/__init__.py similarity index 100% rename from langchain/chains/qa_generation/__init__.py rename to libs/langchain/langchain/chains/qa_generation/__init__.py diff --git a/langchain/chains/qa_generation/base.py b/libs/langchain/langchain/chains/qa_generation/base.py similarity index 100% rename from langchain/chains/qa_generation/base.py rename to libs/langchain/langchain/chains/qa_generation/base.py diff --git a/langchain/chains/qa_generation/prompt.py b/libs/langchain/langchain/chains/qa_generation/prompt.py similarity index 100% rename from langchain/chains/qa_generation/prompt.py rename to libs/langchain/langchain/chains/qa_generation/prompt.py diff --git a/langchain/chains/qa_with_sources/__init__.py b/libs/langchain/langchain/chains/qa_with_sources/__init__.py similarity index 100% rename from langchain/chains/qa_with_sources/__init__.py rename to libs/langchain/langchain/chains/qa_with_sources/__init__.py diff --git a/langchain/chains/qa_with_sources/base.py b/libs/langchain/langchain/chains/qa_with_sources/base.py similarity index 100% rename from langchain/chains/qa_with_sources/base.py rename to libs/langchain/langchain/chains/qa_with_sources/base.py diff --git a/langchain/chains/qa_with_sources/loading.py b/libs/langchain/langchain/chains/qa_with_sources/loading.py similarity index 100% rename from langchain/chains/qa_with_sources/loading.py rename to libs/langchain/langchain/chains/qa_with_sources/loading.py diff --git a/langchain/chains/qa_with_sources/map_reduce_prompt.py b/libs/langchain/langchain/chains/qa_with_sources/map_reduce_prompt.py similarity index 100% rename from langchain/chains/qa_with_sources/map_reduce_prompt.py rename to libs/langchain/langchain/chains/qa_with_sources/map_reduce_prompt.py diff --git a/langchain/chains/qa_with_sources/refine_prompts.py b/libs/langchain/langchain/chains/qa_with_sources/refine_prompts.py similarity index 100% rename from langchain/chains/qa_with_sources/refine_prompts.py rename to libs/langchain/langchain/chains/qa_with_sources/refine_prompts.py diff --git a/langchain/chains/qa_with_sources/retrieval.py b/libs/langchain/langchain/chains/qa_with_sources/retrieval.py similarity index 100% rename from langchain/chains/qa_with_sources/retrieval.py rename to libs/langchain/langchain/chains/qa_with_sources/retrieval.py diff --git a/langchain/chains/qa_with_sources/stuff_prompt.py b/libs/langchain/langchain/chains/qa_with_sources/stuff_prompt.py similarity index 100% rename from langchain/chains/qa_with_sources/stuff_prompt.py rename to libs/langchain/langchain/chains/qa_with_sources/stuff_prompt.py diff --git a/langchain/chains/qa_with_sources/vector_db.py b/libs/langchain/langchain/chains/qa_with_sources/vector_db.py similarity index 100% rename from langchain/chains/qa_with_sources/vector_db.py rename to libs/langchain/langchain/chains/qa_with_sources/vector_db.py diff --git a/langchain/chains/query_constructor/__init__.py b/libs/langchain/langchain/chains/query_constructor/__init__.py similarity index 100% rename from langchain/chains/query_constructor/__init__.py rename to libs/langchain/langchain/chains/query_constructor/__init__.py diff --git a/langchain/chains/query_constructor/base.py b/libs/langchain/langchain/chains/query_constructor/base.py similarity index 100% rename from langchain/chains/query_constructor/base.py rename to libs/langchain/langchain/chains/query_constructor/base.py diff --git a/langchain/chains/query_constructor/ir.py b/libs/langchain/langchain/chains/query_constructor/ir.py similarity index 100% rename from langchain/chains/query_constructor/ir.py rename to libs/langchain/langchain/chains/query_constructor/ir.py diff --git a/langchain/chains/query_constructor/parser.py b/libs/langchain/langchain/chains/query_constructor/parser.py similarity index 100% rename from langchain/chains/query_constructor/parser.py rename to libs/langchain/langchain/chains/query_constructor/parser.py diff --git a/langchain/chains/query_constructor/prompt.py b/libs/langchain/langchain/chains/query_constructor/prompt.py similarity index 100% rename from langchain/chains/query_constructor/prompt.py rename to libs/langchain/langchain/chains/query_constructor/prompt.py diff --git a/langchain/chains/query_constructor/schema.py b/libs/langchain/langchain/chains/query_constructor/schema.py similarity index 100% rename from langchain/chains/query_constructor/schema.py rename to libs/langchain/langchain/chains/query_constructor/schema.py diff --git a/langchain/chains/question_answering/__init__.py b/libs/langchain/langchain/chains/question_answering/__init__.py similarity index 100% rename from langchain/chains/question_answering/__init__.py rename to libs/langchain/langchain/chains/question_answering/__init__.py diff --git a/langchain/chains/question_answering/map_reduce_prompt.py b/libs/langchain/langchain/chains/question_answering/map_reduce_prompt.py similarity index 100% rename from langchain/chains/question_answering/map_reduce_prompt.py rename to libs/langchain/langchain/chains/question_answering/map_reduce_prompt.py diff --git a/langchain/chains/question_answering/map_rerank_prompt.py b/libs/langchain/langchain/chains/question_answering/map_rerank_prompt.py similarity index 100% rename from langchain/chains/question_answering/map_rerank_prompt.py rename to libs/langchain/langchain/chains/question_answering/map_rerank_prompt.py diff --git a/langchain/chains/question_answering/refine_prompts.py b/libs/langchain/langchain/chains/question_answering/refine_prompts.py similarity index 100% rename from langchain/chains/question_answering/refine_prompts.py rename to libs/langchain/langchain/chains/question_answering/refine_prompts.py diff --git a/langchain/chains/question_answering/stuff_prompt.py b/libs/langchain/langchain/chains/question_answering/stuff_prompt.py similarity index 100% rename from langchain/chains/question_answering/stuff_prompt.py rename to libs/langchain/langchain/chains/question_answering/stuff_prompt.py diff --git a/langchain/chains/retrieval_qa/__init__.py b/libs/langchain/langchain/chains/retrieval_qa/__init__.py similarity index 100% rename from langchain/chains/retrieval_qa/__init__.py rename to libs/langchain/langchain/chains/retrieval_qa/__init__.py diff --git a/langchain/chains/retrieval_qa/base.py b/libs/langchain/langchain/chains/retrieval_qa/base.py similarity index 100% rename from langchain/chains/retrieval_qa/base.py rename to libs/langchain/langchain/chains/retrieval_qa/base.py diff --git a/langchain/chains/retrieval_qa/prompt.py b/libs/langchain/langchain/chains/retrieval_qa/prompt.py similarity index 100% rename from langchain/chains/retrieval_qa/prompt.py rename to libs/langchain/langchain/chains/retrieval_qa/prompt.py diff --git a/langchain/chains/router/__init__.py b/libs/langchain/langchain/chains/router/__init__.py similarity index 100% rename from langchain/chains/router/__init__.py rename to libs/langchain/langchain/chains/router/__init__.py diff --git a/langchain/chains/router/base.py b/libs/langchain/langchain/chains/router/base.py similarity index 100% rename from langchain/chains/router/base.py rename to libs/langchain/langchain/chains/router/base.py diff --git a/langchain/chains/router/embedding_router.py b/libs/langchain/langchain/chains/router/embedding_router.py similarity index 100% rename from langchain/chains/router/embedding_router.py rename to libs/langchain/langchain/chains/router/embedding_router.py diff --git a/langchain/chains/router/llm_router.py b/libs/langchain/langchain/chains/router/llm_router.py similarity index 100% rename from langchain/chains/router/llm_router.py rename to libs/langchain/langchain/chains/router/llm_router.py diff --git a/langchain/chains/router/multi_prompt.py b/libs/langchain/langchain/chains/router/multi_prompt.py similarity index 100% rename from langchain/chains/router/multi_prompt.py rename to libs/langchain/langchain/chains/router/multi_prompt.py diff --git a/langchain/chains/router/multi_prompt_prompt.py b/libs/langchain/langchain/chains/router/multi_prompt_prompt.py similarity index 100% rename from langchain/chains/router/multi_prompt_prompt.py rename to libs/langchain/langchain/chains/router/multi_prompt_prompt.py diff --git a/langchain/chains/router/multi_retrieval_prompt.py b/libs/langchain/langchain/chains/router/multi_retrieval_prompt.py similarity index 100% rename from langchain/chains/router/multi_retrieval_prompt.py rename to libs/langchain/langchain/chains/router/multi_retrieval_prompt.py diff --git a/langchain/chains/router/multi_retrieval_qa.py b/libs/langchain/langchain/chains/router/multi_retrieval_qa.py similarity index 100% rename from langchain/chains/router/multi_retrieval_qa.py rename to libs/langchain/langchain/chains/router/multi_retrieval_qa.py diff --git a/langchain/chains/sequential.py b/libs/langchain/langchain/chains/sequential.py similarity index 100% rename from langchain/chains/sequential.py rename to libs/langchain/langchain/chains/sequential.py diff --git a/langchain/chains/sql_database/__init__.py b/libs/langchain/langchain/chains/sql_database/__init__.py similarity index 100% rename from langchain/chains/sql_database/__init__.py rename to libs/langchain/langchain/chains/sql_database/__init__.py diff --git a/langchain/chains/sql_database/base.py b/libs/langchain/langchain/chains/sql_database/base.py similarity index 100% rename from langchain/chains/sql_database/base.py rename to libs/langchain/langchain/chains/sql_database/base.py diff --git a/langchain/chains/sql_database/prompt.py b/libs/langchain/langchain/chains/sql_database/prompt.py similarity index 100% rename from langchain/chains/sql_database/prompt.py rename to libs/langchain/langchain/chains/sql_database/prompt.py diff --git a/langchain/chains/summarize/__init__.py b/libs/langchain/langchain/chains/summarize/__init__.py similarity index 100% rename from langchain/chains/summarize/__init__.py rename to libs/langchain/langchain/chains/summarize/__init__.py diff --git a/langchain/chains/summarize/map_reduce_prompt.py b/libs/langchain/langchain/chains/summarize/map_reduce_prompt.py similarity index 100% rename from langchain/chains/summarize/map_reduce_prompt.py rename to libs/langchain/langchain/chains/summarize/map_reduce_prompt.py diff --git a/langchain/chains/summarize/refine_prompts.py b/libs/langchain/langchain/chains/summarize/refine_prompts.py similarity index 100% rename from langchain/chains/summarize/refine_prompts.py rename to libs/langchain/langchain/chains/summarize/refine_prompts.py diff --git a/langchain/chains/summarize/stuff_prompt.py b/libs/langchain/langchain/chains/summarize/stuff_prompt.py similarity index 100% rename from langchain/chains/summarize/stuff_prompt.py rename to libs/langchain/langchain/chains/summarize/stuff_prompt.py diff --git a/langchain/chains/transform.py b/libs/langchain/langchain/chains/transform.py similarity index 100% rename from langchain/chains/transform.py rename to libs/langchain/langchain/chains/transform.py diff --git a/langchain/chat_models/__init__.py b/libs/langchain/langchain/chat_models/__init__.py similarity index 100% rename from langchain/chat_models/__init__.py rename to libs/langchain/langchain/chat_models/__init__.py diff --git a/langchain/chat_models/anthropic.py b/libs/langchain/langchain/chat_models/anthropic.py similarity index 100% rename from langchain/chat_models/anthropic.py rename to libs/langchain/langchain/chat_models/anthropic.py diff --git a/langchain/chat_models/azure_openai.py b/libs/langchain/langchain/chat_models/azure_openai.py similarity index 100% rename from langchain/chat_models/azure_openai.py rename to libs/langchain/langchain/chat_models/azure_openai.py diff --git a/langchain/chat_models/base.py b/libs/langchain/langchain/chat_models/base.py similarity index 100% rename from langchain/chat_models/base.py rename to libs/langchain/langchain/chat_models/base.py diff --git a/langchain/chat_models/fake.py b/libs/langchain/langchain/chat_models/fake.py similarity index 100% rename from langchain/chat_models/fake.py rename to libs/langchain/langchain/chat_models/fake.py diff --git a/langchain/chat_models/google_palm.py b/libs/langchain/langchain/chat_models/google_palm.py similarity index 100% rename from langchain/chat_models/google_palm.py rename to libs/langchain/langchain/chat_models/google_palm.py diff --git a/langchain/chat_models/human.py b/libs/langchain/langchain/chat_models/human.py similarity index 100% rename from langchain/chat_models/human.py rename to libs/langchain/langchain/chat_models/human.py diff --git a/langchain/chat_models/jinachat.py b/libs/langchain/langchain/chat_models/jinachat.py similarity index 100% rename from langchain/chat_models/jinachat.py rename to libs/langchain/langchain/chat_models/jinachat.py diff --git a/langchain/chat_models/openai.py b/libs/langchain/langchain/chat_models/openai.py similarity index 100% rename from langchain/chat_models/openai.py rename to libs/langchain/langchain/chat_models/openai.py diff --git a/langchain/chat_models/promptlayer_openai.py b/libs/langchain/langchain/chat_models/promptlayer_openai.py similarity index 100% rename from langchain/chat_models/promptlayer_openai.py rename to libs/langchain/langchain/chat_models/promptlayer_openai.py diff --git a/langchain/chat_models/vertexai.py b/libs/langchain/langchain/chat_models/vertexai.py similarity index 100% rename from langchain/chat_models/vertexai.py rename to libs/langchain/langchain/chat_models/vertexai.py diff --git a/langchain/docker-compose.yaml b/libs/langchain/langchain/docker-compose.yaml similarity index 100% rename from langchain/docker-compose.yaml rename to libs/langchain/langchain/docker-compose.yaml diff --git a/langchain/docstore/__init__.py b/libs/langchain/langchain/docstore/__init__.py similarity index 100% rename from langchain/docstore/__init__.py rename to libs/langchain/langchain/docstore/__init__.py diff --git a/langchain/docstore/arbitrary_fn.py b/libs/langchain/langchain/docstore/arbitrary_fn.py similarity index 100% rename from langchain/docstore/arbitrary_fn.py rename to libs/langchain/langchain/docstore/arbitrary_fn.py diff --git a/langchain/docstore/base.py b/libs/langchain/langchain/docstore/base.py similarity index 100% rename from langchain/docstore/base.py rename to libs/langchain/langchain/docstore/base.py diff --git a/langchain/docstore/document.py b/libs/langchain/langchain/docstore/document.py similarity index 100% rename from langchain/docstore/document.py rename to libs/langchain/langchain/docstore/document.py diff --git a/langchain/docstore/in_memory.py b/libs/langchain/langchain/docstore/in_memory.py similarity index 100% rename from langchain/docstore/in_memory.py rename to libs/langchain/langchain/docstore/in_memory.py diff --git a/langchain/docstore/wikipedia.py b/libs/langchain/langchain/docstore/wikipedia.py similarity index 100% rename from langchain/docstore/wikipedia.py rename to libs/langchain/langchain/docstore/wikipedia.py diff --git a/langchain/document_loaders/__init__.py b/libs/langchain/langchain/document_loaders/__init__.py similarity index 100% rename from langchain/document_loaders/__init__.py rename to libs/langchain/langchain/document_loaders/__init__.py diff --git a/langchain/document_loaders/acreom.py b/libs/langchain/langchain/document_loaders/acreom.py similarity index 100% rename from langchain/document_loaders/acreom.py rename to libs/langchain/langchain/document_loaders/acreom.py diff --git a/langchain/document_loaders/airbyte_json.py b/libs/langchain/langchain/document_loaders/airbyte_json.py similarity index 100% rename from langchain/document_loaders/airbyte_json.py rename to libs/langchain/langchain/document_loaders/airbyte_json.py diff --git a/langchain/document_loaders/airtable.py b/libs/langchain/langchain/document_loaders/airtable.py similarity index 100% rename from langchain/document_loaders/airtable.py rename to libs/langchain/langchain/document_loaders/airtable.py diff --git a/langchain/document_loaders/apify_dataset.py b/libs/langchain/langchain/document_loaders/apify_dataset.py similarity index 100% rename from langchain/document_loaders/apify_dataset.py rename to libs/langchain/langchain/document_loaders/apify_dataset.py diff --git a/langchain/document_loaders/arxiv.py b/libs/langchain/langchain/document_loaders/arxiv.py similarity index 100% rename from langchain/document_loaders/arxiv.py rename to libs/langchain/langchain/document_loaders/arxiv.py diff --git a/langchain/document_loaders/azlyrics.py b/libs/langchain/langchain/document_loaders/azlyrics.py similarity index 100% rename from langchain/document_loaders/azlyrics.py rename to libs/langchain/langchain/document_loaders/azlyrics.py diff --git a/langchain/document_loaders/azure_blob_storage_container.py b/libs/langchain/langchain/document_loaders/azure_blob_storage_container.py similarity index 100% rename from langchain/document_loaders/azure_blob_storage_container.py rename to libs/langchain/langchain/document_loaders/azure_blob_storage_container.py diff --git a/langchain/document_loaders/azure_blob_storage_file.py b/libs/langchain/langchain/document_loaders/azure_blob_storage_file.py similarity index 100% rename from langchain/document_loaders/azure_blob_storage_file.py rename to libs/langchain/langchain/document_loaders/azure_blob_storage_file.py diff --git a/langchain/document_loaders/base.py b/libs/langchain/langchain/document_loaders/base.py similarity index 100% rename from langchain/document_loaders/base.py rename to libs/langchain/langchain/document_loaders/base.py diff --git a/langchain/document_loaders/bibtex.py b/libs/langchain/langchain/document_loaders/bibtex.py similarity index 100% rename from langchain/document_loaders/bibtex.py rename to libs/langchain/langchain/document_loaders/bibtex.py diff --git a/langchain/document_loaders/bigquery.py b/libs/langchain/langchain/document_loaders/bigquery.py similarity index 100% rename from langchain/document_loaders/bigquery.py rename to libs/langchain/langchain/document_loaders/bigquery.py diff --git a/langchain/document_loaders/bilibili.py b/libs/langchain/langchain/document_loaders/bilibili.py similarity index 100% rename from langchain/document_loaders/bilibili.py rename to libs/langchain/langchain/document_loaders/bilibili.py diff --git a/langchain/document_loaders/blackboard.py b/libs/langchain/langchain/document_loaders/blackboard.py similarity index 100% rename from langchain/document_loaders/blackboard.py rename to libs/langchain/langchain/document_loaders/blackboard.py diff --git a/langchain/document_loaders/blob_loaders/__init__.py b/libs/langchain/langchain/document_loaders/blob_loaders/__init__.py similarity index 100% rename from langchain/document_loaders/blob_loaders/__init__.py rename to libs/langchain/langchain/document_loaders/blob_loaders/__init__.py diff --git a/langchain/document_loaders/blob_loaders/file_system.py b/libs/langchain/langchain/document_loaders/blob_loaders/file_system.py similarity index 100% rename from langchain/document_loaders/blob_loaders/file_system.py rename to libs/langchain/langchain/document_loaders/blob_loaders/file_system.py diff --git a/langchain/document_loaders/blob_loaders/schema.py b/libs/langchain/langchain/document_loaders/blob_loaders/schema.py similarity index 100% rename from langchain/document_loaders/blob_loaders/schema.py rename to libs/langchain/langchain/document_loaders/blob_loaders/schema.py diff --git a/langchain/document_loaders/blob_loaders/youtube_audio.py b/libs/langchain/langchain/document_loaders/blob_loaders/youtube_audio.py similarity index 100% rename from langchain/document_loaders/blob_loaders/youtube_audio.py rename to libs/langchain/langchain/document_loaders/blob_loaders/youtube_audio.py diff --git a/langchain/document_loaders/blockchain.py b/libs/langchain/langchain/document_loaders/blockchain.py similarity index 100% rename from langchain/document_loaders/blockchain.py rename to libs/langchain/langchain/document_loaders/blockchain.py diff --git a/langchain/document_loaders/brave_search.py b/libs/langchain/langchain/document_loaders/brave_search.py similarity index 100% rename from langchain/document_loaders/brave_search.py rename to libs/langchain/langchain/document_loaders/brave_search.py diff --git a/langchain/document_loaders/browserless.py b/libs/langchain/langchain/document_loaders/browserless.py similarity index 100% rename from langchain/document_loaders/browserless.py rename to libs/langchain/langchain/document_loaders/browserless.py diff --git a/langchain/document_loaders/chatgpt.py b/libs/langchain/langchain/document_loaders/chatgpt.py similarity index 100% rename from langchain/document_loaders/chatgpt.py rename to libs/langchain/langchain/document_loaders/chatgpt.py diff --git a/langchain/document_loaders/college_confidential.py b/libs/langchain/langchain/document_loaders/college_confidential.py similarity index 100% rename from langchain/document_loaders/college_confidential.py rename to libs/langchain/langchain/document_loaders/college_confidential.py diff --git a/langchain/document_loaders/confluence.py b/libs/langchain/langchain/document_loaders/confluence.py similarity index 100% rename from langchain/document_loaders/confluence.py rename to libs/langchain/langchain/document_loaders/confluence.py diff --git a/langchain/document_loaders/conllu.py b/libs/langchain/langchain/document_loaders/conllu.py similarity index 97% rename from langchain/document_loaders/conllu.py rename to libs/langchain/langchain/document_loaders/conllu.py index 939ada20750..d22c8500d2f 100644 --- a/langchain/document_loaders/conllu.py +++ b/libs/langchain/langchain/document_loaders/conllu.py @@ -1,33 +1,33 @@ -"""Load CoNLL-U files.""" -import csv -from typing import List - -from langchain.docstore.document import Document -from langchain.document_loaders.base import BaseLoader - - -class CoNLLULoader(BaseLoader): - """Load CoNLL-U files.""" - - def __init__(self, file_path: str): - """Initialize with a file path.""" - self.file_path = file_path - - def load(self) -> List[Document]: - """Load from a file path.""" - with open(self.file_path, encoding="utf8") as f: - tsv = list(csv.reader(f, delimiter="\t")) - - # If len(line) > 1, the line is not a comment - lines = [line for line in tsv if len(line) > 1] - - text = "" - for i, line in enumerate(lines): - # Do not add a space after a punctuation mark or at the end of the sentence - if line[9] == "SpaceAfter=No" or i == len(lines) - 1: - text += line[1] - else: - text += line[1] + " " - - metadata = {"source": self.file_path} - return [Document(page_content=text, metadata=metadata)] +"""Load CoNLL-U files.""" +import csv +from typing import List + +from langchain.docstore.document import Document +from langchain.document_loaders.base import BaseLoader + + +class CoNLLULoader(BaseLoader): + """Load CoNLL-U files.""" + + def __init__(self, file_path: str): + """Initialize with a file path.""" + self.file_path = file_path + + def load(self) -> List[Document]: + """Load from a file path.""" + with open(self.file_path, encoding="utf8") as f: + tsv = list(csv.reader(f, delimiter="\t")) + + # If len(line) > 1, the line is not a comment + lines = [line for line in tsv if len(line) > 1] + + text = "" + for i, line in enumerate(lines): + # Do not add a space after a punctuation mark or at the end of the sentence + if line[9] == "SpaceAfter=No" or i == len(lines) - 1: + text += line[1] + else: + text += line[1] + " " + + metadata = {"source": self.file_path} + return [Document(page_content=text, metadata=metadata)] diff --git a/langchain/document_loaders/csv_loader.py b/libs/langchain/langchain/document_loaders/csv_loader.py similarity index 100% rename from langchain/document_loaders/csv_loader.py rename to libs/langchain/langchain/document_loaders/csv_loader.py diff --git a/langchain/document_loaders/cube_semantic.py b/libs/langchain/langchain/document_loaders/cube_semantic.py similarity index 100% rename from langchain/document_loaders/cube_semantic.py rename to libs/langchain/langchain/document_loaders/cube_semantic.py diff --git a/langchain/document_loaders/datadog_logs.py b/libs/langchain/langchain/document_loaders/datadog_logs.py similarity index 100% rename from langchain/document_loaders/datadog_logs.py rename to libs/langchain/langchain/document_loaders/datadog_logs.py diff --git a/langchain/document_loaders/dataframe.py b/libs/langchain/langchain/document_loaders/dataframe.py similarity index 100% rename from langchain/document_loaders/dataframe.py rename to libs/langchain/langchain/document_loaders/dataframe.py diff --git a/langchain/document_loaders/diffbot.py b/libs/langchain/langchain/document_loaders/diffbot.py similarity index 100% rename from langchain/document_loaders/diffbot.py rename to libs/langchain/langchain/document_loaders/diffbot.py diff --git a/langchain/document_loaders/directory.py b/libs/langchain/langchain/document_loaders/directory.py similarity index 100% rename from langchain/document_loaders/directory.py rename to libs/langchain/langchain/document_loaders/directory.py diff --git a/langchain/document_loaders/discord.py b/libs/langchain/langchain/document_loaders/discord.py similarity index 100% rename from langchain/document_loaders/discord.py rename to libs/langchain/langchain/document_loaders/discord.py diff --git a/langchain/document_loaders/docugami.py b/libs/langchain/langchain/document_loaders/docugami.py similarity index 100% rename from langchain/document_loaders/docugami.py rename to libs/langchain/langchain/document_loaders/docugami.py diff --git a/langchain/document_loaders/duckdb_loader.py b/libs/langchain/langchain/document_loaders/duckdb_loader.py similarity index 100% rename from langchain/document_loaders/duckdb_loader.py rename to libs/langchain/langchain/document_loaders/duckdb_loader.py diff --git a/langchain/document_loaders/email.py b/libs/langchain/langchain/document_loaders/email.py similarity index 100% rename from langchain/document_loaders/email.py rename to libs/langchain/langchain/document_loaders/email.py diff --git a/langchain/document_loaders/embaas.py b/libs/langchain/langchain/document_loaders/embaas.py similarity index 100% rename from langchain/document_loaders/embaas.py rename to libs/langchain/langchain/document_loaders/embaas.py diff --git a/langchain/document_loaders/epub.py b/libs/langchain/langchain/document_loaders/epub.py similarity index 100% rename from langchain/document_loaders/epub.py rename to libs/langchain/langchain/document_loaders/epub.py diff --git a/langchain/document_loaders/evernote.py b/libs/langchain/langchain/document_loaders/evernote.py similarity index 100% rename from langchain/document_loaders/evernote.py rename to libs/langchain/langchain/document_loaders/evernote.py diff --git a/langchain/document_loaders/excel.py b/libs/langchain/langchain/document_loaders/excel.py similarity index 100% rename from langchain/document_loaders/excel.py rename to libs/langchain/langchain/document_loaders/excel.py diff --git a/langchain/document_loaders/facebook_chat.py b/libs/langchain/langchain/document_loaders/facebook_chat.py similarity index 100% rename from langchain/document_loaders/facebook_chat.py rename to libs/langchain/langchain/document_loaders/facebook_chat.py diff --git a/langchain/document_loaders/fauna.py b/libs/langchain/langchain/document_loaders/fauna.py similarity index 100% rename from langchain/document_loaders/fauna.py rename to libs/langchain/langchain/document_loaders/fauna.py diff --git a/langchain/document_loaders/figma.py b/libs/langchain/langchain/document_loaders/figma.py similarity index 100% rename from langchain/document_loaders/figma.py rename to libs/langchain/langchain/document_loaders/figma.py diff --git a/langchain/document_loaders/gcs_directory.py b/libs/langchain/langchain/document_loaders/gcs_directory.py similarity index 100% rename from langchain/document_loaders/gcs_directory.py rename to libs/langchain/langchain/document_loaders/gcs_directory.py diff --git a/langchain/document_loaders/gcs_file.py b/libs/langchain/langchain/document_loaders/gcs_file.py similarity index 100% rename from langchain/document_loaders/gcs_file.py rename to libs/langchain/langchain/document_loaders/gcs_file.py diff --git a/langchain/document_loaders/generic.py b/libs/langchain/langchain/document_loaders/generic.py similarity index 100% rename from langchain/document_loaders/generic.py rename to libs/langchain/langchain/document_loaders/generic.py diff --git a/langchain/document_loaders/git.py b/libs/langchain/langchain/document_loaders/git.py similarity index 100% rename from langchain/document_loaders/git.py rename to libs/langchain/langchain/document_loaders/git.py diff --git a/langchain/document_loaders/gitbook.py b/libs/langchain/langchain/document_loaders/gitbook.py similarity index 100% rename from langchain/document_loaders/gitbook.py rename to libs/langchain/langchain/document_loaders/gitbook.py diff --git a/langchain/document_loaders/github.py b/libs/langchain/langchain/document_loaders/github.py similarity index 100% rename from langchain/document_loaders/github.py rename to libs/langchain/langchain/document_loaders/github.py diff --git a/langchain/document_loaders/googledrive.py b/libs/langchain/langchain/document_loaders/googledrive.py similarity index 100% rename from langchain/document_loaders/googledrive.py rename to libs/langchain/langchain/document_loaders/googledrive.py diff --git a/langchain/document_loaders/gutenberg.py b/libs/langchain/langchain/document_loaders/gutenberg.py similarity index 100% rename from langchain/document_loaders/gutenberg.py rename to libs/langchain/langchain/document_loaders/gutenberg.py diff --git a/langchain/document_loaders/helpers.py b/libs/langchain/langchain/document_loaders/helpers.py similarity index 100% rename from langchain/document_loaders/helpers.py rename to libs/langchain/langchain/document_loaders/helpers.py diff --git a/langchain/document_loaders/hn.py b/libs/langchain/langchain/document_loaders/hn.py similarity index 100% rename from langchain/document_loaders/hn.py rename to libs/langchain/langchain/document_loaders/hn.py diff --git a/langchain/document_loaders/html.py b/libs/langchain/langchain/document_loaders/html.py similarity index 100% rename from langchain/document_loaders/html.py rename to libs/langchain/langchain/document_loaders/html.py diff --git a/langchain/document_loaders/html_bs.py b/libs/langchain/langchain/document_loaders/html_bs.py similarity index 100% rename from langchain/document_loaders/html_bs.py rename to libs/langchain/langchain/document_loaders/html_bs.py diff --git a/langchain/document_loaders/hugging_face_dataset.py b/libs/langchain/langchain/document_loaders/hugging_face_dataset.py similarity index 100% rename from langchain/document_loaders/hugging_face_dataset.py rename to libs/langchain/langchain/document_loaders/hugging_face_dataset.py diff --git a/langchain/document_loaders/ifixit.py b/libs/langchain/langchain/document_loaders/ifixit.py similarity index 100% rename from langchain/document_loaders/ifixit.py rename to libs/langchain/langchain/document_loaders/ifixit.py diff --git a/langchain/document_loaders/image.py b/libs/langchain/langchain/document_loaders/image.py similarity index 100% rename from langchain/document_loaders/image.py rename to libs/langchain/langchain/document_loaders/image.py diff --git a/langchain/document_loaders/image_captions.py b/libs/langchain/langchain/document_loaders/image_captions.py similarity index 100% rename from langchain/document_loaders/image_captions.py rename to libs/langchain/langchain/document_loaders/image_captions.py diff --git a/langchain/document_loaders/imsdb.py b/libs/langchain/langchain/document_loaders/imsdb.py similarity index 100% rename from langchain/document_loaders/imsdb.py rename to libs/langchain/langchain/document_loaders/imsdb.py diff --git a/langchain/document_loaders/iugu.py b/libs/langchain/langchain/document_loaders/iugu.py similarity index 100% rename from langchain/document_loaders/iugu.py rename to libs/langchain/langchain/document_loaders/iugu.py diff --git a/langchain/document_loaders/joplin.py b/libs/langchain/langchain/document_loaders/joplin.py similarity index 100% rename from langchain/document_loaders/joplin.py rename to libs/langchain/langchain/document_loaders/joplin.py diff --git a/langchain/document_loaders/json_loader.py b/libs/langchain/langchain/document_loaders/json_loader.py similarity index 100% rename from langchain/document_loaders/json_loader.py rename to libs/langchain/langchain/document_loaders/json_loader.py diff --git a/langchain/document_loaders/larksuite.py b/libs/langchain/langchain/document_loaders/larksuite.py similarity index 100% rename from langchain/document_loaders/larksuite.py rename to libs/langchain/langchain/document_loaders/larksuite.py diff --git a/langchain/document_loaders/markdown.py b/libs/langchain/langchain/document_loaders/markdown.py similarity index 100% rename from langchain/document_loaders/markdown.py rename to libs/langchain/langchain/document_loaders/markdown.py diff --git a/langchain/document_loaders/mastodon.py b/libs/langchain/langchain/document_loaders/mastodon.py similarity index 100% rename from langchain/document_loaders/mastodon.py rename to libs/langchain/langchain/document_loaders/mastodon.py diff --git a/langchain/document_loaders/max_compute.py b/libs/langchain/langchain/document_loaders/max_compute.py similarity index 100% rename from langchain/document_loaders/max_compute.py rename to libs/langchain/langchain/document_loaders/max_compute.py diff --git a/langchain/document_loaders/mediawikidump.py b/libs/langchain/langchain/document_loaders/mediawikidump.py similarity index 100% rename from langchain/document_loaders/mediawikidump.py rename to libs/langchain/langchain/document_loaders/mediawikidump.py diff --git a/langchain/document_loaders/merge.py b/libs/langchain/langchain/document_loaders/merge.py similarity index 100% rename from langchain/document_loaders/merge.py rename to libs/langchain/langchain/document_loaders/merge.py diff --git a/langchain/document_loaders/mhtml.py b/libs/langchain/langchain/document_loaders/mhtml.py similarity index 100% rename from langchain/document_loaders/mhtml.py rename to libs/langchain/langchain/document_loaders/mhtml.py diff --git a/langchain/document_loaders/modern_treasury.py b/libs/langchain/langchain/document_loaders/modern_treasury.py similarity index 100% rename from langchain/document_loaders/modern_treasury.py rename to libs/langchain/langchain/document_loaders/modern_treasury.py diff --git a/langchain/document_loaders/notebook.py b/libs/langchain/langchain/document_loaders/notebook.py similarity index 100% rename from langchain/document_loaders/notebook.py rename to libs/langchain/langchain/document_loaders/notebook.py diff --git a/langchain/document_loaders/notion.py b/libs/langchain/langchain/document_loaders/notion.py similarity index 100% rename from langchain/document_loaders/notion.py rename to libs/langchain/langchain/document_loaders/notion.py diff --git a/langchain/document_loaders/notiondb.py b/libs/langchain/langchain/document_loaders/notiondb.py similarity index 100% rename from langchain/document_loaders/notiondb.py rename to libs/langchain/langchain/document_loaders/notiondb.py diff --git a/langchain/document_loaders/obsidian.py b/libs/langchain/langchain/document_loaders/obsidian.py similarity index 100% rename from langchain/document_loaders/obsidian.py rename to libs/langchain/langchain/document_loaders/obsidian.py diff --git a/langchain/document_loaders/odt.py b/libs/langchain/langchain/document_loaders/odt.py similarity index 100% rename from langchain/document_loaders/odt.py rename to libs/langchain/langchain/document_loaders/odt.py diff --git a/langchain/document_loaders/onedrive.py b/libs/langchain/langchain/document_loaders/onedrive.py similarity index 100% rename from langchain/document_loaders/onedrive.py rename to libs/langchain/langchain/document_loaders/onedrive.py diff --git a/langchain/document_loaders/onedrive_file.py b/libs/langchain/langchain/document_loaders/onedrive_file.py similarity index 100% rename from langchain/document_loaders/onedrive_file.py rename to libs/langchain/langchain/document_loaders/onedrive_file.py diff --git a/langchain/document_loaders/open_city_data.py b/libs/langchain/langchain/document_loaders/open_city_data.py similarity index 100% rename from langchain/document_loaders/open_city_data.py rename to libs/langchain/langchain/document_loaders/open_city_data.py diff --git a/langchain/document_loaders/org_mode.py b/libs/langchain/langchain/document_loaders/org_mode.py similarity index 100% rename from langchain/document_loaders/org_mode.py rename to libs/langchain/langchain/document_loaders/org_mode.py diff --git a/langchain/document_loaders/parsers/__init__.py b/libs/langchain/langchain/document_loaders/parsers/__init__.py similarity index 100% rename from langchain/document_loaders/parsers/__init__.py rename to libs/langchain/langchain/document_loaders/parsers/__init__.py diff --git a/langchain/document_loaders/parsers/audio.py b/libs/langchain/langchain/document_loaders/parsers/audio.py similarity index 100% rename from langchain/document_loaders/parsers/audio.py rename to libs/langchain/langchain/document_loaders/parsers/audio.py diff --git a/langchain/document_loaders/parsers/generic.py b/libs/langchain/langchain/document_loaders/parsers/generic.py similarity index 100% rename from langchain/document_loaders/parsers/generic.py rename to libs/langchain/langchain/document_loaders/parsers/generic.py diff --git a/langchain/document_loaders/parsers/grobid.py b/libs/langchain/langchain/document_loaders/parsers/grobid.py similarity index 100% rename from langchain/document_loaders/parsers/grobid.py rename to libs/langchain/langchain/document_loaders/parsers/grobid.py diff --git a/langchain/document_loaders/parsers/html/__init__.py b/libs/langchain/langchain/document_loaders/parsers/html/__init__.py similarity index 100% rename from langchain/document_loaders/parsers/html/__init__.py rename to libs/langchain/langchain/document_loaders/parsers/html/__init__.py diff --git a/langchain/document_loaders/parsers/html/bs4.py b/libs/langchain/langchain/document_loaders/parsers/html/bs4.py similarity index 100% rename from langchain/document_loaders/parsers/html/bs4.py rename to libs/langchain/langchain/document_loaders/parsers/html/bs4.py diff --git a/langchain/document_loaders/parsers/language/__init__.py b/libs/langchain/langchain/document_loaders/parsers/language/__init__.py similarity index 100% rename from langchain/document_loaders/parsers/language/__init__.py rename to libs/langchain/langchain/document_loaders/parsers/language/__init__.py diff --git a/langchain/document_loaders/parsers/language/code_segmenter.py b/libs/langchain/langchain/document_loaders/parsers/language/code_segmenter.py similarity index 100% rename from langchain/document_loaders/parsers/language/code_segmenter.py rename to libs/langchain/langchain/document_loaders/parsers/language/code_segmenter.py diff --git a/langchain/document_loaders/parsers/language/javascript.py b/libs/langchain/langchain/document_loaders/parsers/language/javascript.py similarity index 100% rename from langchain/document_loaders/parsers/language/javascript.py rename to libs/langchain/langchain/document_loaders/parsers/language/javascript.py diff --git a/langchain/document_loaders/parsers/language/language_parser.py b/libs/langchain/langchain/document_loaders/parsers/language/language_parser.py similarity index 100% rename from langchain/document_loaders/parsers/language/language_parser.py rename to libs/langchain/langchain/document_loaders/parsers/language/language_parser.py diff --git a/langchain/document_loaders/parsers/language/python.py b/libs/langchain/langchain/document_loaders/parsers/language/python.py similarity index 100% rename from langchain/document_loaders/parsers/language/python.py rename to libs/langchain/langchain/document_loaders/parsers/language/python.py diff --git a/langchain/document_loaders/parsers/pdf.py b/libs/langchain/langchain/document_loaders/parsers/pdf.py similarity index 100% rename from langchain/document_loaders/parsers/pdf.py rename to libs/langchain/langchain/document_loaders/parsers/pdf.py diff --git a/langchain/document_loaders/parsers/registry.py b/libs/langchain/langchain/document_loaders/parsers/registry.py similarity index 100% rename from langchain/document_loaders/parsers/registry.py rename to libs/langchain/langchain/document_loaders/parsers/registry.py diff --git a/langchain/document_loaders/parsers/txt.py b/libs/langchain/langchain/document_loaders/parsers/txt.py similarity index 100% rename from langchain/document_loaders/parsers/txt.py rename to libs/langchain/langchain/document_loaders/parsers/txt.py diff --git a/langchain/document_loaders/pdf.py b/libs/langchain/langchain/document_loaders/pdf.py similarity index 100% rename from langchain/document_loaders/pdf.py rename to libs/langchain/langchain/document_loaders/pdf.py diff --git a/langchain/document_loaders/powerpoint.py b/libs/langchain/langchain/document_loaders/powerpoint.py similarity index 100% rename from langchain/document_loaders/powerpoint.py rename to libs/langchain/langchain/document_loaders/powerpoint.py diff --git a/langchain/document_loaders/psychic.py b/libs/langchain/langchain/document_loaders/psychic.py similarity index 100% rename from langchain/document_loaders/psychic.py rename to libs/langchain/langchain/document_loaders/psychic.py diff --git a/langchain/document_loaders/pyspark_dataframe.py b/libs/langchain/langchain/document_loaders/pyspark_dataframe.py similarity index 100% rename from langchain/document_loaders/pyspark_dataframe.py rename to libs/langchain/langchain/document_loaders/pyspark_dataframe.py diff --git a/langchain/document_loaders/python.py b/libs/langchain/langchain/document_loaders/python.py similarity index 100% rename from langchain/document_loaders/python.py rename to libs/langchain/langchain/document_loaders/python.py diff --git a/langchain/document_loaders/readthedocs.py b/libs/langchain/langchain/document_loaders/readthedocs.py similarity index 100% rename from langchain/document_loaders/readthedocs.py rename to libs/langchain/langchain/document_loaders/readthedocs.py diff --git a/langchain/document_loaders/recursive_url_loader.py b/libs/langchain/langchain/document_loaders/recursive_url_loader.py similarity index 100% rename from langchain/document_loaders/recursive_url_loader.py rename to libs/langchain/langchain/document_loaders/recursive_url_loader.py diff --git a/langchain/document_loaders/reddit.py b/libs/langchain/langchain/document_loaders/reddit.py similarity index 100% rename from langchain/document_loaders/reddit.py rename to libs/langchain/langchain/document_loaders/reddit.py diff --git a/langchain/document_loaders/roam.py b/libs/langchain/langchain/document_loaders/roam.py similarity index 100% rename from langchain/document_loaders/roam.py rename to libs/langchain/langchain/document_loaders/roam.py diff --git a/langchain/document_loaders/rocksetdb.py b/libs/langchain/langchain/document_loaders/rocksetdb.py similarity index 100% rename from langchain/document_loaders/rocksetdb.py rename to libs/langchain/langchain/document_loaders/rocksetdb.py diff --git a/langchain/document_loaders/rst.py b/libs/langchain/langchain/document_loaders/rst.py similarity index 100% rename from langchain/document_loaders/rst.py rename to libs/langchain/langchain/document_loaders/rst.py diff --git a/langchain/document_loaders/rtf.py b/libs/langchain/langchain/document_loaders/rtf.py similarity index 100% rename from langchain/document_loaders/rtf.py rename to libs/langchain/langchain/document_loaders/rtf.py diff --git a/langchain/document_loaders/s3_directory.py b/libs/langchain/langchain/document_loaders/s3_directory.py similarity index 100% rename from langchain/document_loaders/s3_directory.py rename to libs/langchain/langchain/document_loaders/s3_directory.py diff --git a/langchain/document_loaders/s3_file.py b/libs/langchain/langchain/document_loaders/s3_file.py similarity index 100% rename from langchain/document_loaders/s3_file.py rename to libs/langchain/langchain/document_loaders/s3_file.py diff --git a/langchain/document_loaders/sitemap.py b/libs/langchain/langchain/document_loaders/sitemap.py similarity index 100% rename from langchain/document_loaders/sitemap.py rename to libs/langchain/langchain/document_loaders/sitemap.py diff --git a/langchain/document_loaders/slack_directory.py b/libs/langchain/langchain/document_loaders/slack_directory.py similarity index 100% rename from langchain/document_loaders/slack_directory.py rename to libs/langchain/langchain/document_loaders/slack_directory.py diff --git a/langchain/document_loaders/snowflake_loader.py b/libs/langchain/langchain/document_loaders/snowflake_loader.py similarity index 97% rename from langchain/document_loaders/snowflake_loader.py rename to libs/langchain/langchain/document_loaders/snowflake_loader.py index 50219ce35b3..5ed676a248b 100644 --- a/langchain/document_loaders/snowflake_loader.py +++ b/libs/langchain/langchain/document_loaders/snowflake_loader.py @@ -1,127 +1,127 @@ -from __future__ import annotations - -from typing import Any, Dict, Iterator, List, Optional, Tuple - -from langchain.docstore.document import Document -from langchain.document_loaders.base import BaseLoader - - -class SnowflakeLoader(BaseLoader): - """Loads a query result from Snowflake into a list of documents. - - Each document represents one row of the result. The `page_content_columns` - are written into the `page_content` of the document. The `metadata_columns` - are written into the `metadata` of the document. By default, all columns - are written into the `page_content` and none into the `metadata`. - - """ - - def __init__( - self, - query: str, - user: str, - password: str, - account: str, - warehouse: str, - role: str, - database: str, - schema: str, - parameters: Optional[Dict[str, Any]] = None, - page_content_columns: Optional[List[str]] = None, - metadata_columns: Optional[List[str]] = None, - ): - """Initialize Snowflake document loader. - - Args: - query: The query to run in Snowflake. - user: Snowflake user. - password: Snowflake password. - account: Snowflake account. - warehouse: Snowflake warehouse. - role: Snowflake role. - database: Snowflake database - schema: Snowflake schema - parameters: Optional. Parameters to pass to the query. - page_content_columns: Optional. Columns written to Document `page_content`. - metadata_columns: Optional. Columns written to Document `metadata`. - """ - self.query = query - self.user = user - self.password = password - self.account = account - self.warehouse = warehouse - self.role = role - self.database = database - self.schema = schema - self.parameters = parameters - self.page_content_columns = ( - page_content_columns if page_content_columns is not None else ["*"] - ) - self.metadata_columns = metadata_columns if metadata_columns is not None else [] - - def _execute_query(self) -> List[Dict[str, Any]]: - try: - import snowflake.connector - except ImportError as ex: - raise ImportError( - "Could not import snowflake-connector-python package. " - "Please install it with `pip install snowflake-connector-python`." - ) from ex - - conn = snowflake.connector.connect( - user=self.user, - password=self.password, - account=self.account, - warehouse=self.warehouse, - role=self.role, - database=self.database, - schema=self.schema, - parameters=self.parameters, - ) - try: - cur = conn.cursor() - cur.execute("USE DATABASE " + self.database) - cur.execute("USE SCHEMA " + self.schema) - cur.execute(self.query, self.parameters) - query_result = cur.fetchall() - column_names = [column[0] for column in cur.description] - query_result = [dict(zip(column_names, row)) for row in query_result] - except Exception as e: - print(f"An error occurred: {e}") - query_result = [] - finally: - cur.close() - return query_result - - def _get_columns( - self, query_result: List[Dict[str, Any]] - ) -> Tuple[List[str], List[str]]: - page_content_columns = ( - self.page_content_columns if self.page_content_columns else [] - ) - metadata_columns = self.metadata_columns if self.metadata_columns else [] - if page_content_columns is None and query_result: - page_content_columns = list(query_result[0].keys()) - if metadata_columns is None: - metadata_columns = [] - return page_content_columns or [], metadata_columns - - def lazy_load(self) -> Iterator[Document]: - query_result = self._execute_query() - if isinstance(query_result, Exception): - print(f"An error occurred during the query: {query_result}") - return [] - page_content_columns, metadata_columns = self._get_columns(query_result) - if "*" in page_content_columns: - page_content_columns = list(query_result[0].keys()) - for row in query_result: - page_content = "\n".join( - f"{k}: {v}" for k, v in row.items() if k in page_content_columns - ) - metadata = {k: v for k, v in row.items() if k in metadata_columns} - doc = Document(page_content=page_content, metadata=metadata) - yield doc - - def load(self) -> List[Document]: - """Load data into document objects.""" - return list(self.lazy_load()) +from __future__ import annotations + +from typing import Any, Dict, Iterator, List, Optional, Tuple + +from langchain.docstore.document import Document +from langchain.document_loaders.base import BaseLoader + + +class SnowflakeLoader(BaseLoader): + """Loads a query result from Snowflake into a list of documents. + + Each document represents one row of the result. The `page_content_columns` + are written into the `page_content` of the document. The `metadata_columns` + are written into the `metadata` of the document. By default, all columns + are written into the `page_content` and none into the `metadata`. + + """ + + def __init__( + self, + query: str, + user: str, + password: str, + account: str, + warehouse: str, + role: str, + database: str, + schema: str, + parameters: Optional[Dict[str, Any]] = None, + page_content_columns: Optional[List[str]] = None, + metadata_columns: Optional[List[str]] = None, + ): + """Initialize Snowflake document loader. + + Args: + query: The query to run in Snowflake. + user: Snowflake user. + password: Snowflake password. + account: Snowflake account. + warehouse: Snowflake warehouse. + role: Snowflake role. + database: Snowflake database + schema: Snowflake schema + parameters: Optional. Parameters to pass to the query. + page_content_columns: Optional. Columns written to Document `page_content`. + metadata_columns: Optional. Columns written to Document `metadata`. + """ + self.query = query + self.user = user + self.password = password + self.account = account + self.warehouse = warehouse + self.role = role + self.database = database + self.schema = schema + self.parameters = parameters + self.page_content_columns = ( + page_content_columns if page_content_columns is not None else ["*"] + ) + self.metadata_columns = metadata_columns if metadata_columns is not None else [] + + def _execute_query(self) -> List[Dict[str, Any]]: + try: + import snowflake.connector + except ImportError as ex: + raise ImportError( + "Could not import snowflake-connector-python package. " + "Please install it with `pip install snowflake-connector-python`." + ) from ex + + conn = snowflake.connector.connect( + user=self.user, + password=self.password, + account=self.account, + warehouse=self.warehouse, + role=self.role, + database=self.database, + schema=self.schema, + parameters=self.parameters, + ) + try: + cur = conn.cursor() + cur.execute("USE DATABASE " + self.database) + cur.execute("USE SCHEMA " + self.schema) + cur.execute(self.query, self.parameters) + query_result = cur.fetchall() + column_names = [column[0] for column in cur.description] + query_result = [dict(zip(column_names, row)) for row in query_result] + except Exception as e: + print(f"An error occurred: {e}") + query_result = [] + finally: + cur.close() + return query_result + + def _get_columns( + self, query_result: List[Dict[str, Any]] + ) -> Tuple[List[str], List[str]]: + page_content_columns = ( + self.page_content_columns if self.page_content_columns else [] + ) + metadata_columns = self.metadata_columns if self.metadata_columns else [] + if page_content_columns is None and query_result: + page_content_columns = list(query_result[0].keys()) + if metadata_columns is None: + metadata_columns = [] + return page_content_columns or [], metadata_columns + + def lazy_load(self) -> Iterator[Document]: + query_result = self._execute_query() + if isinstance(query_result, Exception): + print(f"An error occurred during the query: {query_result}") + return [] + page_content_columns, metadata_columns = self._get_columns(query_result) + if "*" in page_content_columns: + page_content_columns = list(query_result[0].keys()) + for row in query_result: + page_content = "\n".join( + f"{k}: {v}" for k, v in row.items() if k in page_content_columns + ) + metadata = {k: v for k, v in row.items() if k in metadata_columns} + doc = Document(page_content=page_content, metadata=metadata) + yield doc + + def load(self) -> List[Document]: + """Load data into document objects.""" + return list(self.lazy_load()) diff --git a/langchain/document_loaders/spreedly.py b/libs/langchain/langchain/document_loaders/spreedly.py similarity index 100% rename from langchain/document_loaders/spreedly.py rename to libs/langchain/langchain/document_loaders/spreedly.py diff --git a/langchain/document_loaders/srt.py b/libs/langchain/langchain/document_loaders/srt.py similarity index 100% rename from langchain/document_loaders/srt.py rename to libs/langchain/langchain/document_loaders/srt.py diff --git a/langchain/document_loaders/stripe.py b/libs/langchain/langchain/document_loaders/stripe.py similarity index 100% rename from langchain/document_loaders/stripe.py rename to libs/langchain/langchain/document_loaders/stripe.py diff --git a/langchain/document_loaders/telegram.py b/libs/langchain/langchain/document_loaders/telegram.py similarity index 100% rename from langchain/document_loaders/telegram.py rename to libs/langchain/langchain/document_loaders/telegram.py diff --git a/langchain/document_loaders/tencent_cos_directory.py b/libs/langchain/langchain/document_loaders/tencent_cos_directory.py similarity index 100% rename from langchain/document_loaders/tencent_cos_directory.py rename to libs/langchain/langchain/document_loaders/tencent_cos_directory.py diff --git a/langchain/document_loaders/tencent_cos_file.py b/libs/langchain/langchain/document_loaders/tencent_cos_file.py similarity index 100% rename from langchain/document_loaders/tencent_cos_file.py rename to libs/langchain/langchain/document_loaders/tencent_cos_file.py diff --git a/langchain/document_loaders/text.py b/libs/langchain/langchain/document_loaders/text.py similarity index 100% rename from langchain/document_loaders/text.py rename to libs/langchain/langchain/document_loaders/text.py diff --git a/langchain/document_loaders/tomarkdown.py b/libs/langchain/langchain/document_loaders/tomarkdown.py similarity index 100% rename from langchain/document_loaders/tomarkdown.py rename to libs/langchain/langchain/document_loaders/tomarkdown.py diff --git a/langchain/document_loaders/toml.py b/libs/langchain/langchain/document_loaders/toml.py similarity index 100% rename from langchain/document_loaders/toml.py rename to libs/langchain/langchain/document_loaders/toml.py diff --git a/langchain/document_loaders/trello.py b/libs/langchain/langchain/document_loaders/trello.py similarity index 100% rename from langchain/document_loaders/trello.py rename to libs/langchain/langchain/document_loaders/trello.py diff --git a/langchain/document_loaders/tsv.py b/libs/langchain/langchain/document_loaders/tsv.py similarity index 100% rename from langchain/document_loaders/tsv.py rename to libs/langchain/langchain/document_loaders/tsv.py diff --git a/langchain/document_loaders/twitter.py b/libs/langchain/langchain/document_loaders/twitter.py similarity index 100% rename from langchain/document_loaders/twitter.py rename to libs/langchain/langchain/document_loaders/twitter.py diff --git a/langchain/document_loaders/unstructured.py b/libs/langchain/langchain/document_loaders/unstructured.py similarity index 100% rename from langchain/document_loaders/unstructured.py rename to libs/langchain/langchain/document_loaders/unstructured.py diff --git a/langchain/document_loaders/url.py b/libs/langchain/langchain/document_loaders/url.py similarity index 100% rename from langchain/document_loaders/url.py rename to libs/langchain/langchain/document_loaders/url.py diff --git a/langchain/document_loaders/url_playwright.py b/libs/langchain/langchain/document_loaders/url_playwright.py similarity index 100% rename from langchain/document_loaders/url_playwright.py rename to libs/langchain/langchain/document_loaders/url_playwright.py diff --git a/langchain/document_loaders/url_selenium.py b/libs/langchain/langchain/document_loaders/url_selenium.py similarity index 100% rename from langchain/document_loaders/url_selenium.py rename to libs/langchain/langchain/document_loaders/url_selenium.py diff --git a/langchain/document_loaders/weather.py b/libs/langchain/langchain/document_loaders/weather.py similarity index 100% rename from langchain/document_loaders/weather.py rename to libs/langchain/langchain/document_loaders/weather.py diff --git a/langchain/document_loaders/web_base.py b/libs/langchain/langchain/document_loaders/web_base.py similarity index 100% rename from langchain/document_loaders/web_base.py rename to libs/langchain/langchain/document_loaders/web_base.py diff --git a/langchain/document_loaders/whatsapp_chat.py b/libs/langchain/langchain/document_loaders/whatsapp_chat.py similarity index 100% rename from langchain/document_loaders/whatsapp_chat.py rename to libs/langchain/langchain/document_loaders/whatsapp_chat.py diff --git a/langchain/document_loaders/wikipedia.py b/libs/langchain/langchain/document_loaders/wikipedia.py similarity index 100% rename from langchain/document_loaders/wikipedia.py rename to libs/langchain/langchain/document_loaders/wikipedia.py diff --git a/langchain/document_loaders/word_document.py b/libs/langchain/langchain/document_loaders/word_document.py similarity index 100% rename from langchain/document_loaders/word_document.py rename to libs/langchain/langchain/document_loaders/word_document.py diff --git a/langchain/document_loaders/xml.py b/libs/langchain/langchain/document_loaders/xml.py similarity index 100% rename from langchain/document_loaders/xml.py rename to libs/langchain/langchain/document_loaders/xml.py diff --git a/langchain/document_loaders/xorbits.py b/libs/langchain/langchain/document_loaders/xorbits.py similarity index 100% rename from langchain/document_loaders/xorbits.py rename to libs/langchain/langchain/document_loaders/xorbits.py diff --git a/langchain/document_loaders/youtube.py b/libs/langchain/langchain/document_loaders/youtube.py similarity index 100% rename from langchain/document_loaders/youtube.py rename to libs/langchain/langchain/document_loaders/youtube.py diff --git a/langchain/document_transformers/__init__.py b/libs/langchain/langchain/document_transformers/__init__.py similarity index 100% rename from langchain/document_transformers/__init__.py rename to libs/langchain/langchain/document_transformers/__init__.py diff --git a/langchain/document_transformers/doctran_text_extract.py b/libs/langchain/langchain/document_transformers/doctran_text_extract.py similarity index 100% rename from langchain/document_transformers/doctran_text_extract.py rename to libs/langchain/langchain/document_transformers/doctran_text_extract.py diff --git a/langchain/document_transformers/doctran_text_qa.py b/libs/langchain/langchain/document_transformers/doctran_text_qa.py similarity index 100% rename from langchain/document_transformers/doctran_text_qa.py rename to libs/langchain/langchain/document_transformers/doctran_text_qa.py diff --git a/langchain/document_transformers/doctran_text_translate.py b/libs/langchain/langchain/document_transformers/doctran_text_translate.py similarity index 100% rename from langchain/document_transformers/doctran_text_translate.py rename to libs/langchain/langchain/document_transformers/doctran_text_translate.py diff --git a/langchain/document_transformers/embeddings_redundant_filter.py b/libs/langchain/langchain/document_transformers/embeddings_redundant_filter.py similarity index 100% rename from langchain/document_transformers/embeddings_redundant_filter.py rename to libs/langchain/langchain/document_transformers/embeddings_redundant_filter.py diff --git a/langchain/document_transformers/openai_functions.py b/libs/langchain/langchain/document_transformers/openai_functions.py similarity index 100% rename from langchain/document_transformers/openai_functions.py rename to libs/langchain/langchain/document_transformers/openai_functions.py diff --git a/langchain/embeddings/__init__.py b/libs/langchain/langchain/embeddings/__init__.py similarity index 100% rename from langchain/embeddings/__init__.py rename to libs/langchain/langchain/embeddings/__init__.py diff --git a/langchain/embeddings/aleph_alpha.py b/libs/langchain/langchain/embeddings/aleph_alpha.py similarity index 100% rename from langchain/embeddings/aleph_alpha.py rename to libs/langchain/langchain/embeddings/aleph_alpha.py diff --git a/langchain/embeddings/base.py b/libs/langchain/langchain/embeddings/base.py similarity index 100% rename from langchain/embeddings/base.py rename to libs/langchain/langchain/embeddings/base.py diff --git a/langchain/embeddings/bedrock.py b/libs/langchain/langchain/embeddings/bedrock.py similarity index 100% rename from langchain/embeddings/bedrock.py rename to libs/langchain/langchain/embeddings/bedrock.py diff --git a/langchain/embeddings/clarifai.py b/libs/langchain/langchain/embeddings/clarifai.py similarity index 100% rename from langchain/embeddings/clarifai.py rename to libs/langchain/langchain/embeddings/clarifai.py diff --git a/langchain/embeddings/cohere.py b/libs/langchain/langchain/embeddings/cohere.py similarity index 100% rename from langchain/embeddings/cohere.py rename to libs/langchain/langchain/embeddings/cohere.py diff --git a/langchain/embeddings/dashscope.py b/libs/langchain/langchain/embeddings/dashscope.py similarity index 100% rename from langchain/embeddings/dashscope.py rename to libs/langchain/langchain/embeddings/dashscope.py diff --git a/langchain/embeddings/deepinfra.py b/libs/langchain/langchain/embeddings/deepinfra.py similarity index 100% rename from langchain/embeddings/deepinfra.py rename to libs/langchain/langchain/embeddings/deepinfra.py diff --git a/langchain/embeddings/elasticsearch.py b/libs/langchain/langchain/embeddings/elasticsearch.py similarity index 100% rename from langchain/embeddings/elasticsearch.py rename to libs/langchain/langchain/embeddings/elasticsearch.py diff --git a/langchain/embeddings/embaas.py b/libs/langchain/langchain/embeddings/embaas.py similarity index 100% rename from langchain/embeddings/embaas.py rename to libs/langchain/langchain/embeddings/embaas.py diff --git a/langchain/embeddings/fake.py b/libs/langchain/langchain/embeddings/fake.py similarity index 100% rename from langchain/embeddings/fake.py rename to libs/langchain/langchain/embeddings/fake.py diff --git a/langchain/embeddings/google_palm.py b/libs/langchain/langchain/embeddings/google_palm.py similarity index 100% rename from langchain/embeddings/google_palm.py rename to libs/langchain/langchain/embeddings/google_palm.py diff --git a/langchain/embeddings/gpt4all.py b/libs/langchain/langchain/embeddings/gpt4all.py similarity index 100% rename from langchain/embeddings/gpt4all.py rename to libs/langchain/langchain/embeddings/gpt4all.py diff --git a/langchain/embeddings/huggingface.py b/libs/langchain/langchain/embeddings/huggingface.py similarity index 100% rename from langchain/embeddings/huggingface.py rename to libs/langchain/langchain/embeddings/huggingface.py diff --git a/langchain/embeddings/huggingface_hub.py b/libs/langchain/langchain/embeddings/huggingface_hub.py similarity index 100% rename from langchain/embeddings/huggingface_hub.py rename to libs/langchain/langchain/embeddings/huggingface_hub.py diff --git a/langchain/embeddings/jina.py b/libs/langchain/langchain/embeddings/jina.py similarity index 100% rename from langchain/embeddings/jina.py rename to libs/langchain/langchain/embeddings/jina.py diff --git a/langchain/embeddings/llamacpp.py b/libs/langchain/langchain/embeddings/llamacpp.py similarity index 100% rename from langchain/embeddings/llamacpp.py rename to libs/langchain/langchain/embeddings/llamacpp.py diff --git a/langchain/embeddings/minimax.py b/libs/langchain/langchain/embeddings/minimax.py similarity index 100% rename from langchain/embeddings/minimax.py rename to libs/langchain/langchain/embeddings/minimax.py diff --git a/langchain/embeddings/modelscope_hub.py b/libs/langchain/langchain/embeddings/modelscope_hub.py similarity index 100% rename from langchain/embeddings/modelscope_hub.py rename to libs/langchain/langchain/embeddings/modelscope_hub.py diff --git a/langchain/embeddings/mosaicml.py b/libs/langchain/langchain/embeddings/mosaicml.py similarity index 100% rename from langchain/embeddings/mosaicml.py rename to libs/langchain/langchain/embeddings/mosaicml.py diff --git a/langchain/embeddings/octoai_embeddings.py b/libs/langchain/langchain/embeddings/octoai_embeddings.py similarity index 100% rename from langchain/embeddings/octoai_embeddings.py rename to libs/langchain/langchain/embeddings/octoai_embeddings.py diff --git a/langchain/embeddings/openai.py b/libs/langchain/langchain/embeddings/openai.py similarity index 100% rename from langchain/embeddings/openai.py rename to libs/langchain/langchain/embeddings/openai.py diff --git a/langchain/embeddings/sagemaker_endpoint.py b/libs/langchain/langchain/embeddings/sagemaker_endpoint.py similarity index 100% rename from langchain/embeddings/sagemaker_endpoint.py rename to libs/langchain/langchain/embeddings/sagemaker_endpoint.py diff --git a/langchain/embeddings/self_hosted.py b/libs/langchain/langchain/embeddings/self_hosted.py similarity index 100% rename from langchain/embeddings/self_hosted.py rename to libs/langchain/langchain/embeddings/self_hosted.py diff --git a/langchain/embeddings/self_hosted_hugging_face.py b/libs/langchain/langchain/embeddings/self_hosted_hugging_face.py similarity index 100% rename from langchain/embeddings/self_hosted_hugging_face.py rename to libs/langchain/langchain/embeddings/self_hosted_hugging_face.py diff --git a/langchain/embeddings/sentence_transformer.py b/libs/langchain/langchain/embeddings/sentence_transformer.py similarity index 100% rename from langchain/embeddings/sentence_transformer.py rename to libs/langchain/langchain/embeddings/sentence_transformer.py diff --git a/langchain/embeddings/spacy_embeddings.py b/libs/langchain/langchain/embeddings/spacy_embeddings.py similarity index 100% rename from langchain/embeddings/spacy_embeddings.py rename to libs/langchain/langchain/embeddings/spacy_embeddings.py diff --git a/langchain/embeddings/tensorflow_hub.py b/libs/langchain/langchain/embeddings/tensorflow_hub.py similarity index 100% rename from langchain/embeddings/tensorflow_hub.py rename to libs/langchain/langchain/embeddings/tensorflow_hub.py diff --git a/langchain/embeddings/vertexai.py b/libs/langchain/langchain/embeddings/vertexai.py similarity index 100% rename from langchain/embeddings/vertexai.py rename to libs/langchain/langchain/embeddings/vertexai.py diff --git a/langchain/env.py b/libs/langchain/langchain/env.py similarity index 100% rename from langchain/env.py rename to libs/langchain/langchain/env.py diff --git a/langchain/evaluation/__init__.py b/libs/langchain/langchain/evaluation/__init__.py similarity index 100% rename from langchain/evaluation/__init__.py rename to libs/langchain/langchain/evaluation/__init__.py diff --git a/langchain/evaluation/agents/__init__.py b/libs/langchain/langchain/evaluation/agents/__init__.py similarity index 100% rename from langchain/evaluation/agents/__init__.py rename to libs/langchain/langchain/evaluation/agents/__init__.py diff --git a/langchain/evaluation/agents/trajectory_eval_chain.py b/libs/langchain/langchain/evaluation/agents/trajectory_eval_chain.py similarity index 100% rename from langchain/evaluation/agents/trajectory_eval_chain.py rename to libs/langchain/langchain/evaluation/agents/trajectory_eval_chain.py diff --git a/langchain/evaluation/agents/trajectory_eval_prompt.py b/libs/langchain/langchain/evaluation/agents/trajectory_eval_prompt.py similarity index 100% rename from langchain/evaluation/agents/trajectory_eval_prompt.py rename to libs/langchain/langchain/evaluation/agents/trajectory_eval_prompt.py diff --git a/langchain/evaluation/comparison/__init__.py b/libs/langchain/langchain/evaluation/comparison/__init__.py similarity index 100% rename from langchain/evaluation/comparison/__init__.py rename to libs/langchain/langchain/evaluation/comparison/__init__.py diff --git a/langchain/evaluation/comparison/eval_chain.py b/libs/langchain/langchain/evaluation/comparison/eval_chain.py similarity index 100% rename from langchain/evaluation/comparison/eval_chain.py rename to libs/langchain/langchain/evaluation/comparison/eval_chain.py diff --git a/langchain/evaluation/comparison/prompt.py b/libs/langchain/langchain/evaluation/comparison/prompt.py similarity index 100% rename from langchain/evaluation/comparison/prompt.py rename to libs/langchain/langchain/evaluation/comparison/prompt.py diff --git a/langchain/evaluation/criteria/__init__.py b/libs/langchain/langchain/evaluation/criteria/__init__.py similarity index 100% rename from langchain/evaluation/criteria/__init__.py rename to libs/langchain/langchain/evaluation/criteria/__init__.py diff --git a/langchain/evaluation/criteria/eval_chain.py b/libs/langchain/langchain/evaluation/criteria/eval_chain.py similarity index 100% rename from langchain/evaluation/criteria/eval_chain.py rename to libs/langchain/langchain/evaluation/criteria/eval_chain.py diff --git a/langchain/evaluation/criteria/prompt.py b/libs/langchain/langchain/evaluation/criteria/prompt.py similarity index 100% rename from langchain/evaluation/criteria/prompt.py rename to libs/langchain/langchain/evaluation/criteria/prompt.py diff --git a/langchain/evaluation/embedding_distance/__init__.py b/libs/langchain/langchain/evaluation/embedding_distance/__init__.py similarity index 100% rename from langchain/evaluation/embedding_distance/__init__.py rename to libs/langchain/langchain/evaluation/embedding_distance/__init__.py diff --git a/langchain/evaluation/embedding_distance/base.py b/libs/langchain/langchain/evaluation/embedding_distance/base.py similarity index 100% rename from langchain/evaluation/embedding_distance/base.py rename to libs/langchain/langchain/evaluation/embedding_distance/base.py diff --git a/langchain/evaluation/loading.py b/libs/langchain/langchain/evaluation/loading.py similarity index 100% rename from langchain/evaluation/loading.py rename to libs/langchain/langchain/evaluation/loading.py diff --git a/langchain/evaluation/qa/__init__.py b/libs/langchain/langchain/evaluation/qa/__init__.py similarity index 100% rename from langchain/evaluation/qa/__init__.py rename to libs/langchain/langchain/evaluation/qa/__init__.py diff --git a/langchain/evaluation/qa/eval_chain.py b/libs/langchain/langchain/evaluation/qa/eval_chain.py similarity index 100% rename from langchain/evaluation/qa/eval_chain.py rename to libs/langchain/langchain/evaluation/qa/eval_chain.py diff --git a/langchain/evaluation/qa/eval_prompt.py b/libs/langchain/langchain/evaluation/qa/eval_prompt.py similarity index 100% rename from langchain/evaluation/qa/eval_prompt.py rename to libs/langchain/langchain/evaluation/qa/eval_prompt.py diff --git a/langchain/evaluation/qa/generate_chain.py b/libs/langchain/langchain/evaluation/qa/generate_chain.py similarity index 100% rename from langchain/evaluation/qa/generate_chain.py rename to libs/langchain/langchain/evaluation/qa/generate_chain.py diff --git a/langchain/evaluation/qa/generate_prompt.py b/libs/langchain/langchain/evaluation/qa/generate_prompt.py similarity index 100% rename from langchain/evaluation/qa/generate_prompt.py rename to libs/langchain/langchain/evaluation/qa/generate_prompt.py diff --git a/langchain/evaluation/schema.py b/libs/langchain/langchain/evaluation/schema.py similarity index 100% rename from langchain/evaluation/schema.py rename to libs/langchain/langchain/evaluation/schema.py diff --git a/langchain/evaluation/string_distance/__init__.py b/libs/langchain/langchain/evaluation/string_distance/__init__.py similarity index 100% rename from langchain/evaluation/string_distance/__init__.py rename to libs/langchain/langchain/evaluation/string_distance/__init__.py diff --git a/langchain/evaluation/string_distance/base.py b/libs/langchain/langchain/evaluation/string_distance/base.py similarity index 100% rename from langchain/evaluation/string_distance/base.py rename to libs/langchain/langchain/evaluation/string_distance/base.py diff --git a/langchain/example_generator.py b/libs/langchain/langchain/example_generator.py similarity index 100% rename from langchain/example_generator.py rename to libs/langchain/langchain/example_generator.py diff --git a/langchain/experimental/__init__.py b/libs/langchain/langchain/experimental/__init__.py similarity index 100% rename from langchain/experimental/__init__.py rename to libs/langchain/langchain/experimental/__init__.py diff --git a/langchain/experimental/autonomous_agents/__init__.py b/libs/langchain/langchain/experimental/autonomous_agents/__init__.py similarity index 100% rename from langchain/experimental/autonomous_agents/__init__.py rename to libs/langchain/langchain/experimental/autonomous_agents/__init__.py diff --git a/langchain/experimental/autonomous_agents/autogpt/__init__.py b/libs/langchain/langchain/experimental/autonomous_agents/autogpt/__init__.py similarity index 100% rename from langchain/experimental/autonomous_agents/autogpt/__init__.py rename to libs/langchain/langchain/experimental/autonomous_agents/autogpt/__init__.py diff --git a/langchain/experimental/autonomous_agents/autogpt/agent.py b/libs/langchain/langchain/experimental/autonomous_agents/autogpt/agent.py similarity index 100% rename from langchain/experimental/autonomous_agents/autogpt/agent.py rename to libs/langchain/langchain/experimental/autonomous_agents/autogpt/agent.py diff --git a/langchain/experimental/autonomous_agents/autogpt/memory.py b/libs/langchain/langchain/experimental/autonomous_agents/autogpt/memory.py similarity index 100% rename from langchain/experimental/autonomous_agents/autogpt/memory.py rename to libs/langchain/langchain/experimental/autonomous_agents/autogpt/memory.py diff --git a/langchain/experimental/autonomous_agents/autogpt/output_parser.py b/libs/langchain/langchain/experimental/autonomous_agents/autogpt/output_parser.py similarity index 100% rename from langchain/experimental/autonomous_agents/autogpt/output_parser.py rename to libs/langchain/langchain/experimental/autonomous_agents/autogpt/output_parser.py diff --git a/langchain/experimental/autonomous_agents/autogpt/prompt.py b/libs/langchain/langchain/experimental/autonomous_agents/autogpt/prompt.py similarity index 100% rename from langchain/experimental/autonomous_agents/autogpt/prompt.py rename to libs/langchain/langchain/experimental/autonomous_agents/autogpt/prompt.py diff --git a/langchain/experimental/autonomous_agents/autogpt/prompt_generator.py b/libs/langchain/langchain/experimental/autonomous_agents/autogpt/prompt_generator.py similarity index 100% rename from langchain/experimental/autonomous_agents/autogpt/prompt_generator.py rename to libs/langchain/langchain/experimental/autonomous_agents/autogpt/prompt_generator.py diff --git a/langchain/experimental/autonomous_agents/baby_agi/__init__.py b/libs/langchain/langchain/experimental/autonomous_agents/baby_agi/__init__.py similarity index 100% rename from langchain/experimental/autonomous_agents/baby_agi/__init__.py rename to libs/langchain/langchain/experimental/autonomous_agents/baby_agi/__init__.py diff --git a/langchain/experimental/autonomous_agents/baby_agi/baby_agi.py b/libs/langchain/langchain/experimental/autonomous_agents/baby_agi/baby_agi.py similarity index 97% rename from langchain/experimental/autonomous_agents/baby_agi/baby_agi.py rename to libs/langchain/langchain/experimental/autonomous_agents/baby_agi/baby_agi.py index 446a676cac8..fd25804ec83 100644 --- a/langchain/experimental/autonomous_agents/baby_agi/baby_agi.py +++ b/libs/langchain/langchain/experimental/autonomous_agents/baby_agi/baby_agi.py @@ -1,187 +1,187 @@ -"""BabyAGI agent.""" -from collections import deque -from typing import Any, Dict, List, Optional - -from pydantic import BaseModel, Field - -from langchain.callbacks.manager import CallbackManagerForChainRun -from langchain.chains.base import Chain -from langchain.experimental.autonomous_agents.baby_agi.task_creation import ( - TaskCreationChain, -) -from langchain.experimental.autonomous_agents.baby_agi.task_execution import ( - TaskExecutionChain, -) -from langchain.experimental.autonomous_agents.baby_agi.task_prioritization import ( - TaskPrioritizationChain, -) -from langchain.schema.language_model import BaseLanguageModel -from langchain.vectorstores.base import VectorStore - - -class BabyAGI(Chain, BaseModel): - """Controller model for the BabyAGI agent.""" - - task_list: deque = Field(default_factory=deque) - task_creation_chain: Chain = Field(...) - task_prioritization_chain: Chain = Field(...) - execution_chain: Chain = Field(...) - task_id_counter: int = Field(1) - vectorstore: VectorStore = Field(init=False) - max_iterations: Optional[int] = None - - class Config: - """Configuration for this pydantic object.""" - - arbitrary_types_allowed = True - - def add_task(self, task: Dict) -> None: - self.task_list.append(task) - - def print_task_list(self) -> None: - print("\033[95m\033[1m" + "\n*****TASK LIST*****\n" + "\033[0m\033[0m") - for t in self.task_list: - print(str(t["task_id"]) + ": " + t["task_name"]) - - def print_next_task(self, task: Dict) -> None: - print("\033[92m\033[1m" + "\n*****NEXT TASK*****\n" + "\033[0m\033[0m") - print(str(task["task_id"]) + ": " + task["task_name"]) - - def print_task_result(self, result: str) -> None: - print("\033[93m\033[1m" + "\n*****TASK RESULT*****\n" + "\033[0m\033[0m") - print(result) - - @property - def input_keys(self) -> List[str]: - return ["objective"] - - @property - def output_keys(self) -> List[str]: - return [] - - def get_next_task( - self, result: str, task_description: str, objective: str - ) -> List[Dict]: - """Get the next task.""" - task_names = [t["task_name"] for t in self.task_list] - - incomplete_tasks = ", ".join(task_names) - response = self.task_creation_chain.run( - result=result, - task_description=task_description, - incomplete_tasks=incomplete_tasks, - objective=objective, - ) - new_tasks = response.split("\n") - return [ - {"task_name": task_name} for task_name in new_tasks if task_name.strip() - ] - - def prioritize_tasks(self, this_task_id: int, objective: str) -> List[Dict]: - """Prioritize tasks.""" - task_names = [t["task_name"] for t in list(self.task_list)] - next_task_id = int(this_task_id) + 1 - response = self.task_prioritization_chain.run( - task_names=", ".join(task_names), - next_task_id=str(next_task_id), - objective=objective, - ) - new_tasks = response.split("\n") - prioritized_task_list = [] - for task_string in new_tasks: - if not task_string.strip(): - continue - task_parts = task_string.strip().split(".", 1) - if len(task_parts) == 2: - task_id = task_parts[0].strip() - task_name = task_parts[1].strip() - prioritized_task_list.append( - {"task_id": task_id, "task_name": task_name} - ) - return prioritized_task_list - - def _get_top_tasks(self, query: str, k: int) -> List[str]: - """Get the top k tasks based on the query.""" - results = self.vectorstore.similarity_search(query, k=k) - if not results: - return [] - return [str(item.metadata["task"]) for item in results] - - def execute_task(self, objective: str, task: str, k: int = 5) -> str: - """Execute a task.""" - context = self._get_top_tasks(query=objective, k=k) - return self.execution_chain.run( - objective=objective, context="\n".join(context), task=task - ) - - def _call( - self, - inputs: Dict[str, Any], - run_manager: Optional[CallbackManagerForChainRun] = None, - ) -> Dict[str, Any]: - """Run the agent.""" - objective = inputs["objective"] - first_task = inputs.get("first_task", "Make a todo list") - self.add_task({"task_id": 1, "task_name": first_task}) - num_iters = 0 - while True: - if self.task_list: - self.print_task_list() - - # Step 1: Pull the first task - task = self.task_list.popleft() - self.print_next_task(task) - - # Step 2: Execute the task - result = self.execute_task(objective, task["task_name"]) - this_task_id = int(task["task_id"]) - self.print_task_result(result) - - # Step 3: Store the result in Pinecone - result_id = f"result_{task['task_id']}" - self.vectorstore.add_texts( - texts=[result], - metadatas=[{"task": task["task_name"]}], - ids=[result_id], - ) - - # Step 4: Create new tasks and reprioritize task list - new_tasks = self.get_next_task(result, task["task_name"], objective) - for new_task in new_tasks: - self.task_id_counter += 1 - new_task.update({"task_id": self.task_id_counter}) - self.add_task(new_task) - self.task_list = deque(self.prioritize_tasks(this_task_id, objective)) - num_iters += 1 - if self.max_iterations is not None and num_iters == self.max_iterations: - print( - "\033[91m\033[1m" + "\n*****TASK ENDING*****\n" + "\033[0m\033[0m" - ) - break - return {} - - @classmethod - def from_llm( - cls, - llm: BaseLanguageModel, - vectorstore: VectorStore, - verbose: bool = False, - task_execution_chain: Optional[Chain] = None, - **kwargs: Dict[str, Any], - ) -> "BabyAGI": - """Initialize the BabyAGI Controller.""" - task_creation_chain = TaskCreationChain.from_llm(llm, verbose=verbose) - task_prioritization_chain = TaskPrioritizationChain.from_llm( - llm, verbose=verbose - ) - if task_execution_chain is None: - execution_chain: Chain = TaskExecutionChain.from_llm(llm, verbose=verbose) - else: - execution_chain = task_execution_chain - return cls( - task_creation_chain=task_creation_chain, - task_prioritization_chain=task_prioritization_chain, - execution_chain=execution_chain, - vectorstore=vectorstore, - **kwargs, - ) +"""BabyAGI agent.""" +from collections import deque +from typing import Any, Dict, List, Optional + +from pydantic import BaseModel, Field + +from langchain.callbacks.manager import CallbackManagerForChainRun +from langchain.chains.base import Chain +from langchain.experimental.autonomous_agents.baby_agi.task_creation import ( + TaskCreationChain, +) +from langchain.experimental.autonomous_agents.baby_agi.task_execution import ( + TaskExecutionChain, +) +from langchain.experimental.autonomous_agents.baby_agi.task_prioritization import ( + TaskPrioritizationChain, +) +from langchain.schema.language_model import BaseLanguageModel +from langchain.vectorstores.base import VectorStore + + +class BabyAGI(Chain, BaseModel): + """Controller model for the BabyAGI agent.""" + + task_list: deque = Field(default_factory=deque) + task_creation_chain: Chain = Field(...) + task_prioritization_chain: Chain = Field(...) + execution_chain: Chain = Field(...) + task_id_counter: int = Field(1) + vectorstore: VectorStore = Field(init=False) + max_iterations: Optional[int] = None + + class Config: + """Configuration for this pydantic object.""" + + arbitrary_types_allowed = True + + def add_task(self, task: Dict) -> None: + self.task_list.append(task) + + def print_task_list(self) -> None: + print("\033[95m\033[1m" + "\n*****TASK LIST*****\n" + "\033[0m\033[0m") + for t in self.task_list: + print(str(t["task_id"]) + ": " + t["task_name"]) + + def print_next_task(self, task: Dict) -> None: + print("\033[92m\033[1m" + "\n*****NEXT TASK*****\n" + "\033[0m\033[0m") + print(str(task["task_id"]) + ": " + task["task_name"]) + + def print_task_result(self, result: str) -> None: + print("\033[93m\033[1m" + "\n*****TASK RESULT*****\n" + "\033[0m\033[0m") + print(result) + + @property + def input_keys(self) -> List[str]: + return ["objective"] + + @property + def output_keys(self) -> List[str]: + return [] + + def get_next_task( + self, result: str, task_description: str, objective: str + ) -> List[Dict]: + """Get the next task.""" + task_names = [t["task_name"] for t in self.task_list] + + incomplete_tasks = ", ".join(task_names) + response = self.task_creation_chain.run( + result=result, + task_description=task_description, + incomplete_tasks=incomplete_tasks, + objective=objective, + ) + new_tasks = response.split("\n") + return [ + {"task_name": task_name} for task_name in new_tasks if task_name.strip() + ] + + def prioritize_tasks(self, this_task_id: int, objective: str) -> List[Dict]: + """Prioritize tasks.""" + task_names = [t["task_name"] for t in list(self.task_list)] + next_task_id = int(this_task_id) + 1 + response = self.task_prioritization_chain.run( + task_names=", ".join(task_names), + next_task_id=str(next_task_id), + objective=objective, + ) + new_tasks = response.split("\n") + prioritized_task_list = [] + for task_string in new_tasks: + if not task_string.strip(): + continue + task_parts = task_string.strip().split(".", 1) + if len(task_parts) == 2: + task_id = task_parts[0].strip() + task_name = task_parts[1].strip() + prioritized_task_list.append( + {"task_id": task_id, "task_name": task_name} + ) + return prioritized_task_list + + def _get_top_tasks(self, query: str, k: int) -> List[str]: + """Get the top k tasks based on the query.""" + results = self.vectorstore.similarity_search(query, k=k) + if not results: + return [] + return [str(item.metadata["task"]) for item in results] + + def execute_task(self, objective: str, task: str, k: int = 5) -> str: + """Execute a task.""" + context = self._get_top_tasks(query=objective, k=k) + return self.execution_chain.run( + objective=objective, context="\n".join(context), task=task + ) + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, Any]: + """Run the agent.""" + objective = inputs["objective"] + first_task = inputs.get("first_task", "Make a todo list") + self.add_task({"task_id": 1, "task_name": first_task}) + num_iters = 0 + while True: + if self.task_list: + self.print_task_list() + + # Step 1: Pull the first task + task = self.task_list.popleft() + self.print_next_task(task) + + # Step 2: Execute the task + result = self.execute_task(objective, task["task_name"]) + this_task_id = int(task["task_id"]) + self.print_task_result(result) + + # Step 3: Store the result in Pinecone + result_id = f"result_{task['task_id']}" + self.vectorstore.add_texts( + texts=[result], + metadatas=[{"task": task["task_name"]}], + ids=[result_id], + ) + + # Step 4: Create new tasks and reprioritize task list + new_tasks = self.get_next_task(result, task["task_name"], objective) + for new_task in new_tasks: + self.task_id_counter += 1 + new_task.update({"task_id": self.task_id_counter}) + self.add_task(new_task) + self.task_list = deque(self.prioritize_tasks(this_task_id, objective)) + num_iters += 1 + if self.max_iterations is not None and num_iters == self.max_iterations: + print( + "\033[91m\033[1m" + "\n*****TASK ENDING*****\n" + "\033[0m\033[0m" + ) + break + return {} + + @classmethod + def from_llm( + cls, + llm: BaseLanguageModel, + vectorstore: VectorStore, + verbose: bool = False, + task_execution_chain: Optional[Chain] = None, + **kwargs: Dict[str, Any], + ) -> "BabyAGI": + """Initialize the BabyAGI Controller.""" + task_creation_chain = TaskCreationChain.from_llm(llm, verbose=verbose) + task_prioritization_chain = TaskPrioritizationChain.from_llm( + llm, verbose=verbose + ) + if task_execution_chain is None: + execution_chain: Chain = TaskExecutionChain.from_llm(llm, verbose=verbose) + else: + execution_chain = task_execution_chain + return cls( + task_creation_chain=task_creation_chain, + task_prioritization_chain=task_prioritization_chain, + execution_chain=execution_chain, + vectorstore=vectorstore, + **kwargs, + ) diff --git a/langchain/experimental/autonomous_agents/baby_agi/task_creation.py b/libs/langchain/langchain/experimental/autonomous_agents/baby_agi/task_creation.py similarity index 97% rename from langchain/experimental/autonomous_agents/baby_agi/task_creation.py rename to libs/langchain/langchain/experimental/autonomous_agents/baby_agi/task_creation.py index 7f7713cdc8d..47834b64634 100644 --- a/langchain/experimental/autonomous_agents/baby_agi/task_creation.py +++ b/libs/langchain/langchain/experimental/autonomous_agents/baby_agi/task_creation.py @@ -1,30 +1,30 @@ -from langchain import LLMChain, PromptTemplate -from langchain.schema.language_model import BaseLanguageModel - - -class TaskCreationChain(LLMChain): - """Chain to generates tasks.""" - - @classmethod - def from_llm(cls, llm: BaseLanguageModel, verbose: bool = True) -> LLMChain: - """Get the response parser.""" - task_creation_template = ( - "You are an task creation AI that uses the result of an execution agent" - " to create new tasks with the following objective: {objective}," - " The last completed task has the result: {result}." - " This result was based on this task description: {task_description}." - " These are incomplete tasks: {incomplete_tasks}." - " Based on the result, create new tasks to be completed" - " by the AI system that do not overlap with incomplete tasks." - " Return the tasks as an array." - ) - prompt = PromptTemplate( - template=task_creation_template, - input_variables=[ - "result", - "task_description", - "incomplete_tasks", - "objective", - ], - ) - return cls(prompt=prompt, llm=llm, verbose=verbose) +from langchain import LLMChain, PromptTemplate +from langchain.schema.language_model import BaseLanguageModel + + +class TaskCreationChain(LLMChain): + """Chain to generates tasks.""" + + @classmethod + def from_llm(cls, llm: BaseLanguageModel, verbose: bool = True) -> LLMChain: + """Get the response parser.""" + task_creation_template = ( + "You are an task creation AI that uses the result of an execution agent" + " to create new tasks with the following objective: {objective}," + " The last completed task has the result: {result}." + " This result was based on this task description: {task_description}." + " These are incomplete tasks: {incomplete_tasks}." + " Based on the result, create new tasks to be completed" + " by the AI system that do not overlap with incomplete tasks." + " Return the tasks as an array." + ) + prompt = PromptTemplate( + template=task_creation_template, + input_variables=[ + "result", + "task_description", + "incomplete_tasks", + "objective", + ], + ) + return cls(prompt=prompt, llm=llm, verbose=verbose) diff --git a/langchain/experimental/autonomous_agents/baby_agi/task_execution.py b/libs/langchain/langchain/experimental/autonomous_agents/baby_agi/task_execution.py similarity index 97% rename from langchain/experimental/autonomous_agents/baby_agi/task_execution.py rename to libs/langchain/langchain/experimental/autonomous_agents/baby_agi/task_execution.py index d968395c852..d5d137a48ab 100644 --- a/langchain/experimental/autonomous_agents/baby_agi/task_execution.py +++ b/libs/langchain/langchain/experimental/autonomous_agents/baby_agi/task_execution.py @@ -1,21 +1,21 @@ -from langchain import LLMChain, PromptTemplate -from langchain.schema.language_model import BaseLanguageModel - - -class TaskExecutionChain(LLMChain): - """Chain to execute tasks.""" - - @classmethod - def from_llm(cls, llm: BaseLanguageModel, verbose: bool = True) -> LLMChain: - """Get the response parser.""" - execution_template = ( - "You are an AI who performs one task based on the following objective: " - "{objective}." - "Take into account these previously completed tasks: {context}." - " Your task: {task}. Response:" - ) - prompt = PromptTemplate( - template=execution_template, - input_variables=["objective", "context", "task"], - ) - return cls(prompt=prompt, llm=llm, verbose=verbose) +from langchain import LLMChain, PromptTemplate +from langchain.schema.language_model import BaseLanguageModel + + +class TaskExecutionChain(LLMChain): + """Chain to execute tasks.""" + + @classmethod + def from_llm(cls, llm: BaseLanguageModel, verbose: bool = True) -> LLMChain: + """Get the response parser.""" + execution_template = ( + "You are an AI who performs one task based on the following objective: " + "{objective}." + "Take into account these previously completed tasks: {context}." + " Your task: {task}. Response:" + ) + prompt = PromptTemplate( + template=execution_template, + input_variables=["objective", "context", "task"], + ) + return cls(prompt=prompt, llm=llm, verbose=verbose) diff --git a/langchain/experimental/autonomous_agents/baby_agi/task_prioritization.py b/libs/langchain/langchain/experimental/autonomous_agents/baby_agi/task_prioritization.py similarity index 97% rename from langchain/experimental/autonomous_agents/baby_agi/task_prioritization.py rename to libs/langchain/langchain/experimental/autonomous_agents/baby_agi/task_prioritization.py index 34affa398a1..9b6eb58f6eb 100644 --- a/langchain/experimental/autonomous_agents/baby_agi/task_prioritization.py +++ b/libs/langchain/langchain/experimental/autonomous_agents/baby_agi/task_prioritization.py @@ -1,24 +1,24 @@ -from langchain import LLMChain, PromptTemplate -from langchain.schema.language_model import BaseLanguageModel - - -class TaskPrioritizationChain(LLMChain): - """Chain to prioritize tasks.""" - - @classmethod - def from_llm(cls, llm: BaseLanguageModel, verbose: bool = True) -> LLMChain: - """Get the response parser.""" - task_prioritization_template = ( - "You are a task prioritization AI tasked with cleaning the formatting of " - "and reprioritizing the following tasks: {task_names}." - " Consider the ultimate objective of your team: {objective}." - " Do not remove any tasks. Return the result as a numbered list, like:" - " #. First task" - " #. Second task" - " Start the task list with number {next_task_id}." - ) - prompt = PromptTemplate( - template=task_prioritization_template, - input_variables=["task_names", "next_task_id", "objective"], - ) - return cls(prompt=prompt, llm=llm, verbose=verbose) +from langchain import LLMChain, PromptTemplate +from langchain.schema.language_model import BaseLanguageModel + + +class TaskPrioritizationChain(LLMChain): + """Chain to prioritize tasks.""" + + @classmethod + def from_llm(cls, llm: BaseLanguageModel, verbose: bool = True) -> LLMChain: + """Get the response parser.""" + task_prioritization_template = ( + "You are a task prioritization AI tasked with cleaning the formatting of " + "and reprioritizing the following tasks: {task_names}." + " Consider the ultimate objective of your team: {objective}." + " Do not remove any tasks. Return the result as a numbered list, like:" + " #. First task" + " #. Second task" + " Start the task list with number {next_task_id}." + ) + prompt = PromptTemplate( + template=task_prioritization_template, + input_variables=["task_names", "next_task_id", "objective"], + ) + return cls(prompt=prompt, llm=llm, verbose=verbose) diff --git a/langchain/experimental/cpal/README.md b/libs/langchain/langchain/experimental/cpal/README.md similarity index 100% rename from langchain/experimental/cpal/README.md rename to libs/langchain/langchain/experimental/cpal/README.md diff --git a/langchain/experimental/cpal/__init__.py b/libs/langchain/langchain/experimental/cpal/__init__.py similarity index 100% rename from langchain/experimental/cpal/__init__.py rename to libs/langchain/langchain/experimental/cpal/__init__.py diff --git a/langchain/experimental/cpal/base.py b/libs/langchain/langchain/experimental/cpal/base.py similarity index 100% rename from langchain/experimental/cpal/base.py rename to libs/langchain/langchain/experimental/cpal/base.py diff --git a/langchain/experimental/cpal/constants.py b/libs/langchain/langchain/experimental/cpal/constants.py similarity index 100% rename from langchain/experimental/cpal/constants.py rename to libs/langchain/langchain/experimental/cpal/constants.py diff --git a/langchain/experimental/cpal/models.py b/libs/langchain/langchain/experimental/cpal/models.py similarity index 100% rename from langchain/experimental/cpal/models.py rename to libs/langchain/langchain/experimental/cpal/models.py diff --git a/langchain/experimental/cpal/templates/__init__.py b/libs/langchain/langchain/experimental/cpal/templates/__init__.py similarity index 100% rename from langchain/experimental/cpal/templates/__init__.py rename to libs/langchain/langchain/experimental/cpal/templates/__init__.py diff --git a/langchain/experimental/cpal/templates/univariate/__init__.py b/libs/langchain/langchain/experimental/cpal/templates/univariate/__init__.py similarity index 100% rename from langchain/experimental/cpal/templates/univariate/__init__.py rename to libs/langchain/langchain/experimental/cpal/templates/univariate/__init__.py diff --git a/langchain/experimental/cpal/templates/univariate/causal.py b/libs/langchain/langchain/experimental/cpal/templates/univariate/causal.py similarity index 100% rename from langchain/experimental/cpal/templates/univariate/causal.py rename to libs/langchain/langchain/experimental/cpal/templates/univariate/causal.py diff --git a/langchain/experimental/cpal/templates/univariate/intervention.py b/libs/langchain/langchain/experimental/cpal/templates/univariate/intervention.py similarity index 100% rename from langchain/experimental/cpal/templates/univariate/intervention.py rename to libs/langchain/langchain/experimental/cpal/templates/univariate/intervention.py diff --git a/langchain/experimental/cpal/templates/univariate/narrative.py b/libs/langchain/langchain/experimental/cpal/templates/univariate/narrative.py similarity index 100% rename from langchain/experimental/cpal/templates/univariate/narrative.py rename to libs/langchain/langchain/experimental/cpal/templates/univariate/narrative.py diff --git a/langchain/experimental/cpal/templates/univariate/query.py b/libs/langchain/langchain/experimental/cpal/templates/univariate/query.py similarity index 100% rename from langchain/experimental/cpal/templates/univariate/query.py rename to libs/langchain/langchain/experimental/cpal/templates/univariate/query.py diff --git a/langchain/experimental/generative_agents/__init__.py b/libs/langchain/langchain/experimental/generative_agents/__init__.py similarity index 100% rename from langchain/experimental/generative_agents/__init__.py rename to libs/langchain/langchain/experimental/generative_agents/__init__.py diff --git a/langchain/experimental/generative_agents/generative_agent.py b/libs/langchain/langchain/experimental/generative_agents/generative_agent.py similarity index 100% rename from langchain/experimental/generative_agents/generative_agent.py rename to libs/langchain/langchain/experimental/generative_agents/generative_agent.py diff --git a/langchain/experimental/generative_agents/memory.py b/libs/langchain/langchain/experimental/generative_agents/memory.py similarity index 100% rename from langchain/experimental/generative_agents/memory.py rename to libs/langchain/langchain/experimental/generative_agents/memory.py diff --git a/langchain/experimental/llms/__init__.py b/libs/langchain/langchain/experimental/llms/__init__.py similarity index 100% rename from langchain/experimental/llms/__init__.py rename to libs/langchain/langchain/experimental/llms/__init__.py diff --git a/langchain/experimental/llms/jsonformer_decoder.py b/libs/langchain/langchain/experimental/llms/jsonformer_decoder.py similarity index 100% rename from langchain/experimental/llms/jsonformer_decoder.py rename to libs/langchain/langchain/experimental/llms/jsonformer_decoder.py diff --git a/langchain/experimental/llms/rellm_decoder.py b/libs/langchain/langchain/experimental/llms/rellm_decoder.py similarity index 100% rename from langchain/experimental/llms/rellm_decoder.py rename to libs/langchain/langchain/experimental/llms/rellm_decoder.py diff --git a/langchain/experimental/plan_and_execute/__init__.py b/libs/langchain/langchain/experimental/plan_and_execute/__init__.py similarity index 100% rename from langchain/experimental/plan_and_execute/__init__.py rename to libs/langchain/langchain/experimental/plan_and_execute/__init__.py diff --git a/langchain/experimental/plan_and_execute/agent_executor.py b/libs/langchain/langchain/experimental/plan_and_execute/agent_executor.py similarity index 100% rename from langchain/experimental/plan_and_execute/agent_executor.py rename to libs/langchain/langchain/experimental/plan_and_execute/agent_executor.py diff --git a/langchain/experimental/plan_and_execute/executors/__init__.py b/libs/langchain/langchain/experimental/plan_and_execute/executors/__init__.py similarity index 100% rename from langchain/experimental/plan_and_execute/executors/__init__.py rename to libs/langchain/langchain/experimental/plan_and_execute/executors/__init__.py diff --git a/langchain/experimental/plan_and_execute/executors/agent_executor.py b/libs/langchain/langchain/experimental/plan_and_execute/executors/agent_executor.py similarity index 100% rename from langchain/experimental/plan_and_execute/executors/agent_executor.py rename to libs/langchain/langchain/experimental/plan_and_execute/executors/agent_executor.py diff --git a/langchain/experimental/plan_and_execute/executors/base.py b/libs/langchain/langchain/experimental/plan_and_execute/executors/base.py similarity index 100% rename from langchain/experimental/plan_and_execute/executors/base.py rename to libs/langchain/langchain/experimental/plan_and_execute/executors/base.py diff --git a/langchain/experimental/plan_and_execute/planners/__init__.py b/libs/langchain/langchain/experimental/plan_and_execute/planners/__init__.py similarity index 100% rename from langchain/experimental/plan_and_execute/planners/__init__.py rename to libs/langchain/langchain/experimental/plan_and_execute/planners/__init__.py diff --git a/langchain/experimental/plan_and_execute/planners/base.py b/libs/langchain/langchain/experimental/plan_and_execute/planners/base.py similarity index 100% rename from langchain/experimental/plan_and_execute/planners/base.py rename to libs/langchain/langchain/experimental/plan_and_execute/planners/base.py diff --git a/langchain/experimental/plan_and_execute/planners/chat_planner.py b/libs/langchain/langchain/experimental/plan_and_execute/planners/chat_planner.py similarity index 100% rename from langchain/experimental/plan_and_execute/planners/chat_planner.py rename to libs/langchain/langchain/experimental/plan_and_execute/planners/chat_planner.py diff --git a/langchain/experimental/plan_and_execute/schema.py b/libs/langchain/langchain/experimental/plan_and_execute/schema.py similarity index 100% rename from langchain/experimental/plan_and_execute/schema.py rename to libs/langchain/langchain/experimental/plan_and_execute/schema.py diff --git a/langchain/formatting.py b/libs/langchain/langchain/formatting.py similarity index 100% rename from langchain/formatting.py rename to libs/langchain/langchain/formatting.py diff --git a/langchain/graphs/__init__.py b/libs/langchain/langchain/graphs/__init__.py similarity index 100% rename from langchain/graphs/__init__.py rename to libs/langchain/langchain/graphs/__init__.py diff --git a/langchain/graphs/hugegraph.py b/libs/langchain/langchain/graphs/hugegraph.py similarity index 100% rename from langchain/graphs/hugegraph.py rename to libs/langchain/langchain/graphs/hugegraph.py diff --git a/langchain/graphs/kuzu_graph.py b/libs/langchain/langchain/graphs/kuzu_graph.py similarity index 100% rename from langchain/graphs/kuzu_graph.py rename to libs/langchain/langchain/graphs/kuzu_graph.py diff --git a/langchain/graphs/nebula_graph.py b/libs/langchain/langchain/graphs/nebula_graph.py similarity index 100% rename from langchain/graphs/nebula_graph.py rename to libs/langchain/langchain/graphs/nebula_graph.py diff --git a/langchain/graphs/neo4j_graph.py b/libs/langchain/langchain/graphs/neo4j_graph.py similarity index 100% rename from langchain/graphs/neo4j_graph.py rename to libs/langchain/langchain/graphs/neo4j_graph.py diff --git a/langchain/graphs/networkx_graph.py b/libs/langchain/langchain/graphs/networkx_graph.py similarity index 100% rename from langchain/graphs/networkx_graph.py rename to libs/langchain/langchain/graphs/networkx_graph.py diff --git a/langchain/graphs/rdf_graph.py b/libs/langchain/langchain/graphs/rdf_graph.py similarity index 100% rename from langchain/graphs/rdf_graph.py rename to libs/langchain/langchain/graphs/rdf_graph.py diff --git a/langchain/indexes/__init__.py b/libs/langchain/langchain/indexes/__init__.py similarity index 100% rename from langchain/indexes/__init__.py rename to libs/langchain/langchain/indexes/__init__.py diff --git a/langchain/indexes/graph.py b/libs/langchain/langchain/indexes/graph.py similarity index 100% rename from langchain/indexes/graph.py rename to libs/langchain/langchain/indexes/graph.py diff --git a/langchain/indexes/prompts/__init__.py b/libs/langchain/langchain/indexes/prompts/__init__.py similarity index 100% rename from langchain/indexes/prompts/__init__.py rename to libs/langchain/langchain/indexes/prompts/__init__.py diff --git a/langchain/indexes/prompts/entity_extraction.py b/libs/langchain/langchain/indexes/prompts/entity_extraction.py similarity index 100% rename from langchain/indexes/prompts/entity_extraction.py rename to libs/langchain/langchain/indexes/prompts/entity_extraction.py diff --git a/langchain/indexes/prompts/entity_summarization.py b/libs/langchain/langchain/indexes/prompts/entity_summarization.py similarity index 100% rename from langchain/indexes/prompts/entity_summarization.py rename to libs/langchain/langchain/indexes/prompts/entity_summarization.py diff --git a/langchain/indexes/prompts/knowledge_triplet_extraction.py b/libs/langchain/langchain/indexes/prompts/knowledge_triplet_extraction.py similarity index 100% rename from langchain/indexes/prompts/knowledge_triplet_extraction.py rename to libs/langchain/langchain/indexes/prompts/knowledge_triplet_extraction.py diff --git a/langchain/indexes/vectorstore.py b/libs/langchain/langchain/indexes/vectorstore.py similarity index 100% rename from langchain/indexes/vectorstore.py rename to libs/langchain/langchain/indexes/vectorstore.py diff --git a/langchain/input.py b/libs/langchain/langchain/input.py similarity index 100% rename from langchain/input.py rename to libs/langchain/langchain/input.py diff --git a/langchain/llms/__init__.py b/libs/langchain/langchain/llms/__init__.py similarity index 100% rename from langchain/llms/__init__.py rename to libs/langchain/langchain/llms/__init__.py diff --git a/langchain/llms/ai21.py b/libs/langchain/langchain/llms/ai21.py similarity index 100% rename from langchain/llms/ai21.py rename to libs/langchain/langchain/llms/ai21.py diff --git a/langchain/llms/aleph_alpha.py b/libs/langchain/langchain/llms/aleph_alpha.py similarity index 100% rename from langchain/llms/aleph_alpha.py rename to libs/langchain/langchain/llms/aleph_alpha.py diff --git a/langchain/llms/amazon_api_gateway.py b/libs/langchain/langchain/llms/amazon_api_gateway.py similarity index 100% rename from langchain/llms/amazon_api_gateway.py rename to libs/langchain/langchain/llms/amazon_api_gateway.py diff --git a/langchain/llms/anthropic.py b/libs/langchain/langchain/llms/anthropic.py similarity index 100% rename from langchain/llms/anthropic.py rename to libs/langchain/langchain/llms/anthropic.py diff --git a/langchain/llms/anyscale.py b/libs/langchain/langchain/llms/anyscale.py similarity index 100% rename from langchain/llms/anyscale.py rename to libs/langchain/langchain/llms/anyscale.py diff --git a/langchain/llms/aviary.py b/libs/langchain/langchain/llms/aviary.py similarity index 100% rename from langchain/llms/aviary.py rename to libs/langchain/langchain/llms/aviary.py diff --git a/langchain/llms/azureml_endpoint.py b/libs/langchain/langchain/llms/azureml_endpoint.py similarity index 100% rename from langchain/llms/azureml_endpoint.py rename to libs/langchain/langchain/llms/azureml_endpoint.py diff --git a/langchain/llms/bananadev.py b/libs/langchain/langchain/llms/bananadev.py similarity index 100% rename from langchain/llms/bananadev.py rename to libs/langchain/langchain/llms/bananadev.py diff --git a/langchain/llms/base.py b/libs/langchain/langchain/llms/base.py similarity index 100% rename from langchain/llms/base.py rename to libs/langchain/langchain/llms/base.py diff --git a/langchain/llms/baseten.py b/libs/langchain/langchain/llms/baseten.py similarity index 100% rename from langchain/llms/baseten.py rename to libs/langchain/langchain/llms/baseten.py diff --git a/langchain/llms/beam.py b/libs/langchain/langchain/llms/beam.py similarity index 100% rename from langchain/llms/beam.py rename to libs/langchain/langchain/llms/beam.py diff --git a/langchain/llms/bedrock.py b/libs/langchain/langchain/llms/bedrock.py similarity index 100% rename from langchain/llms/bedrock.py rename to libs/langchain/langchain/llms/bedrock.py diff --git a/langchain/llms/cerebriumai.py b/libs/langchain/langchain/llms/cerebriumai.py similarity index 100% rename from langchain/llms/cerebriumai.py rename to libs/langchain/langchain/llms/cerebriumai.py diff --git a/langchain/llms/clarifai.py b/libs/langchain/langchain/llms/clarifai.py similarity index 100% rename from langchain/llms/clarifai.py rename to libs/langchain/langchain/llms/clarifai.py diff --git a/langchain/llms/cohere.py b/libs/langchain/langchain/llms/cohere.py similarity index 100% rename from langchain/llms/cohere.py rename to libs/langchain/langchain/llms/cohere.py diff --git a/langchain/llms/ctransformers.py b/libs/langchain/langchain/llms/ctransformers.py similarity index 100% rename from langchain/llms/ctransformers.py rename to libs/langchain/langchain/llms/ctransformers.py diff --git a/langchain/llms/databricks.py b/libs/langchain/langchain/llms/databricks.py similarity index 100% rename from langchain/llms/databricks.py rename to libs/langchain/langchain/llms/databricks.py diff --git a/langchain/llms/deepinfra.py b/libs/langchain/langchain/llms/deepinfra.py similarity index 100% rename from langchain/llms/deepinfra.py rename to libs/langchain/langchain/llms/deepinfra.py diff --git a/langchain/llms/fake.py b/libs/langchain/langchain/llms/fake.py similarity index 100% rename from langchain/llms/fake.py rename to libs/langchain/langchain/llms/fake.py diff --git a/langchain/llms/forefrontai.py b/libs/langchain/langchain/llms/forefrontai.py similarity index 100% rename from langchain/llms/forefrontai.py rename to libs/langchain/langchain/llms/forefrontai.py diff --git a/langchain/llms/google_palm.py b/libs/langchain/langchain/llms/google_palm.py similarity index 100% rename from langchain/llms/google_palm.py rename to libs/langchain/langchain/llms/google_palm.py diff --git a/langchain/llms/gooseai.py b/libs/langchain/langchain/llms/gooseai.py similarity index 100% rename from langchain/llms/gooseai.py rename to libs/langchain/langchain/llms/gooseai.py diff --git a/langchain/llms/gpt4all.py b/libs/langchain/langchain/llms/gpt4all.py similarity index 100% rename from langchain/llms/gpt4all.py rename to libs/langchain/langchain/llms/gpt4all.py diff --git a/langchain/llms/huggingface_endpoint.py b/libs/langchain/langchain/llms/huggingface_endpoint.py similarity index 100% rename from langchain/llms/huggingface_endpoint.py rename to libs/langchain/langchain/llms/huggingface_endpoint.py diff --git a/langchain/llms/huggingface_hub.py b/libs/langchain/langchain/llms/huggingface_hub.py similarity index 100% rename from langchain/llms/huggingface_hub.py rename to libs/langchain/langchain/llms/huggingface_hub.py diff --git a/langchain/llms/huggingface_pipeline.py b/libs/langchain/langchain/llms/huggingface_pipeline.py similarity index 100% rename from langchain/llms/huggingface_pipeline.py rename to libs/langchain/langchain/llms/huggingface_pipeline.py diff --git a/langchain/llms/huggingface_text_gen_inference.py b/libs/langchain/langchain/llms/huggingface_text_gen_inference.py similarity index 100% rename from langchain/llms/huggingface_text_gen_inference.py rename to libs/langchain/langchain/llms/huggingface_text_gen_inference.py diff --git a/langchain/llms/human.py b/libs/langchain/langchain/llms/human.py similarity index 100% rename from langchain/llms/human.py rename to libs/langchain/langchain/llms/human.py diff --git a/langchain/llms/koboldai.py b/libs/langchain/langchain/llms/koboldai.py similarity index 100% rename from langchain/llms/koboldai.py rename to libs/langchain/langchain/llms/koboldai.py diff --git a/langchain/llms/llamacpp.py b/libs/langchain/langchain/llms/llamacpp.py similarity index 100% rename from langchain/llms/llamacpp.py rename to libs/langchain/langchain/llms/llamacpp.py diff --git a/langchain/llms/loading.py b/libs/langchain/langchain/llms/loading.py similarity index 100% rename from langchain/llms/loading.py rename to libs/langchain/langchain/llms/loading.py diff --git a/langchain/llms/manifest.py b/libs/langchain/langchain/llms/manifest.py similarity index 100% rename from langchain/llms/manifest.py rename to libs/langchain/langchain/llms/manifest.py diff --git a/langchain/llms/modal.py b/libs/langchain/langchain/llms/modal.py similarity index 100% rename from langchain/llms/modal.py rename to libs/langchain/langchain/llms/modal.py diff --git a/langchain/llms/mosaicml.py b/libs/langchain/langchain/llms/mosaicml.py similarity index 100% rename from langchain/llms/mosaicml.py rename to libs/langchain/langchain/llms/mosaicml.py diff --git a/langchain/llms/nlpcloud.py b/libs/langchain/langchain/llms/nlpcloud.py similarity index 100% rename from langchain/llms/nlpcloud.py rename to libs/langchain/langchain/llms/nlpcloud.py diff --git a/langchain/llms/octoai_endpoint.py b/libs/langchain/langchain/llms/octoai_endpoint.py similarity index 100% rename from langchain/llms/octoai_endpoint.py rename to libs/langchain/langchain/llms/octoai_endpoint.py diff --git a/langchain/llms/openai.py b/libs/langchain/langchain/llms/openai.py similarity index 100% rename from langchain/llms/openai.py rename to libs/langchain/langchain/llms/openai.py diff --git a/langchain/llms/openllm.py b/libs/langchain/langchain/llms/openllm.py similarity index 100% rename from langchain/llms/openllm.py rename to libs/langchain/langchain/llms/openllm.py diff --git a/langchain/llms/openlm.py b/libs/langchain/langchain/llms/openlm.py similarity index 100% rename from langchain/llms/openlm.py rename to libs/langchain/langchain/llms/openlm.py diff --git a/langchain/llms/petals.py b/libs/langchain/langchain/llms/petals.py similarity index 100% rename from langchain/llms/petals.py rename to libs/langchain/langchain/llms/petals.py diff --git a/langchain/llms/pipelineai.py b/libs/langchain/langchain/llms/pipelineai.py similarity index 100% rename from langchain/llms/pipelineai.py rename to libs/langchain/langchain/llms/pipelineai.py diff --git a/langchain/llms/predictionguard.py b/libs/langchain/langchain/llms/predictionguard.py similarity index 100% rename from langchain/llms/predictionguard.py rename to libs/langchain/langchain/llms/predictionguard.py diff --git a/langchain/llms/promptlayer_openai.py b/libs/langchain/langchain/llms/promptlayer_openai.py similarity index 100% rename from langchain/llms/promptlayer_openai.py rename to libs/langchain/langchain/llms/promptlayer_openai.py diff --git a/langchain/llms/replicate.py b/libs/langchain/langchain/llms/replicate.py similarity index 100% rename from langchain/llms/replicate.py rename to libs/langchain/langchain/llms/replicate.py diff --git a/langchain/llms/rwkv.py b/libs/langchain/langchain/llms/rwkv.py similarity index 100% rename from langchain/llms/rwkv.py rename to libs/langchain/langchain/llms/rwkv.py diff --git a/langchain/llms/sagemaker_endpoint.py b/libs/langchain/langchain/llms/sagemaker_endpoint.py similarity index 100% rename from langchain/llms/sagemaker_endpoint.py rename to libs/langchain/langchain/llms/sagemaker_endpoint.py diff --git a/langchain/llms/self_hosted.py b/libs/langchain/langchain/llms/self_hosted.py similarity index 100% rename from langchain/llms/self_hosted.py rename to libs/langchain/langchain/llms/self_hosted.py diff --git a/langchain/llms/self_hosted_hugging_face.py b/libs/langchain/langchain/llms/self_hosted_hugging_face.py similarity index 100% rename from langchain/llms/self_hosted_hugging_face.py rename to libs/langchain/langchain/llms/self_hosted_hugging_face.py diff --git a/langchain/llms/stochasticai.py b/libs/langchain/langchain/llms/stochasticai.py similarity index 100% rename from langchain/llms/stochasticai.py rename to libs/langchain/langchain/llms/stochasticai.py diff --git a/langchain/llms/textgen.py b/libs/langchain/langchain/llms/textgen.py similarity index 100% rename from langchain/llms/textgen.py rename to libs/langchain/langchain/llms/textgen.py diff --git a/langchain/llms/tongyi.py b/libs/langchain/langchain/llms/tongyi.py similarity index 100% rename from langchain/llms/tongyi.py rename to libs/langchain/langchain/llms/tongyi.py diff --git a/langchain/llms/utils.py b/libs/langchain/langchain/llms/utils.py similarity index 100% rename from langchain/llms/utils.py rename to libs/langchain/langchain/llms/utils.py diff --git a/langchain/llms/vertexai.py b/libs/langchain/langchain/llms/vertexai.py similarity index 100% rename from langchain/llms/vertexai.py rename to libs/langchain/langchain/llms/vertexai.py diff --git a/langchain/llms/writer.py b/libs/langchain/langchain/llms/writer.py similarity index 100% rename from langchain/llms/writer.py rename to libs/langchain/langchain/llms/writer.py diff --git a/langchain/load/__init__.py b/libs/langchain/langchain/load/__init__.py similarity index 100% rename from langchain/load/__init__.py rename to libs/langchain/langchain/load/__init__.py diff --git a/langchain/load/dump.py b/libs/langchain/langchain/load/dump.py similarity index 100% rename from langchain/load/dump.py rename to libs/langchain/langchain/load/dump.py diff --git a/langchain/load/load.py b/libs/langchain/langchain/load/load.py similarity index 100% rename from langchain/load/load.py rename to libs/langchain/langchain/load/load.py diff --git a/langchain/load/serializable.py b/libs/langchain/langchain/load/serializable.py similarity index 100% rename from langchain/load/serializable.py rename to libs/langchain/langchain/load/serializable.py diff --git a/langchain/math_utils.py b/libs/langchain/langchain/math_utils.py similarity index 100% rename from langchain/math_utils.py rename to libs/langchain/langchain/math_utils.py diff --git a/langchain/memory/__init__.py b/libs/langchain/langchain/memory/__init__.py similarity index 100% rename from langchain/memory/__init__.py rename to libs/langchain/langchain/memory/__init__.py diff --git a/langchain/memory/buffer.py b/libs/langchain/langchain/memory/buffer.py similarity index 100% rename from langchain/memory/buffer.py rename to libs/langchain/langchain/memory/buffer.py diff --git a/langchain/memory/buffer_window.py b/libs/langchain/langchain/memory/buffer_window.py similarity index 100% rename from langchain/memory/buffer_window.py rename to libs/langchain/langchain/memory/buffer_window.py diff --git a/langchain/memory/chat_memory.py b/libs/langchain/langchain/memory/chat_memory.py similarity index 100% rename from langchain/memory/chat_memory.py rename to libs/langchain/langchain/memory/chat_memory.py diff --git a/langchain/memory/chat_message_histories/__init__.py b/libs/langchain/langchain/memory/chat_message_histories/__init__.py similarity index 100% rename from langchain/memory/chat_message_histories/__init__.py rename to libs/langchain/langchain/memory/chat_message_histories/__init__.py diff --git a/langchain/memory/chat_message_histories/cassandra.py b/libs/langchain/langchain/memory/chat_message_histories/cassandra.py similarity index 100% rename from langchain/memory/chat_message_histories/cassandra.py rename to libs/langchain/langchain/memory/chat_message_histories/cassandra.py diff --git a/langchain/memory/chat_message_histories/cosmos_db.py b/libs/langchain/langchain/memory/chat_message_histories/cosmos_db.py similarity index 100% rename from langchain/memory/chat_message_histories/cosmos_db.py rename to libs/langchain/langchain/memory/chat_message_histories/cosmos_db.py diff --git a/langchain/memory/chat_message_histories/dynamodb.py b/libs/langchain/langchain/memory/chat_message_histories/dynamodb.py similarity index 100% rename from langchain/memory/chat_message_histories/dynamodb.py rename to libs/langchain/langchain/memory/chat_message_histories/dynamodb.py diff --git a/langchain/memory/chat_message_histories/file.py b/libs/langchain/langchain/memory/chat_message_histories/file.py similarity index 100% rename from langchain/memory/chat_message_histories/file.py rename to libs/langchain/langchain/memory/chat_message_histories/file.py diff --git a/langchain/memory/chat_message_histories/firestore.py b/libs/langchain/langchain/memory/chat_message_histories/firestore.py similarity index 100% rename from langchain/memory/chat_message_histories/firestore.py rename to libs/langchain/langchain/memory/chat_message_histories/firestore.py diff --git a/langchain/memory/chat_message_histories/in_memory.py b/libs/langchain/langchain/memory/chat_message_histories/in_memory.py similarity index 100% rename from langchain/memory/chat_message_histories/in_memory.py rename to libs/langchain/langchain/memory/chat_message_histories/in_memory.py diff --git a/langchain/memory/chat_message_histories/momento.py b/libs/langchain/langchain/memory/chat_message_histories/momento.py similarity index 100% rename from langchain/memory/chat_message_histories/momento.py rename to libs/langchain/langchain/memory/chat_message_histories/momento.py diff --git a/langchain/memory/chat_message_histories/mongodb.py b/libs/langchain/langchain/memory/chat_message_histories/mongodb.py similarity index 100% rename from langchain/memory/chat_message_histories/mongodb.py rename to libs/langchain/langchain/memory/chat_message_histories/mongodb.py diff --git a/langchain/memory/chat_message_histories/postgres.py b/libs/langchain/langchain/memory/chat_message_histories/postgres.py similarity index 100% rename from langchain/memory/chat_message_histories/postgres.py rename to libs/langchain/langchain/memory/chat_message_histories/postgres.py diff --git a/langchain/memory/chat_message_histories/redis.py b/libs/langchain/langchain/memory/chat_message_histories/redis.py similarity index 100% rename from langchain/memory/chat_message_histories/redis.py rename to libs/langchain/langchain/memory/chat_message_histories/redis.py diff --git a/langchain/memory/chat_message_histories/sql.py b/libs/langchain/langchain/memory/chat_message_histories/sql.py similarity index 100% rename from langchain/memory/chat_message_histories/sql.py rename to libs/langchain/langchain/memory/chat_message_histories/sql.py diff --git a/langchain/memory/chat_message_histories/zep.py b/libs/langchain/langchain/memory/chat_message_histories/zep.py similarity index 100% rename from langchain/memory/chat_message_histories/zep.py rename to libs/langchain/langchain/memory/chat_message_histories/zep.py diff --git a/langchain/memory/combined.py b/libs/langchain/langchain/memory/combined.py similarity index 100% rename from langchain/memory/combined.py rename to libs/langchain/langchain/memory/combined.py diff --git a/langchain/memory/entity.py b/libs/langchain/langchain/memory/entity.py similarity index 100% rename from langchain/memory/entity.py rename to libs/langchain/langchain/memory/entity.py diff --git a/langchain/memory/kg.py b/libs/langchain/langchain/memory/kg.py similarity index 100% rename from langchain/memory/kg.py rename to libs/langchain/langchain/memory/kg.py diff --git a/langchain/memory/motorhead_memory.py b/libs/langchain/langchain/memory/motorhead_memory.py similarity index 100% rename from langchain/memory/motorhead_memory.py rename to libs/langchain/langchain/memory/motorhead_memory.py diff --git a/langchain/memory/prompt.py b/libs/langchain/langchain/memory/prompt.py similarity index 100% rename from langchain/memory/prompt.py rename to libs/langchain/langchain/memory/prompt.py diff --git a/langchain/memory/readonly.py b/libs/langchain/langchain/memory/readonly.py similarity index 100% rename from langchain/memory/readonly.py rename to libs/langchain/langchain/memory/readonly.py diff --git a/langchain/memory/simple.py b/libs/langchain/langchain/memory/simple.py similarity index 100% rename from langchain/memory/simple.py rename to libs/langchain/langchain/memory/simple.py diff --git a/langchain/memory/summary.py b/libs/langchain/langchain/memory/summary.py similarity index 100% rename from langchain/memory/summary.py rename to libs/langchain/langchain/memory/summary.py diff --git a/langchain/memory/summary_buffer.py b/libs/langchain/langchain/memory/summary_buffer.py similarity index 100% rename from langchain/memory/summary_buffer.py rename to libs/langchain/langchain/memory/summary_buffer.py diff --git a/langchain/memory/token_buffer.py b/libs/langchain/langchain/memory/token_buffer.py similarity index 100% rename from langchain/memory/token_buffer.py rename to libs/langchain/langchain/memory/token_buffer.py diff --git a/langchain/memory/utils.py b/libs/langchain/langchain/memory/utils.py similarity index 100% rename from langchain/memory/utils.py rename to libs/langchain/langchain/memory/utils.py diff --git a/langchain/memory/vectorstore.py b/libs/langchain/langchain/memory/vectorstore.py similarity index 100% rename from langchain/memory/vectorstore.py rename to libs/langchain/langchain/memory/vectorstore.py diff --git a/langchain/memory/zep_memory.py b/libs/langchain/langchain/memory/zep_memory.py similarity index 100% rename from langchain/memory/zep_memory.py rename to libs/langchain/langchain/memory/zep_memory.py diff --git a/langchain/model_laboratory.py b/libs/langchain/langchain/model_laboratory.py similarity index 100% rename from langchain/model_laboratory.py rename to libs/langchain/langchain/model_laboratory.py diff --git a/langchain/output_parsers/__init__.py b/libs/langchain/langchain/output_parsers/__init__.py similarity index 100% rename from langchain/output_parsers/__init__.py rename to libs/langchain/langchain/output_parsers/__init__.py diff --git a/langchain/output_parsers/boolean.py b/libs/langchain/langchain/output_parsers/boolean.py similarity index 100% rename from langchain/output_parsers/boolean.py rename to libs/langchain/langchain/output_parsers/boolean.py diff --git a/langchain/output_parsers/combining.py b/libs/langchain/langchain/output_parsers/combining.py similarity index 100% rename from langchain/output_parsers/combining.py rename to libs/langchain/langchain/output_parsers/combining.py diff --git a/langchain/output_parsers/datetime.py b/libs/langchain/langchain/output_parsers/datetime.py similarity index 100% rename from langchain/output_parsers/datetime.py rename to libs/langchain/langchain/output_parsers/datetime.py diff --git a/langchain/output_parsers/enum.py b/libs/langchain/langchain/output_parsers/enum.py similarity index 100% rename from langchain/output_parsers/enum.py rename to libs/langchain/langchain/output_parsers/enum.py diff --git a/langchain/output_parsers/fix.py b/libs/langchain/langchain/output_parsers/fix.py similarity index 100% rename from langchain/output_parsers/fix.py rename to libs/langchain/langchain/output_parsers/fix.py diff --git a/langchain/output_parsers/format_instructions.py b/libs/langchain/langchain/output_parsers/format_instructions.py similarity index 100% rename from langchain/output_parsers/format_instructions.py rename to libs/langchain/langchain/output_parsers/format_instructions.py diff --git a/langchain/output_parsers/json.py b/libs/langchain/langchain/output_parsers/json.py similarity index 100% rename from langchain/output_parsers/json.py rename to libs/langchain/langchain/output_parsers/json.py diff --git a/langchain/output_parsers/list.py b/libs/langchain/langchain/output_parsers/list.py similarity index 100% rename from langchain/output_parsers/list.py rename to libs/langchain/langchain/output_parsers/list.py diff --git a/langchain/output_parsers/loading.py b/libs/langchain/langchain/output_parsers/loading.py similarity index 100% rename from langchain/output_parsers/loading.py rename to libs/langchain/langchain/output_parsers/loading.py diff --git a/langchain/output_parsers/openai_functions.py b/libs/langchain/langchain/output_parsers/openai_functions.py similarity index 100% rename from langchain/output_parsers/openai_functions.py rename to libs/langchain/langchain/output_parsers/openai_functions.py diff --git a/langchain/output_parsers/prompts.py b/libs/langchain/langchain/output_parsers/prompts.py similarity index 100% rename from langchain/output_parsers/prompts.py rename to libs/langchain/langchain/output_parsers/prompts.py diff --git a/langchain/output_parsers/pydantic.py b/libs/langchain/langchain/output_parsers/pydantic.py similarity index 100% rename from langchain/output_parsers/pydantic.py rename to libs/langchain/langchain/output_parsers/pydantic.py diff --git a/langchain/output_parsers/rail_parser.py b/libs/langchain/langchain/output_parsers/rail_parser.py similarity index 100% rename from langchain/output_parsers/rail_parser.py rename to libs/langchain/langchain/output_parsers/rail_parser.py diff --git a/langchain/output_parsers/regex.py b/libs/langchain/langchain/output_parsers/regex.py similarity index 100% rename from langchain/output_parsers/regex.py rename to libs/langchain/langchain/output_parsers/regex.py diff --git a/langchain/output_parsers/regex_dict.py b/libs/langchain/langchain/output_parsers/regex_dict.py similarity index 100% rename from langchain/output_parsers/regex_dict.py rename to libs/langchain/langchain/output_parsers/regex_dict.py diff --git a/langchain/output_parsers/retry.py b/libs/langchain/langchain/output_parsers/retry.py similarity index 100% rename from langchain/output_parsers/retry.py rename to libs/langchain/langchain/output_parsers/retry.py diff --git a/langchain/output_parsers/structured.py b/libs/langchain/langchain/output_parsers/structured.py similarity index 100% rename from langchain/output_parsers/structured.py rename to libs/langchain/langchain/output_parsers/structured.py diff --git a/langchain/prompts/__init__.py b/libs/langchain/langchain/prompts/__init__.py similarity index 100% rename from langchain/prompts/__init__.py rename to libs/langchain/langchain/prompts/__init__.py diff --git a/langchain/prompts/base.py b/libs/langchain/langchain/prompts/base.py similarity index 100% rename from langchain/prompts/base.py rename to libs/langchain/langchain/prompts/base.py diff --git a/langchain/prompts/chat.py b/libs/langchain/langchain/prompts/chat.py similarity index 100% rename from langchain/prompts/chat.py rename to libs/langchain/langchain/prompts/chat.py diff --git a/langchain/prompts/example_selector/__init__.py b/libs/langchain/langchain/prompts/example_selector/__init__.py similarity index 100% rename from langchain/prompts/example_selector/__init__.py rename to libs/langchain/langchain/prompts/example_selector/__init__.py diff --git a/langchain/prompts/example_selector/base.py b/libs/langchain/langchain/prompts/example_selector/base.py similarity index 100% rename from langchain/prompts/example_selector/base.py rename to libs/langchain/langchain/prompts/example_selector/base.py diff --git a/langchain/prompts/example_selector/length_based.py b/libs/langchain/langchain/prompts/example_selector/length_based.py similarity index 100% rename from langchain/prompts/example_selector/length_based.py rename to libs/langchain/langchain/prompts/example_selector/length_based.py diff --git a/langchain/prompts/example_selector/ngram_overlap.py b/libs/langchain/langchain/prompts/example_selector/ngram_overlap.py similarity index 100% rename from langchain/prompts/example_selector/ngram_overlap.py rename to libs/langchain/langchain/prompts/example_selector/ngram_overlap.py diff --git a/langchain/prompts/example_selector/semantic_similarity.py b/libs/langchain/langchain/prompts/example_selector/semantic_similarity.py similarity index 100% rename from langchain/prompts/example_selector/semantic_similarity.py rename to libs/langchain/langchain/prompts/example_selector/semantic_similarity.py diff --git a/langchain/prompts/few_shot.py b/libs/langchain/langchain/prompts/few_shot.py similarity index 100% rename from langchain/prompts/few_shot.py rename to libs/langchain/langchain/prompts/few_shot.py diff --git a/langchain/prompts/few_shot_with_templates.py b/libs/langchain/langchain/prompts/few_shot_with_templates.py similarity index 100% rename from langchain/prompts/few_shot_with_templates.py rename to libs/langchain/langchain/prompts/few_shot_with_templates.py diff --git a/langchain/prompts/loading.py b/libs/langchain/langchain/prompts/loading.py similarity index 100% rename from langchain/prompts/loading.py rename to libs/langchain/langchain/prompts/loading.py diff --git a/langchain/prompts/pipeline.py b/libs/langchain/langchain/prompts/pipeline.py similarity index 100% rename from langchain/prompts/pipeline.py rename to libs/langchain/langchain/prompts/pipeline.py diff --git a/langchain/prompts/prompt.py b/libs/langchain/langchain/prompts/prompt.py similarity index 100% rename from langchain/prompts/prompt.py rename to libs/langchain/langchain/prompts/prompt.py diff --git a/langchain/py.typed b/libs/langchain/langchain/py.typed similarity index 100% rename from langchain/py.typed rename to libs/langchain/langchain/py.typed diff --git a/langchain/python.py b/libs/langchain/langchain/python.py similarity index 100% rename from langchain/python.py rename to libs/langchain/langchain/python.py diff --git a/langchain/requests.py b/libs/langchain/langchain/requests.py similarity index 100% rename from langchain/requests.py rename to libs/langchain/langchain/requests.py diff --git a/langchain/retrievers/__init__.py b/libs/langchain/langchain/retrievers/__init__.py similarity index 100% rename from langchain/retrievers/__init__.py rename to libs/langchain/langchain/retrievers/__init__.py diff --git a/langchain/retrievers/arxiv.py b/libs/langchain/langchain/retrievers/arxiv.py similarity index 100% rename from langchain/retrievers/arxiv.py rename to libs/langchain/langchain/retrievers/arxiv.py diff --git a/langchain/retrievers/azure_cognitive_search.py b/libs/langchain/langchain/retrievers/azure_cognitive_search.py similarity index 100% rename from langchain/retrievers/azure_cognitive_search.py rename to libs/langchain/langchain/retrievers/azure_cognitive_search.py diff --git a/langchain/retrievers/chaindesk.py b/libs/langchain/langchain/retrievers/chaindesk.py similarity index 100% rename from langchain/retrievers/chaindesk.py rename to libs/langchain/langchain/retrievers/chaindesk.py diff --git a/langchain/retrievers/chatgpt_plugin_retriever.py b/libs/langchain/langchain/retrievers/chatgpt_plugin_retriever.py similarity index 100% rename from langchain/retrievers/chatgpt_plugin_retriever.py rename to libs/langchain/langchain/retrievers/chatgpt_plugin_retriever.py diff --git a/langchain/retrievers/contextual_compression.py b/libs/langchain/langchain/retrievers/contextual_compression.py similarity index 100% rename from langchain/retrievers/contextual_compression.py rename to libs/langchain/langchain/retrievers/contextual_compression.py diff --git a/langchain/retrievers/databerry.py b/libs/langchain/langchain/retrievers/databerry.py similarity index 100% rename from langchain/retrievers/databerry.py rename to libs/langchain/langchain/retrievers/databerry.py diff --git a/langchain/retrievers/docarray.py b/libs/langchain/langchain/retrievers/docarray.py similarity index 100% rename from langchain/retrievers/docarray.py rename to libs/langchain/langchain/retrievers/docarray.py diff --git a/langchain/retrievers/document_compressors/__init__.py b/libs/langchain/langchain/retrievers/document_compressors/__init__.py similarity index 100% rename from langchain/retrievers/document_compressors/__init__.py rename to libs/langchain/langchain/retrievers/document_compressors/__init__.py diff --git a/langchain/retrievers/document_compressors/base.py b/libs/langchain/langchain/retrievers/document_compressors/base.py similarity index 100% rename from langchain/retrievers/document_compressors/base.py rename to libs/langchain/langchain/retrievers/document_compressors/base.py diff --git a/langchain/retrievers/document_compressors/chain_extract.py b/libs/langchain/langchain/retrievers/document_compressors/chain_extract.py similarity index 100% rename from langchain/retrievers/document_compressors/chain_extract.py rename to libs/langchain/langchain/retrievers/document_compressors/chain_extract.py diff --git a/langchain/retrievers/document_compressors/chain_extract_prompt.py b/libs/langchain/langchain/retrievers/document_compressors/chain_extract_prompt.py similarity index 100% rename from langchain/retrievers/document_compressors/chain_extract_prompt.py rename to libs/langchain/langchain/retrievers/document_compressors/chain_extract_prompt.py diff --git a/langchain/retrievers/document_compressors/chain_filter.py b/libs/langchain/langchain/retrievers/document_compressors/chain_filter.py similarity index 100% rename from langchain/retrievers/document_compressors/chain_filter.py rename to libs/langchain/langchain/retrievers/document_compressors/chain_filter.py diff --git a/langchain/retrievers/document_compressors/chain_filter_prompt.py b/libs/langchain/langchain/retrievers/document_compressors/chain_filter_prompt.py similarity index 100% rename from langchain/retrievers/document_compressors/chain_filter_prompt.py rename to libs/langchain/langchain/retrievers/document_compressors/chain_filter_prompt.py diff --git a/langchain/retrievers/document_compressors/cohere_rerank.py b/libs/langchain/langchain/retrievers/document_compressors/cohere_rerank.py similarity index 100% rename from langchain/retrievers/document_compressors/cohere_rerank.py rename to libs/langchain/langchain/retrievers/document_compressors/cohere_rerank.py diff --git a/langchain/retrievers/document_compressors/embeddings_filter.py b/libs/langchain/langchain/retrievers/document_compressors/embeddings_filter.py similarity index 100% rename from langchain/retrievers/document_compressors/embeddings_filter.py rename to libs/langchain/langchain/retrievers/document_compressors/embeddings_filter.py diff --git a/langchain/retrievers/elastic_search_bm25.py b/libs/langchain/langchain/retrievers/elastic_search_bm25.py similarity index 100% rename from langchain/retrievers/elastic_search_bm25.py rename to libs/langchain/langchain/retrievers/elastic_search_bm25.py diff --git a/langchain/retrievers/kendra.py b/libs/langchain/langchain/retrievers/kendra.py similarity index 100% rename from langchain/retrievers/kendra.py rename to libs/langchain/langchain/retrievers/kendra.py diff --git a/langchain/retrievers/knn.py b/libs/langchain/langchain/retrievers/knn.py similarity index 100% rename from langchain/retrievers/knn.py rename to libs/langchain/langchain/retrievers/knn.py diff --git a/langchain/retrievers/llama_index.py b/libs/langchain/langchain/retrievers/llama_index.py similarity index 100% rename from langchain/retrievers/llama_index.py rename to libs/langchain/langchain/retrievers/llama_index.py diff --git a/langchain/retrievers/merger_retriever.py b/libs/langchain/langchain/retrievers/merger_retriever.py similarity index 100% rename from langchain/retrievers/merger_retriever.py rename to libs/langchain/langchain/retrievers/merger_retriever.py diff --git a/langchain/retrievers/metal.py b/libs/langchain/langchain/retrievers/metal.py similarity index 100% rename from langchain/retrievers/metal.py rename to libs/langchain/langchain/retrievers/metal.py diff --git a/langchain/retrievers/milvus.py b/libs/langchain/langchain/retrievers/milvus.py similarity index 100% rename from langchain/retrievers/milvus.py rename to libs/langchain/langchain/retrievers/milvus.py diff --git a/langchain/retrievers/multi_query.py b/libs/langchain/langchain/retrievers/multi_query.py similarity index 100% rename from langchain/retrievers/multi_query.py rename to libs/langchain/langchain/retrievers/multi_query.py diff --git a/langchain/retrievers/pinecone_hybrid_search.py b/libs/langchain/langchain/retrievers/pinecone_hybrid_search.py similarity index 100% rename from langchain/retrievers/pinecone_hybrid_search.py rename to libs/langchain/langchain/retrievers/pinecone_hybrid_search.py diff --git a/langchain/retrievers/pubmed.py b/libs/langchain/langchain/retrievers/pubmed.py similarity index 100% rename from langchain/retrievers/pubmed.py rename to libs/langchain/langchain/retrievers/pubmed.py diff --git a/langchain/retrievers/pupmed.py b/libs/langchain/langchain/retrievers/pupmed.py similarity index 100% rename from langchain/retrievers/pupmed.py rename to libs/langchain/langchain/retrievers/pupmed.py diff --git a/langchain/retrievers/remote_retriever.py b/libs/langchain/langchain/retrievers/remote_retriever.py similarity index 100% rename from langchain/retrievers/remote_retriever.py rename to libs/langchain/langchain/retrievers/remote_retriever.py diff --git a/langchain/retrievers/self_query/__init__.py b/libs/langchain/langchain/retrievers/self_query/__init__.py similarity index 100% rename from langchain/retrievers/self_query/__init__.py rename to libs/langchain/langchain/retrievers/self_query/__init__.py diff --git a/langchain/retrievers/self_query/base.py b/libs/langchain/langchain/retrievers/self_query/base.py similarity index 100% rename from langchain/retrievers/self_query/base.py rename to libs/langchain/langchain/retrievers/self_query/base.py diff --git a/langchain/retrievers/self_query/chroma.py b/libs/langchain/langchain/retrievers/self_query/chroma.py similarity index 100% rename from langchain/retrievers/self_query/chroma.py rename to libs/langchain/langchain/retrievers/self_query/chroma.py diff --git a/langchain/retrievers/self_query/myscale.py b/libs/langchain/langchain/retrievers/self_query/myscale.py similarity index 100% rename from langchain/retrievers/self_query/myscale.py rename to libs/langchain/langchain/retrievers/self_query/myscale.py diff --git a/langchain/retrievers/self_query/pinecone.py b/libs/langchain/langchain/retrievers/self_query/pinecone.py similarity index 100% rename from langchain/retrievers/self_query/pinecone.py rename to libs/langchain/langchain/retrievers/self_query/pinecone.py diff --git a/langchain/retrievers/self_query/qdrant.py b/libs/langchain/langchain/retrievers/self_query/qdrant.py similarity index 100% rename from langchain/retrievers/self_query/qdrant.py rename to libs/langchain/langchain/retrievers/self_query/qdrant.py diff --git a/langchain/retrievers/self_query/weaviate.py b/libs/langchain/langchain/retrievers/self_query/weaviate.py similarity index 100% rename from langchain/retrievers/self_query/weaviate.py rename to libs/langchain/langchain/retrievers/self_query/weaviate.py diff --git a/langchain/retrievers/svm.py b/libs/langchain/langchain/retrievers/svm.py similarity index 100% rename from langchain/retrievers/svm.py rename to libs/langchain/langchain/retrievers/svm.py diff --git a/langchain/retrievers/tfidf.py b/libs/langchain/langchain/retrievers/tfidf.py similarity index 100% rename from langchain/retrievers/tfidf.py rename to libs/langchain/langchain/retrievers/tfidf.py diff --git a/langchain/retrievers/time_weighted_retriever.py b/libs/langchain/langchain/retrievers/time_weighted_retriever.py similarity index 100% rename from langchain/retrievers/time_weighted_retriever.py rename to libs/langchain/langchain/retrievers/time_weighted_retriever.py diff --git a/langchain/retrievers/vespa_retriever.py b/libs/langchain/langchain/retrievers/vespa_retriever.py similarity index 100% rename from langchain/retrievers/vespa_retriever.py rename to libs/langchain/langchain/retrievers/vespa_retriever.py diff --git a/langchain/retrievers/weaviate_hybrid_search.py b/libs/langchain/langchain/retrievers/weaviate_hybrid_search.py similarity index 100% rename from langchain/retrievers/weaviate_hybrid_search.py rename to libs/langchain/langchain/retrievers/weaviate_hybrid_search.py diff --git a/langchain/retrievers/wikipedia.py b/libs/langchain/langchain/retrievers/wikipedia.py similarity index 100% rename from langchain/retrievers/wikipedia.py rename to libs/langchain/langchain/retrievers/wikipedia.py diff --git a/langchain/retrievers/zep.py b/libs/langchain/langchain/retrievers/zep.py similarity index 100% rename from langchain/retrievers/zep.py rename to libs/langchain/langchain/retrievers/zep.py diff --git a/langchain/retrievers/zilliz.py b/libs/langchain/langchain/retrievers/zilliz.py similarity index 100% rename from langchain/retrievers/zilliz.py rename to libs/langchain/langchain/retrievers/zilliz.py diff --git a/langchain/schema/__init__.py b/libs/langchain/langchain/schema/__init__.py similarity index 100% rename from langchain/schema/__init__.py rename to libs/langchain/langchain/schema/__init__.py diff --git a/langchain/schema/agent.py b/libs/langchain/langchain/schema/agent.py similarity index 100% rename from langchain/schema/agent.py rename to libs/langchain/langchain/schema/agent.py diff --git a/langchain/schema/document.py b/libs/langchain/langchain/schema/document.py similarity index 100% rename from langchain/schema/document.py rename to libs/langchain/langchain/schema/document.py diff --git a/langchain/schema/language_model.py b/libs/langchain/langchain/schema/language_model.py similarity index 100% rename from langchain/schema/language_model.py rename to libs/langchain/langchain/schema/language_model.py diff --git a/langchain/schema/memory.py b/libs/langchain/langchain/schema/memory.py similarity index 100% rename from langchain/schema/memory.py rename to libs/langchain/langchain/schema/memory.py diff --git a/langchain/schema/messages.py b/libs/langchain/langchain/schema/messages.py similarity index 100% rename from langchain/schema/messages.py rename to libs/langchain/langchain/schema/messages.py diff --git a/langchain/schema/output.py b/libs/langchain/langchain/schema/output.py similarity index 100% rename from langchain/schema/output.py rename to libs/langchain/langchain/schema/output.py diff --git a/langchain/schema/output_parser.py b/libs/langchain/langchain/schema/output_parser.py similarity index 100% rename from langchain/schema/output_parser.py rename to libs/langchain/langchain/schema/output_parser.py diff --git a/langchain/schema/prompt.py b/libs/langchain/langchain/schema/prompt.py similarity index 100% rename from langchain/schema/prompt.py rename to libs/langchain/langchain/schema/prompt.py diff --git a/langchain/schema/prompt_template.py b/libs/langchain/langchain/schema/prompt_template.py similarity index 100% rename from langchain/schema/prompt_template.py rename to libs/langchain/langchain/schema/prompt_template.py diff --git a/langchain/schema/retriever.py b/libs/langchain/langchain/schema/retriever.py similarity index 100% rename from langchain/schema/retriever.py rename to libs/langchain/langchain/schema/retriever.py diff --git a/langchain/serpapi.py b/libs/langchain/langchain/serpapi.py similarity index 100% rename from langchain/serpapi.py rename to libs/langchain/langchain/serpapi.py diff --git a/langchain/server.py b/libs/langchain/langchain/server.py similarity index 100% rename from langchain/server.py rename to libs/langchain/langchain/server.py diff --git a/langchain/smith/__init__.py b/libs/langchain/langchain/smith/__init__.py similarity index 100% rename from langchain/smith/__init__.py rename to libs/langchain/langchain/smith/__init__.py diff --git a/langchain/smith/evaluation/__init__.py b/libs/langchain/langchain/smith/evaluation/__init__.py similarity index 100% rename from langchain/smith/evaluation/__init__.py rename to libs/langchain/langchain/smith/evaluation/__init__.py diff --git a/langchain/smith/evaluation/config.py b/libs/langchain/langchain/smith/evaluation/config.py similarity index 100% rename from langchain/smith/evaluation/config.py rename to libs/langchain/langchain/smith/evaluation/config.py diff --git a/langchain/smith/evaluation/runner_utils.py b/libs/langchain/langchain/smith/evaluation/runner_utils.py similarity index 100% rename from langchain/smith/evaluation/runner_utils.py rename to libs/langchain/langchain/smith/evaluation/runner_utils.py diff --git a/langchain/smith/evaluation/string_run_evaluator.py b/libs/langchain/langchain/smith/evaluation/string_run_evaluator.py similarity index 100% rename from langchain/smith/evaluation/string_run_evaluator.py rename to libs/langchain/langchain/smith/evaluation/string_run_evaluator.py diff --git a/langchain/smith/evaluation/utils.py b/libs/langchain/langchain/smith/evaluation/utils.py similarity index 100% rename from langchain/smith/evaluation/utils.py rename to libs/langchain/langchain/smith/evaluation/utils.py diff --git a/langchain/sql_database.py b/libs/langchain/langchain/sql_database.py similarity index 100% rename from langchain/sql_database.py rename to libs/langchain/langchain/sql_database.py diff --git a/langchain/text_splitter.py b/libs/langchain/langchain/text_splitter.py similarity index 100% rename from langchain/text_splitter.py rename to libs/langchain/langchain/text_splitter.py diff --git a/langchain/tools/__init__.py b/libs/langchain/langchain/tools/__init__.py similarity index 100% rename from langchain/tools/__init__.py rename to libs/langchain/langchain/tools/__init__.py diff --git a/langchain/tools/arxiv/__init__.py b/libs/langchain/langchain/tools/arxiv/__init__.py similarity index 100% rename from langchain/tools/arxiv/__init__.py rename to libs/langchain/langchain/tools/arxiv/__init__.py diff --git a/langchain/tools/arxiv/tool.py b/libs/langchain/langchain/tools/arxiv/tool.py similarity index 100% rename from langchain/tools/arxiv/tool.py rename to libs/langchain/langchain/tools/arxiv/tool.py diff --git a/langchain/tools/azure_cognitive_services/__init__.py b/libs/langchain/langchain/tools/azure_cognitive_services/__init__.py similarity index 100% rename from langchain/tools/azure_cognitive_services/__init__.py rename to libs/langchain/langchain/tools/azure_cognitive_services/__init__.py diff --git a/langchain/tools/azure_cognitive_services/form_recognizer.py b/libs/langchain/langchain/tools/azure_cognitive_services/form_recognizer.py similarity index 100% rename from langchain/tools/azure_cognitive_services/form_recognizer.py rename to libs/langchain/langchain/tools/azure_cognitive_services/form_recognizer.py diff --git a/langchain/tools/azure_cognitive_services/image_analysis.py b/libs/langchain/langchain/tools/azure_cognitive_services/image_analysis.py similarity index 100% rename from langchain/tools/azure_cognitive_services/image_analysis.py rename to libs/langchain/langchain/tools/azure_cognitive_services/image_analysis.py diff --git a/langchain/tools/azure_cognitive_services/speech2text.py b/libs/langchain/langchain/tools/azure_cognitive_services/speech2text.py similarity index 100% rename from langchain/tools/azure_cognitive_services/speech2text.py rename to libs/langchain/langchain/tools/azure_cognitive_services/speech2text.py diff --git a/langchain/tools/azure_cognitive_services/text2speech.py b/libs/langchain/langchain/tools/azure_cognitive_services/text2speech.py similarity index 100% rename from langchain/tools/azure_cognitive_services/text2speech.py rename to libs/langchain/langchain/tools/azure_cognitive_services/text2speech.py diff --git a/langchain/tools/azure_cognitive_services/utils.py b/libs/langchain/langchain/tools/azure_cognitive_services/utils.py similarity index 100% rename from langchain/tools/azure_cognitive_services/utils.py rename to libs/langchain/langchain/tools/azure_cognitive_services/utils.py diff --git a/langchain/tools/base.py b/libs/langchain/langchain/tools/base.py similarity index 100% rename from langchain/tools/base.py rename to libs/langchain/langchain/tools/base.py diff --git a/langchain/tools/bing_search/__init__.py b/libs/langchain/langchain/tools/bing_search/__init__.py similarity index 100% rename from langchain/tools/bing_search/__init__.py rename to libs/langchain/langchain/tools/bing_search/__init__.py diff --git a/langchain/tools/bing_search/tool.py b/libs/langchain/langchain/tools/bing_search/tool.py similarity index 100% rename from langchain/tools/bing_search/tool.py rename to libs/langchain/langchain/tools/bing_search/tool.py diff --git a/langchain/tools/brave_search/__init__.py b/libs/langchain/langchain/tools/brave_search/__init__.py similarity index 100% rename from langchain/tools/brave_search/__init__.py rename to libs/langchain/langchain/tools/brave_search/__init__.py diff --git a/langchain/tools/brave_search/tool.py b/libs/langchain/langchain/tools/brave_search/tool.py similarity index 100% rename from langchain/tools/brave_search/tool.py rename to libs/langchain/langchain/tools/brave_search/tool.py diff --git a/langchain/tools/convert_to_openai.py b/libs/langchain/langchain/tools/convert_to_openai.py similarity index 100% rename from langchain/tools/convert_to_openai.py rename to libs/langchain/langchain/tools/convert_to_openai.py diff --git a/langchain/tools/dataforseo_api_search/__init__.py b/libs/langchain/langchain/tools/dataforseo_api_search/__init__.py similarity index 100% rename from langchain/tools/dataforseo_api_search/__init__.py rename to libs/langchain/langchain/tools/dataforseo_api_search/__init__.py diff --git a/langchain/tools/dataforseo_api_search/tool.py b/libs/langchain/langchain/tools/dataforseo_api_search/tool.py similarity index 100% rename from langchain/tools/dataforseo_api_search/tool.py rename to libs/langchain/langchain/tools/dataforseo_api_search/tool.py diff --git a/langchain/tools/ddg_search/__init__.py b/libs/langchain/langchain/tools/ddg_search/__init__.py similarity index 100% rename from langchain/tools/ddg_search/__init__.py rename to libs/langchain/langchain/tools/ddg_search/__init__.py diff --git a/langchain/tools/ddg_search/tool.py b/libs/langchain/langchain/tools/ddg_search/tool.py similarity index 100% rename from langchain/tools/ddg_search/tool.py rename to libs/langchain/langchain/tools/ddg_search/tool.py diff --git a/langchain/tools/file_management/__init__.py b/libs/langchain/langchain/tools/file_management/__init__.py similarity index 100% rename from langchain/tools/file_management/__init__.py rename to libs/langchain/langchain/tools/file_management/__init__.py diff --git a/langchain/tools/file_management/copy.py b/libs/langchain/langchain/tools/file_management/copy.py similarity index 100% rename from langchain/tools/file_management/copy.py rename to libs/langchain/langchain/tools/file_management/copy.py diff --git a/langchain/tools/file_management/delete.py b/libs/langchain/langchain/tools/file_management/delete.py similarity index 100% rename from langchain/tools/file_management/delete.py rename to libs/langchain/langchain/tools/file_management/delete.py diff --git a/langchain/tools/file_management/file_search.py b/libs/langchain/langchain/tools/file_management/file_search.py similarity index 100% rename from langchain/tools/file_management/file_search.py rename to libs/langchain/langchain/tools/file_management/file_search.py diff --git a/langchain/tools/file_management/list_dir.py b/libs/langchain/langchain/tools/file_management/list_dir.py similarity index 100% rename from langchain/tools/file_management/list_dir.py rename to libs/langchain/langchain/tools/file_management/list_dir.py diff --git a/langchain/tools/file_management/move.py b/libs/langchain/langchain/tools/file_management/move.py similarity index 100% rename from langchain/tools/file_management/move.py rename to libs/langchain/langchain/tools/file_management/move.py diff --git a/langchain/tools/file_management/read.py b/libs/langchain/langchain/tools/file_management/read.py similarity index 100% rename from langchain/tools/file_management/read.py rename to libs/langchain/langchain/tools/file_management/read.py diff --git a/langchain/tools/file_management/utils.py b/libs/langchain/langchain/tools/file_management/utils.py similarity index 100% rename from langchain/tools/file_management/utils.py rename to libs/langchain/langchain/tools/file_management/utils.py diff --git a/langchain/tools/file_management/write.py b/libs/langchain/langchain/tools/file_management/write.py similarity index 100% rename from langchain/tools/file_management/write.py rename to libs/langchain/langchain/tools/file_management/write.py diff --git a/langchain/tools/gmail/__init__.py b/libs/langchain/langchain/tools/gmail/__init__.py similarity index 100% rename from langchain/tools/gmail/__init__.py rename to libs/langchain/langchain/tools/gmail/__init__.py diff --git a/langchain/tools/gmail/base.py b/libs/langchain/langchain/tools/gmail/base.py similarity index 100% rename from langchain/tools/gmail/base.py rename to libs/langchain/langchain/tools/gmail/base.py diff --git a/langchain/tools/gmail/create_draft.py b/libs/langchain/langchain/tools/gmail/create_draft.py similarity index 100% rename from langchain/tools/gmail/create_draft.py rename to libs/langchain/langchain/tools/gmail/create_draft.py diff --git a/langchain/tools/gmail/get_message.py b/libs/langchain/langchain/tools/gmail/get_message.py similarity index 100% rename from langchain/tools/gmail/get_message.py rename to libs/langchain/langchain/tools/gmail/get_message.py diff --git a/langchain/tools/gmail/get_thread.py b/libs/langchain/langchain/tools/gmail/get_thread.py similarity index 100% rename from langchain/tools/gmail/get_thread.py rename to libs/langchain/langchain/tools/gmail/get_thread.py diff --git a/langchain/tools/gmail/search.py b/libs/langchain/langchain/tools/gmail/search.py similarity index 100% rename from langchain/tools/gmail/search.py rename to libs/langchain/langchain/tools/gmail/search.py diff --git a/langchain/tools/gmail/send_message.py b/libs/langchain/langchain/tools/gmail/send_message.py similarity index 100% rename from langchain/tools/gmail/send_message.py rename to libs/langchain/langchain/tools/gmail/send_message.py diff --git a/langchain/tools/gmail/utils.py b/libs/langchain/langchain/tools/gmail/utils.py similarity index 100% rename from langchain/tools/gmail/utils.py rename to libs/langchain/langchain/tools/gmail/utils.py diff --git a/langchain/tools/google_places/__init__.py b/libs/langchain/langchain/tools/google_places/__init__.py similarity index 100% rename from langchain/tools/google_places/__init__.py rename to libs/langchain/langchain/tools/google_places/__init__.py diff --git a/langchain/tools/google_places/tool.py b/libs/langchain/langchain/tools/google_places/tool.py similarity index 100% rename from langchain/tools/google_places/tool.py rename to libs/langchain/langchain/tools/google_places/tool.py diff --git a/langchain/tools/google_search/__init__.py b/libs/langchain/langchain/tools/google_search/__init__.py similarity index 100% rename from langchain/tools/google_search/__init__.py rename to libs/langchain/langchain/tools/google_search/__init__.py diff --git a/langchain/tools/google_search/tool.py b/libs/langchain/langchain/tools/google_search/tool.py similarity index 100% rename from langchain/tools/google_search/tool.py rename to libs/langchain/langchain/tools/google_search/tool.py diff --git a/langchain/tools/google_serper/__init__.py b/libs/langchain/langchain/tools/google_serper/__init__.py similarity index 100% rename from langchain/tools/google_serper/__init__.py rename to libs/langchain/langchain/tools/google_serper/__init__.py diff --git a/langchain/tools/google_serper/tool.py b/libs/langchain/langchain/tools/google_serper/tool.py similarity index 100% rename from langchain/tools/google_serper/tool.py rename to libs/langchain/langchain/tools/google_serper/tool.py diff --git a/langchain/tools/graphql/__init__.py b/libs/langchain/langchain/tools/graphql/__init__.py similarity index 100% rename from langchain/tools/graphql/__init__.py rename to libs/langchain/langchain/tools/graphql/__init__.py diff --git a/langchain/tools/graphql/tool.py b/libs/langchain/langchain/tools/graphql/tool.py similarity index 100% rename from langchain/tools/graphql/tool.py rename to libs/langchain/langchain/tools/graphql/tool.py diff --git a/langchain/tools/human/__init__.py b/libs/langchain/langchain/tools/human/__init__.py similarity index 100% rename from langchain/tools/human/__init__.py rename to libs/langchain/langchain/tools/human/__init__.py diff --git a/langchain/tools/human/tool.py b/libs/langchain/langchain/tools/human/tool.py similarity index 100% rename from langchain/tools/human/tool.py rename to libs/langchain/langchain/tools/human/tool.py diff --git a/langchain/tools/ifttt.py b/libs/langchain/langchain/tools/ifttt.py similarity index 100% rename from langchain/tools/ifttt.py rename to libs/langchain/langchain/tools/ifttt.py diff --git a/langchain/tools/interaction/__init__.py b/libs/langchain/langchain/tools/interaction/__init__.py similarity index 100% rename from langchain/tools/interaction/__init__.py rename to libs/langchain/langchain/tools/interaction/__init__.py diff --git a/langchain/tools/interaction/tool.py b/libs/langchain/langchain/tools/interaction/tool.py similarity index 100% rename from langchain/tools/interaction/tool.py rename to libs/langchain/langchain/tools/interaction/tool.py diff --git a/langchain/tools/jira/__init__.py b/libs/langchain/langchain/tools/jira/__init__.py similarity index 100% rename from langchain/tools/jira/__init__.py rename to libs/langchain/langchain/tools/jira/__init__.py diff --git a/langchain/tools/jira/prompt.py b/libs/langchain/langchain/tools/jira/prompt.py similarity index 100% rename from langchain/tools/jira/prompt.py rename to libs/langchain/langchain/tools/jira/prompt.py diff --git a/langchain/tools/jira/tool.py b/libs/langchain/langchain/tools/jira/tool.py similarity index 100% rename from langchain/tools/jira/tool.py rename to libs/langchain/langchain/tools/jira/tool.py diff --git a/langchain/tools/json/__init__.py b/libs/langchain/langchain/tools/json/__init__.py similarity index 100% rename from langchain/tools/json/__init__.py rename to libs/langchain/langchain/tools/json/__init__.py diff --git a/langchain/tools/json/tool.py b/libs/langchain/langchain/tools/json/tool.py similarity index 100% rename from langchain/tools/json/tool.py rename to libs/langchain/langchain/tools/json/tool.py diff --git a/langchain/tools/metaphor_search/__init__.py b/libs/langchain/langchain/tools/metaphor_search/__init__.py similarity index 100% rename from langchain/tools/metaphor_search/__init__.py rename to libs/langchain/langchain/tools/metaphor_search/__init__.py diff --git a/langchain/tools/metaphor_search/tool.py b/libs/langchain/langchain/tools/metaphor_search/tool.py similarity index 100% rename from langchain/tools/metaphor_search/tool.py rename to libs/langchain/langchain/tools/metaphor_search/tool.py diff --git a/langchain/tools/office365/__init__.py b/libs/langchain/langchain/tools/office365/__init__.py similarity index 100% rename from langchain/tools/office365/__init__.py rename to libs/langchain/langchain/tools/office365/__init__.py diff --git a/langchain/tools/office365/base.py b/libs/langchain/langchain/tools/office365/base.py similarity index 100% rename from langchain/tools/office365/base.py rename to libs/langchain/langchain/tools/office365/base.py diff --git a/langchain/tools/office365/create_draft_message.py b/libs/langchain/langchain/tools/office365/create_draft_message.py similarity index 100% rename from langchain/tools/office365/create_draft_message.py rename to libs/langchain/langchain/tools/office365/create_draft_message.py diff --git a/langchain/tools/office365/events_search.py b/libs/langchain/langchain/tools/office365/events_search.py similarity index 100% rename from langchain/tools/office365/events_search.py rename to libs/langchain/langchain/tools/office365/events_search.py diff --git a/langchain/tools/office365/messages_search.py b/libs/langchain/langchain/tools/office365/messages_search.py similarity index 100% rename from langchain/tools/office365/messages_search.py rename to libs/langchain/langchain/tools/office365/messages_search.py diff --git a/langchain/tools/office365/send_event.py b/libs/langchain/langchain/tools/office365/send_event.py similarity index 100% rename from langchain/tools/office365/send_event.py rename to libs/langchain/langchain/tools/office365/send_event.py diff --git a/langchain/tools/office365/send_message.py b/libs/langchain/langchain/tools/office365/send_message.py similarity index 100% rename from langchain/tools/office365/send_message.py rename to libs/langchain/langchain/tools/office365/send_message.py diff --git a/langchain/tools/office365/utils.py b/libs/langchain/langchain/tools/office365/utils.py similarity index 100% rename from langchain/tools/office365/utils.py rename to libs/langchain/langchain/tools/office365/utils.py diff --git a/langchain/tools/openapi/__init__.py b/libs/langchain/langchain/tools/openapi/__init__.py similarity index 100% rename from langchain/tools/openapi/__init__.py rename to libs/langchain/langchain/tools/openapi/__init__.py diff --git a/langchain/tools/openapi/utils/__init__.py b/libs/langchain/langchain/tools/openapi/utils/__init__.py similarity index 100% rename from langchain/tools/openapi/utils/__init__.py rename to libs/langchain/langchain/tools/openapi/utils/__init__.py diff --git a/langchain/tools/openapi/utils/api_models.py b/libs/langchain/langchain/tools/openapi/utils/api_models.py similarity index 100% rename from langchain/tools/openapi/utils/api_models.py rename to libs/langchain/langchain/tools/openapi/utils/api_models.py diff --git a/langchain/tools/openapi/utils/openapi_utils.py b/libs/langchain/langchain/tools/openapi/utils/openapi_utils.py similarity index 100% rename from langchain/tools/openapi/utils/openapi_utils.py rename to libs/langchain/langchain/tools/openapi/utils/openapi_utils.py diff --git a/langchain/tools/openweathermap/__init__.py b/libs/langchain/langchain/tools/openweathermap/__init__.py similarity index 100% rename from langchain/tools/openweathermap/__init__.py rename to libs/langchain/langchain/tools/openweathermap/__init__.py diff --git a/langchain/tools/openweathermap/tool.py b/libs/langchain/langchain/tools/openweathermap/tool.py similarity index 96% rename from langchain/tools/openweathermap/tool.py rename to libs/langchain/langchain/tools/openweathermap/tool.py index 03478e7ba3c..19d82fdf447 100644 --- a/langchain/tools/openweathermap/tool.py +++ b/libs/langchain/langchain/tools/openweathermap/tool.py @@ -1,41 +1,41 @@ -"""Tool for the OpenWeatherMap API.""" - -from typing import Optional - -from pydantic import Field - -from langchain.callbacks.manager import ( - AsyncCallbackManagerForToolRun, - CallbackManagerForToolRun, -) -from langchain.tools.base import BaseTool -from langchain.utilities import OpenWeatherMapAPIWrapper - - -class OpenWeatherMapQueryRun(BaseTool): - """Tool that adds the capability to query using the OpenWeatherMap API.""" - - api_wrapper: OpenWeatherMapAPIWrapper = Field( - default_factory=OpenWeatherMapAPIWrapper - ) - - name = "OpenWeatherMap" - description = ( - "A wrapper around OpenWeatherMap API. " - "Useful for fetching current weather information for a specified location. " - "Input should be a location string (e.g. London,GB)." - ) - - def _run( - self, location: str, run_manager: Optional[CallbackManagerForToolRun] = None - ) -> str: - """Use the OpenWeatherMap tool.""" - return self.api_wrapper.run(location) - - async def _arun( - self, - location: str, - run_manager: Optional[AsyncCallbackManagerForToolRun] = None, - ) -> str: - """Use the OpenWeatherMap tool asynchronously.""" - raise NotImplementedError("OpenWeatherMapQueryRun does not support async") +"""Tool for the OpenWeatherMap API.""" + +from typing import Optional + +from pydantic import Field + +from langchain.callbacks.manager import ( + AsyncCallbackManagerForToolRun, + CallbackManagerForToolRun, +) +from langchain.tools.base import BaseTool +from langchain.utilities import OpenWeatherMapAPIWrapper + + +class OpenWeatherMapQueryRun(BaseTool): + """Tool that adds the capability to query using the OpenWeatherMap API.""" + + api_wrapper: OpenWeatherMapAPIWrapper = Field( + default_factory=OpenWeatherMapAPIWrapper + ) + + name = "OpenWeatherMap" + description = ( + "A wrapper around OpenWeatherMap API. " + "Useful for fetching current weather information for a specified location. " + "Input should be a location string (e.g. London,GB)." + ) + + def _run( + self, location: str, run_manager: Optional[CallbackManagerForToolRun] = None + ) -> str: + """Use the OpenWeatherMap tool.""" + return self.api_wrapper.run(location) + + async def _arun( + self, + location: str, + run_manager: Optional[AsyncCallbackManagerForToolRun] = None, + ) -> str: + """Use the OpenWeatherMap tool asynchronously.""" + raise NotImplementedError("OpenWeatherMapQueryRun does not support async") diff --git a/langchain/tools/playwright/__init__.py b/libs/langchain/langchain/tools/playwright/__init__.py similarity index 100% rename from langchain/tools/playwright/__init__.py rename to libs/langchain/langchain/tools/playwright/__init__.py diff --git a/langchain/tools/playwright/base.py b/libs/langchain/langchain/tools/playwright/base.py similarity index 100% rename from langchain/tools/playwright/base.py rename to libs/langchain/langchain/tools/playwright/base.py diff --git a/langchain/tools/playwright/click.py b/libs/langchain/langchain/tools/playwright/click.py similarity index 100% rename from langchain/tools/playwright/click.py rename to libs/langchain/langchain/tools/playwright/click.py diff --git a/langchain/tools/playwright/current_page.py b/libs/langchain/langchain/tools/playwright/current_page.py similarity index 100% rename from langchain/tools/playwright/current_page.py rename to libs/langchain/langchain/tools/playwright/current_page.py diff --git a/langchain/tools/playwright/extract_hyperlinks.py b/libs/langchain/langchain/tools/playwright/extract_hyperlinks.py similarity index 100% rename from langchain/tools/playwright/extract_hyperlinks.py rename to libs/langchain/langchain/tools/playwright/extract_hyperlinks.py diff --git a/langchain/tools/playwright/extract_text.py b/libs/langchain/langchain/tools/playwright/extract_text.py similarity index 100% rename from langchain/tools/playwright/extract_text.py rename to libs/langchain/langchain/tools/playwright/extract_text.py diff --git a/langchain/tools/playwright/get_elements.py b/libs/langchain/langchain/tools/playwright/get_elements.py similarity index 100% rename from langchain/tools/playwright/get_elements.py rename to libs/langchain/langchain/tools/playwright/get_elements.py diff --git a/langchain/tools/playwright/navigate.py b/libs/langchain/langchain/tools/playwright/navigate.py similarity index 100% rename from langchain/tools/playwright/navigate.py rename to libs/langchain/langchain/tools/playwright/navigate.py diff --git a/langchain/tools/playwright/navigate_back.py b/libs/langchain/langchain/tools/playwright/navigate_back.py similarity index 100% rename from langchain/tools/playwright/navigate_back.py rename to libs/langchain/langchain/tools/playwright/navigate_back.py diff --git a/langchain/tools/playwright/utils.py b/libs/langchain/langchain/tools/playwright/utils.py similarity index 100% rename from langchain/tools/playwright/utils.py rename to libs/langchain/langchain/tools/playwright/utils.py diff --git a/langchain/tools/plugin.py b/libs/langchain/langchain/tools/plugin.py similarity index 100% rename from langchain/tools/plugin.py rename to libs/langchain/langchain/tools/plugin.py diff --git a/langchain/tools/powerbi/__init__.py b/libs/langchain/langchain/tools/powerbi/__init__.py similarity index 100% rename from langchain/tools/powerbi/__init__.py rename to libs/langchain/langchain/tools/powerbi/__init__.py diff --git a/langchain/tools/powerbi/prompt.py b/libs/langchain/langchain/tools/powerbi/prompt.py similarity index 100% rename from langchain/tools/powerbi/prompt.py rename to libs/langchain/langchain/tools/powerbi/prompt.py diff --git a/langchain/tools/powerbi/tool.py b/libs/langchain/langchain/tools/powerbi/tool.py similarity index 100% rename from langchain/tools/powerbi/tool.py rename to libs/langchain/langchain/tools/powerbi/tool.py diff --git a/langchain/tools/pubmed/__init__.py b/libs/langchain/langchain/tools/pubmed/__init__.py similarity index 100% rename from langchain/tools/pubmed/__init__.py rename to libs/langchain/langchain/tools/pubmed/__init__.py diff --git a/langchain/tools/pubmed/tool.py b/libs/langchain/langchain/tools/pubmed/tool.py similarity index 100% rename from langchain/tools/pubmed/tool.py rename to libs/langchain/langchain/tools/pubmed/tool.py diff --git a/langchain/tools/python/__init__.py b/libs/langchain/langchain/tools/python/__init__.py similarity index 100% rename from langchain/tools/python/__init__.py rename to libs/langchain/langchain/tools/python/__init__.py diff --git a/langchain/tools/python/tool.py b/libs/langchain/langchain/tools/python/tool.py similarity index 100% rename from langchain/tools/python/tool.py rename to libs/langchain/langchain/tools/python/tool.py diff --git a/langchain/tools/requests/__init__.py b/libs/langchain/langchain/tools/requests/__init__.py similarity index 100% rename from langchain/tools/requests/__init__.py rename to libs/langchain/langchain/tools/requests/__init__.py diff --git a/langchain/tools/requests/tool.py b/libs/langchain/langchain/tools/requests/tool.py similarity index 100% rename from langchain/tools/requests/tool.py rename to libs/langchain/langchain/tools/requests/tool.py diff --git a/langchain/tools/scenexplain/__init__.py b/libs/langchain/langchain/tools/scenexplain/__init__.py similarity index 100% rename from langchain/tools/scenexplain/__init__.py rename to libs/langchain/langchain/tools/scenexplain/__init__.py diff --git a/langchain/tools/scenexplain/tool.py b/libs/langchain/langchain/tools/scenexplain/tool.py similarity index 100% rename from langchain/tools/scenexplain/tool.py rename to libs/langchain/langchain/tools/scenexplain/tool.py diff --git a/langchain/tools/searx_search/__init__.py b/libs/langchain/langchain/tools/searx_search/__init__.py similarity index 100% rename from langchain/tools/searx_search/__init__.py rename to libs/langchain/langchain/tools/searx_search/__init__.py diff --git a/langchain/tools/searx_search/tool.py b/libs/langchain/langchain/tools/searx_search/tool.py similarity index 100% rename from langchain/tools/searx_search/tool.py rename to libs/langchain/langchain/tools/searx_search/tool.py diff --git a/langchain/tools/shell/__init__.py b/libs/langchain/langchain/tools/shell/__init__.py similarity index 100% rename from langchain/tools/shell/__init__.py rename to libs/langchain/langchain/tools/shell/__init__.py diff --git a/langchain/tools/shell/tool.py b/libs/langchain/langchain/tools/shell/tool.py similarity index 100% rename from langchain/tools/shell/tool.py rename to libs/langchain/langchain/tools/shell/tool.py diff --git a/langchain/tools/sleep/__init__.py b/libs/langchain/langchain/tools/sleep/__init__.py similarity index 100% rename from langchain/tools/sleep/__init__.py rename to libs/langchain/langchain/tools/sleep/__init__.py diff --git a/langchain/tools/sleep/tool.py b/libs/langchain/langchain/tools/sleep/tool.py similarity index 100% rename from langchain/tools/sleep/tool.py rename to libs/langchain/langchain/tools/sleep/tool.py diff --git a/langchain/tools/spark_sql/__init__.py b/libs/langchain/langchain/tools/spark_sql/__init__.py similarity index 100% rename from langchain/tools/spark_sql/__init__.py rename to libs/langchain/langchain/tools/spark_sql/__init__.py diff --git a/langchain/tools/spark_sql/prompt.py b/libs/langchain/langchain/tools/spark_sql/prompt.py similarity index 100% rename from langchain/tools/spark_sql/prompt.py rename to libs/langchain/langchain/tools/spark_sql/prompt.py diff --git a/langchain/tools/spark_sql/tool.py b/libs/langchain/langchain/tools/spark_sql/tool.py similarity index 100% rename from langchain/tools/spark_sql/tool.py rename to libs/langchain/langchain/tools/spark_sql/tool.py diff --git a/langchain/tools/sql_database/__init__.py b/libs/langchain/langchain/tools/sql_database/__init__.py similarity index 100% rename from langchain/tools/sql_database/__init__.py rename to libs/langchain/langchain/tools/sql_database/__init__.py diff --git a/langchain/tools/sql_database/prompt.py b/libs/langchain/langchain/tools/sql_database/prompt.py similarity index 100% rename from langchain/tools/sql_database/prompt.py rename to libs/langchain/langchain/tools/sql_database/prompt.py diff --git a/langchain/tools/sql_database/tool.py b/libs/langchain/langchain/tools/sql_database/tool.py similarity index 100% rename from langchain/tools/sql_database/tool.py rename to libs/langchain/langchain/tools/sql_database/tool.py diff --git a/langchain/tools/steamship_image_generation/__init__.py b/libs/langchain/langchain/tools/steamship_image_generation/__init__.py similarity index 100% rename from langchain/tools/steamship_image_generation/__init__.py rename to libs/langchain/langchain/tools/steamship_image_generation/__init__.py diff --git a/langchain/tools/steamship_image_generation/tool.py b/libs/langchain/langchain/tools/steamship_image_generation/tool.py similarity index 100% rename from langchain/tools/steamship_image_generation/tool.py rename to libs/langchain/langchain/tools/steamship_image_generation/tool.py diff --git a/langchain/tools/steamship_image_generation/utils.py b/libs/langchain/langchain/tools/steamship_image_generation/utils.py similarity index 100% rename from langchain/tools/steamship_image_generation/utils.py rename to libs/langchain/langchain/tools/steamship_image_generation/utils.py diff --git a/langchain/tools/vectorstore/__init__.py b/libs/langchain/langchain/tools/vectorstore/__init__.py similarity index 100% rename from langchain/tools/vectorstore/__init__.py rename to libs/langchain/langchain/tools/vectorstore/__init__.py diff --git a/langchain/tools/vectorstore/tool.py b/libs/langchain/langchain/tools/vectorstore/tool.py similarity index 100% rename from langchain/tools/vectorstore/tool.py rename to libs/langchain/langchain/tools/vectorstore/tool.py diff --git a/langchain/tools/wikipedia/__init__.py b/libs/langchain/langchain/tools/wikipedia/__init__.py similarity index 100% rename from langchain/tools/wikipedia/__init__.py rename to libs/langchain/langchain/tools/wikipedia/__init__.py diff --git a/langchain/tools/wikipedia/tool.py b/libs/langchain/langchain/tools/wikipedia/tool.py similarity index 100% rename from langchain/tools/wikipedia/tool.py rename to libs/langchain/langchain/tools/wikipedia/tool.py diff --git a/langchain/tools/wolfram_alpha/__init__.py b/libs/langchain/langchain/tools/wolfram_alpha/__init__.py similarity index 100% rename from langchain/tools/wolfram_alpha/__init__.py rename to libs/langchain/langchain/tools/wolfram_alpha/__init__.py diff --git a/langchain/tools/wolfram_alpha/tool.py b/libs/langchain/langchain/tools/wolfram_alpha/tool.py similarity index 100% rename from langchain/tools/wolfram_alpha/tool.py rename to libs/langchain/langchain/tools/wolfram_alpha/tool.py diff --git a/langchain/tools/youtube/__init__.py b/libs/langchain/langchain/tools/youtube/__init__.py similarity index 100% rename from langchain/tools/youtube/__init__.py rename to libs/langchain/langchain/tools/youtube/__init__.py diff --git a/langchain/tools/youtube/search.py b/libs/langchain/langchain/tools/youtube/search.py similarity index 100% rename from langchain/tools/youtube/search.py rename to libs/langchain/langchain/tools/youtube/search.py diff --git a/langchain/tools/zapier/__init__.py b/libs/langchain/langchain/tools/zapier/__init__.py similarity index 100% rename from langchain/tools/zapier/__init__.py rename to libs/langchain/langchain/tools/zapier/__init__.py diff --git a/langchain/tools/zapier/prompt.py b/libs/langchain/langchain/tools/zapier/prompt.py similarity index 100% rename from langchain/tools/zapier/prompt.py rename to libs/langchain/langchain/tools/zapier/prompt.py diff --git a/langchain/tools/zapier/tool.py b/libs/langchain/langchain/tools/zapier/tool.py similarity index 100% rename from langchain/tools/zapier/tool.py rename to libs/langchain/langchain/tools/zapier/tool.py diff --git a/langchain/utilities/__init__.py b/libs/langchain/langchain/utilities/__init__.py similarity index 100% rename from langchain/utilities/__init__.py rename to libs/langchain/langchain/utilities/__init__.py diff --git a/langchain/utilities/apify.py b/libs/langchain/langchain/utilities/apify.py similarity index 100% rename from langchain/utilities/apify.py rename to libs/langchain/langchain/utilities/apify.py diff --git a/langchain/utilities/arxiv.py b/libs/langchain/langchain/utilities/arxiv.py similarity index 100% rename from langchain/utilities/arxiv.py rename to libs/langchain/langchain/utilities/arxiv.py diff --git a/langchain/utilities/asyncio.py b/libs/langchain/langchain/utilities/asyncio.py similarity index 100% rename from langchain/utilities/asyncio.py rename to libs/langchain/langchain/utilities/asyncio.py diff --git a/langchain/utilities/awslambda.py b/libs/langchain/langchain/utilities/awslambda.py similarity index 100% rename from langchain/utilities/awslambda.py rename to libs/langchain/langchain/utilities/awslambda.py diff --git a/langchain/utilities/bash.py b/libs/langchain/langchain/utilities/bash.py similarity index 100% rename from langchain/utilities/bash.py rename to libs/langchain/langchain/utilities/bash.py diff --git a/langchain/utilities/bibtex.py b/libs/langchain/langchain/utilities/bibtex.py similarity index 100% rename from langchain/utilities/bibtex.py rename to libs/langchain/langchain/utilities/bibtex.py diff --git a/langchain/utilities/bing_search.py b/libs/langchain/langchain/utilities/bing_search.py similarity index 100% rename from langchain/utilities/bing_search.py rename to libs/langchain/langchain/utilities/bing_search.py diff --git a/langchain/utilities/brave_search.py b/libs/langchain/langchain/utilities/brave_search.py similarity index 100% rename from langchain/utilities/brave_search.py rename to libs/langchain/langchain/utilities/brave_search.py diff --git a/langchain/utilities/dataforseo_api_search.py b/libs/langchain/langchain/utilities/dataforseo_api_search.py similarity index 100% rename from langchain/utilities/dataforseo_api_search.py rename to libs/langchain/langchain/utilities/dataforseo_api_search.py diff --git a/langchain/utilities/duckduckgo_search.py b/libs/langchain/langchain/utilities/duckduckgo_search.py similarity index 100% rename from langchain/utilities/duckduckgo_search.py rename to libs/langchain/langchain/utilities/duckduckgo_search.py diff --git a/langchain/utilities/google_places_api.py b/libs/langchain/langchain/utilities/google_places_api.py similarity index 100% rename from langchain/utilities/google_places_api.py rename to libs/langchain/langchain/utilities/google_places_api.py diff --git a/langchain/utilities/google_search.py b/libs/langchain/langchain/utilities/google_search.py similarity index 100% rename from langchain/utilities/google_search.py rename to libs/langchain/langchain/utilities/google_search.py diff --git a/langchain/utilities/google_serper.py b/libs/langchain/langchain/utilities/google_serper.py similarity index 100% rename from langchain/utilities/google_serper.py rename to libs/langchain/langchain/utilities/google_serper.py diff --git a/langchain/utilities/graphql.py b/libs/langchain/langchain/utilities/graphql.py similarity index 100% rename from langchain/utilities/graphql.py rename to libs/langchain/langchain/utilities/graphql.py diff --git a/langchain/utilities/jira.py b/libs/langchain/langchain/utilities/jira.py similarity index 100% rename from langchain/utilities/jira.py rename to libs/langchain/langchain/utilities/jira.py diff --git a/langchain/utilities/loading.py b/libs/langchain/langchain/utilities/loading.py similarity index 100% rename from langchain/utilities/loading.py rename to libs/langchain/langchain/utilities/loading.py diff --git a/langchain/utilities/max_compute.py b/libs/langchain/langchain/utilities/max_compute.py similarity index 100% rename from langchain/utilities/max_compute.py rename to libs/langchain/langchain/utilities/max_compute.py diff --git a/langchain/utilities/metaphor_search.py b/libs/langchain/langchain/utilities/metaphor_search.py similarity index 100% rename from langchain/utilities/metaphor_search.py rename to libs/langchain/langchain/utilities/metaphor_search.py diff --git a/langchain/utilities/openapi.py b/libs/langchain/langchain/utilities/openapi.py similarity index 100% rename from langchain/utilities/openapi.py rename to libs/langchain/langchain/utilities/openapi.py diff --git a/langchain/utilities/openweathermap.py b/libs/langchain/langchain/utilities/openweathermap.py similarity index 96% rename from langchain/utilities/openweathermap.py rename to libs/langchain/langchain/utilities/openweathermap.py index 2b10fb38c22..5fd40b92fc5 100644 --- a/langchain/utilities/openweathermap.py +++ b/libs/langchain/langchain/utilities/openweathermap.py @@ -1,78 +1,78 @@ -"""Util that calls OpenWeatherMap using PyOWM.""" -from typing import Any, Dict, Optional - -from pydantic import Extra, root_validator - -from langchain.tools.base import BaseModel -from langchain.utils import get_from_dict_or_env - - -class OpenWeatherMapAPIWrapper(BaseModel): - """Wrapper for OpenWeatherMap API using PyOWM. - - Docs for using: - - 1. Go to OpenWeatherMap and sign up for an API key - 2. Save your API KEY into OPENWEATHERMAP_API_KEY env variable - 3. pip install pyowm - """ - - owm: Any - openweathermap_api_key: Optional[str] = None - - class Config: - """Configuration for this pydantic object.""" - - extra = Extra.forbid - - @root_validator(pre=True) - def validate_environment(cls, values: Dict) -> Dict: - """Validate that api key exists in environment.""" - openweathermap_api_key = get_from_dict_or_env( - values, "openweathermap_api_key", "OPENWEATHERMAP_API_KEY" - ) - - try: - import pyowm - - except ImportError: - raise ImportError( - "pyowm is not installed. Please install it with `pip install pyowm`" - ) - - owm = pyowm.OWM(openweathermap_api_key) - values["owm"] = owm - - return values - - def _format_weather_info(self, location: str, w: Any) -> str: - detailed_status = w.detailed_status - wind = w.wind() - humidity = w.humidity - temperature = w.temperature("celsius") - rain = w.rain - heat_index = w.heat_index - clouds = w.clouds - - return ( - f"In {location}, the current weather is as follows:\n" - f"Detailed status: {detailed_status}\n" - f"Wind speed: {wind['speed']} m/s, direction: {wind['deg']}°\n" - f"Humidity: {humidity}%\n" - f"Temperature: \n" - f" - Current: {temperature['temp']}°C\n" - f" - High: {temperature['temp_max']}°C\n" - f" - Low: {temperature['temp_min']}°C\n" - f" - Feels like: {temperature['feels_like']}°C\n" - f"Rain: {rain}\n" - f"Heat index: {heat_index}\n" - f"Cloud cover: {clouds}%" - ) - - def run(self, location: str) -> str: - """Get the current weather information for a specified location.""" - mgr = self.owm.weather_manager() - observation = mgr.weather_at_place(location) - w = observation.weather - - return self._format_weather_info(location, w) +"""Util that calls OpenWeatherMap using PyOWM.""" +from typing import Any, Dict, Optional + +from pydantic import Extra, root_validator + +from langchain.tools.base import BaseModel +from langchain.utils import get_from_dict_or_env + + +class OpenWeatherMapAPIWrapper(BaseModel): + """Wrapper for OpenWeatherMap API using PyOWM. + + Docs for using: + + 1. Go to OpenWeatherMap and sign up for an API key + 2. Save your API KEY into OPENWEATHERMAP_API_KEY env variable + 3. pip install pyowm + """ + + owm: Any + openweathermap_api_key: Optional[str] = None + + class Config: + """Configuration for this pydantic object.""" + + extra = Extra.forbid + + @root_validator(pre=True) + def validate_environment(cls, values: Dict) -> Dict: + """Validate that api key exists in environment.""" + openweathermap_api_key = get_from_dict_or_env( + values, "openweathermap_api_key", "OPENWEATHERMAP_API_KEY" + ) + + try: + import pyowm + + except ImportError: + raise ImportError( + "pyowm is not installed. Please install it with `pip install pyowm`" + ) + + owm = pyowm.OWM(openweathermap_api_key) + values["owm"] = owm + + return values + + def _format_weather_info(self, location: str, w: Any) -> str: + detailed_status = w.detailed_status + wind = w.wind() + humidity = w.humidity + temperature = w.temperature("celsius") + rain = w.rain + heat_index = w.heat_index + clouds = w.clouds + + return ( + f"In {location}, the current weather is as follows:\n" + f"Detailed status: {detailed_status}\n" + f"Wind speed: {wind['speed']} m/s, direction: {wind['deg']}°\n" + f"Humidity: {humidity}%\n" + f"Temperature: \n" + f" - Current: {temperature['temp']}°C\n" + f" - High: {temperature['temp_max']}°C\n" + f" - Low: {temperature['temp_min']}°C\n" + f" - Feels like: {temperature['feels_like']}°C\n" + f"Rain: {rain}\n" + f"Heat index: {heat_index}\n" + f"Cloud cover: {clouds}%" + ) + + def run(self, location: str) -> str: + """Get the current weather information for a specified location.""" + mgr = self.owm.weather_manager() + observation = mgr.weather_at_place(location) + w = observation.weather + + return self._format_weather_info(location, w) diff --git a/langchain/utilities/powerbi.py b/libs/langchain/langchain/utilities/powerbi.py similarity index 100% rename from langchain/utilities/powerbi.py rename to libs/langchain/langchain/utilities/powerbi.py diff --git a/langchain/utilities/pupmed.py b/libs/langchain/langchain/utilities/pupmed.py similarity index 100% rename from langchain/utilities/pupmed.py rename to libs/langchain/langchain/utilities/pupmed.py diff --git a/langchain/utilities/python.py b/libs/langchain/langchain/utilities/python.py similarity index 100% rename from langchain/utilities/python.py rename to libs/langchain/langchain/utilities/python.py diff --git a/langchain/utilities/scenexplain.py b/libs/langchain/langchain/utilities/scenexplain.py similarity index 100% rename from langchain/utilities/scenexplain.py rename to libs/langchain/langchain/utilities/scenexplain.py diff --git a/langchain/utilities/searx_search.py b/libs/langchain/langchain/utilities/searx_search.py similarity index 100% rename from langchain/utilities/searx_search.py rename to libs/langchain/langchain/utilities/searx_search.py diff --git a/langchain/utilities/serpapi.py b/libs/langchain/langchain/utilities/serpapi.py similarity index 100% rename from langchain/utilities/serpapi.py rename to libs/langchain/langchain/utilities/serpapi.py diff --git a/langchain/utilities/spark_sql.py b/libs/langchain/langchain/utilities/spark_sql.py similarity index 100% rename from langchain/utilities/spark_sql.py rename to libs/langchain/langchain/utilities/spark_sql.py diff --git a/langchain/utilities/twilio.py b/libs/langchain/langchain/utilities/twilio.py similarity index 100% rename from langchain/utilities/twilio.py rename to libs/langchain/langchain/utilities/twilio.py diff --git a/langchain/utilities/vertexai.py b/libs/langchain/langchain/utilities/vertexai.py similarity index 100% rename from langchain/utilities/vertexai.py rename to libs/langchain/langchain/utilities/vertexai.py diff --git a/langchain/utilities/wikipedia.py b/libs/langchain/langchain/utilities/wikipedia.py similarity index 100% rename from langchain/utilities/wikipedia.py rename to libs/langchain/langchain/utilities/wikipedia.py diff --git a/langchain/utilities/wolfram_alpha.py b/libs/langchain/langchain/utilities/wolfram_alpha.py similarity index 100% rename from langchain/utilities/wolfram_alpha.py rename to libs/langchain/langchain/utilities/wolfram_alpha.py diff --git a/langchain/utilities/zapier.py b/libs/langchain/langchain/utilities/zapier.py similarity index 100% rename from langchain/utilities/zapier.py rename to libs/langchain/langchain/utilities/zapier.py diff --git a/langchain/utils.py b/libs/langchain/langchain/utils.py similarity index 100% rename from langchain/utils.py rename to libs/langchain/langchain/utils.py diff --git a/langchain/vectorstores/__init__.py b/libs/langchain/langchain/vectorstores/__init__.py similarity index 100% rename from langchain/vectorstores/__init__.py rename to libs/langchain/langchain/vectorstores/__init__.py diff --git a/langchain/vectorstores/_pgvector_data_models.py b/libs/langchain/langchain/vectorstores/_pgvector_data_models.py similarity index 100% rename from langchain/vectorstores/_pgvector_data_models.py rename to libs/langchain/langchain/vectorstores/_pgvector_data_models.py diff --git a/langchain/vectorstores/alibabacloud_opensearch.py b/libs/langchain/langchain/vectorstores/alibabacloud_opensearch.py similarity index 100% rename from langchain/vectorstores/alibabacloud_opensearch.py rename to libs/langchain/langchain/vectorstores/alibabacloud_opensearch.py diff --git a/langchain/vectorstores/analyticdb.py b/libs/langchain/langchain/vectorstores/analyticdb.py similarity index 100% rename from langchain/vectorstores/analyticdb.py rename to libs/langchain/langchain/vectorstores/analyticdb.py diff --git a/langchain/vectorstores/annoy.py b/libs/langchain/langchain/vectorstores/annoy.py similarity index 100% rename from langchain/vectorstores/annoy.py rename to libs/langchain/langchain/vectorstores/annoy.py diff --git a/langchain/vectorstores/atlas.py b/libs/langchain/langchain/vectorstores/atlas.py similarity index 100% rename from langchain/vectorstores/atlas.py rename to libs/langchain/langchain/vectorstores/atlas.py diff --git a/langchain/vectorstores/awadb.py b/libs/langchain/langchain/vectorstores/awadb.py similarity index 100% rename from langchain/vectorstores/awadb.py rename to libs/langchain/langchain/vectorstores/awadb.py diff --git a/langchain/vectorstores/azuresearch.py b/libs/langchain/langchain/vectorstores/azuresearch.py similarity index 100% rename from langchain/vectorstores/azuresearch.py rename to libs/langchain/langchain/vectorstores/azuresearch.py diff --git a/langchain/vectorstores/base.py b/libs/langchain/langchain/vectorstores/base.py similarity index 100% rename from langchain/vectorstores/base.py rename to libs/langchain/langchain/vectorstores/base.py diff --git a/langchain/vectorstores/cassandra.py b/libs/langchain/langchain/vectorstores/cassandra.py similarity index 100% rename from langchain/vectorstores/cassandra.py rename to libs/langchain/langchain/vectorstores/cassandra.py diff --git a/langchain/vectorstores/chroma.py b/libs/langchain/langchain/vectorstores/chroma.py similarity index 100% rename from langchain/vectorstores/chroma.py rename to libs/langchain/langchain/vectorstores/chroma.py diff --git a/langchain/vectorstores/clarifai.py b/libs/langchain/langchain/vectorstores/clarifai.py similarity index 100% rename from langchain/vectorstores/clarifai.py rename to libs/langchain/langchain/vectorstores/clarifai.py diff --git a/langchain/vectorstores/clickhouse.py b/libs/langchain/langchain/vectorstores/clickhouse.py similarity index 100% rename from langchain/vectorstores/clickhouse.py rename to libs/langchain/langchain/vectorstores/clickhouse.py diff --git a/langchain/vectorstores/deeplake.py b/libs/langchain/langchain/vectorstores/deeplake.py similarity index 100% rename from langchain/vectorstores/deeplake.py rename to libs/langchain/langchain/vectorstores/deeplake.py diff --git a/langchain/vectorstores/docarray/__init__.py b/libs/langchain/langchain/vectorstores/docarray/__init__.py similarity index 100% rename from langchain/vectorstores/docarray/__init__.py rename to libs/langchain/langchain/vectorstores/docarray/__init__.py diff --git a/langchain/vectorstores/docarray/base.py b/libs/langchain/langchain/vectorstores/docarray/base.py similarity index 100% rename from langchain/vectorstores/docarray/base.py rename to libs/langchain/langchain/vectorstores/docarray/base.py diff --git a/langchain/vectorstores/docarray/hnsw.py b/libs/langchain/langchain/vectorstores/docarray/hnsw.py similarity index 100% rename from langchain/vectorstores/docarray/hnsw.py rename to libs/langchain/langchain/vectorstores/docarray/hnsw.py diff --git a/langchain/vectorstores/docarray/in_memory.py b/libs/langchain/langchain/vectorstores/docarray/in_memory.py similarity index 100% rename from langchain/vectorstores/docarray/in_memory.py rename to libs/langchain/langchain/vectorstores/docarray/in_memory.py diff --git a/langchain/vectorstores/elastic_vector_search.py b/libs/langchain/langchain/vectorstores/elastic_vector_search.py similarity index 100% rename from langchain/vectorstores/elastic_vector_search.py rename to libs/langchain/langchain/vectorstores/elastic_vector_search.py diff --git a/langchain/vectorstores/faiss.py b/libs/langchain/langchain/vectorstores/faiss.py similarity index 100% rename from langchain/vectorstores/faiss.py rename to libs/langchain/langchain/vectorstores/faiss.py diff --git a/langchain/vectorstores/hologres.py b/libs/langchain/langchain/vectorstores/hologres.py similarity index 100% rename from langchain/vectorstores/hologres.py rename to libs/langchain/langchain/vectorstores/hologres.py diff --git a/langchain/vectorstores/lancedb.py b/libs/langchain/langchain/vectorstores/lancedb.py similarity index 100% rename from langchain/vectorstores/lancedb.py rename to libs/langchain/langchain/vectorstores/lancedb.py diff --git a/langchain/vectorstores/marqo.py b/libs/langchain/langchain/vectorstores/marqo.py similarity index 100% rename from langchain/vectorstores/marqo.py rename to libs/langchain/langchain/vectorstores/marqo.py diff --git a/langchain/vectorstores/matching_engine.py b/libs/langchain/langchain/vectorstores/matching_engine.py similarity index 100% rename from langchain/vectorstores/matching_engine.py rename to libs/langchain/langchain/vectorstores/matching_engine.py diff --git a/langchain/vectorstores/milvus.py b/libs/langchain/langchain/vectorstores/milvus.py similarity index 100% rename from langchain/vectorstores/milvus.py rename to libs/langchain/langchain/vectorstores/milvus.py diff --git a/langchain/vectorstores/mongodb_atlas.py b/libs/langchain/langchain/vectorstores/mongodb_atlas.py similarity index 100% rename from langchain/vectorstores/mongodb_atlas.py rename to libs/langchain/langchain/vectorstores/mongodb_atlas.py diff --git a/langchain/vectorstores/myscale.py b/libs/langchain/langchain/vectorstores/myscale.py similarity index 100% rename from langchain/vectorstores/myscale.py rename to libs/langchain/langchain/vectorstores/myscale.py diff --git a/langchain/vectorstores/opensearch_vector_search.py b/libs/langchain/langchain/vectorstores/opensearch_vector_search.py similarity index 100% rename from langchain/vectorstores/opensearch_vector_search.py rename to libs/langchain/langchain/vectorstores/opensearch_vector_search.py diff --git a/langchain/vectorstores/pgembedding.py b/libs/langchain/langchain/vectorstores/pgembedding.py similarity index 100% rename from langchain/vectorstores/pgembedding.py rename to libs/langchain/langchain/vectorstores/pgembedding.py diff --git a/langchain/vectorstores/pgvector.py b/libs/langchain/langchain/vectorstores/pgvector.py similarity index 100% rename from langchain/vectorstores/pgvector.py rename to libs/langchain/langchain/vectorstores/pgvector.py diff --git a/langchain/vectorstores/pinecone.py b/libs/langchain/langchain/vectorstores/pinecone.py similarity index 100% rename from langchain/vectorstores/pinecone.py rename to libs/langchain/langchain/vectorstores/pinecone.py diff --git a/langchain/vectorstores/qdrant.py b/libs/langchain/langchain/vectorstores/qdrant.py similarity index 100% rename from langchain/vectorstores/qdrant.py rename to libs/langchain/langchain/vectorstores/qdrant.py diff --git a/langchain/vectorstores/redis.py b/libs/langchain/langchain/vectorstores/redis.py similarity index 100% rename from langchain/vectorstores/redis.py rename to libs/langchain/langchain/vectorstores/redis.py diff --git a/langchain/vectorstores/rocksetdb.py b/libs/langchain/langchain/vectorstores/rocksetdb.py similarity index 100% rename from langchain/vectorstores/rocksetdb.py rename to libs/langchain/langchain/vectorstores/rocksetdb.py diff --git a/langchain/vectorstores/singlestoredb.py b/libs/langchain/langchain/vectorstores/singlestoredb.py similarity index 100% rename from langchain/vectorstores/singlestoredb.py rename to libs/langchain/langchain/vectorstores/singlestoredb.py diff --git a/langchain/vectorstores/sklearn.py b/libs/langchain/langchain/vectorstores/sklearn.py similarity index 100% rename from langchain/vectorstores/sklearn.py rename to libs/langchain/langchain/vectorstores/sklearn.py diff --git a/langchain/vectorstores/starrocks.py b/libs/langchain/langchain/vectorstores/starrocks.py similarity index 100% rename from langchain/vectorstores/starrocks.py rename to libs/langchain/langchain/vectorstores/starrocks.py diff --git a/langchain/vectorstores/supabase.py b/libs/langchain/langchain/vectorstores/supabase.py similarity index 100% rename from langchain/vectorstores/supabase.py rename to libs/langchain/langchain/vectorstores/supabase.py diff --git a/langchain/vectorstores/tair.py b/libs/langchain/langchain/vectorstores/tair.py similarity index 100% rename from langchain/vectorstores/tair.py rename to libs/langchain/langchain/vectorstores/tair.py diff --git a/langchain/vectorstores/tigris.py b/libs/langchain/langchain/vectorstores/tigris.py similarity index 100% rename from langchain/vectorstores/tigris.py rename to libs/langchain/langchain/vectorstores/tigris.py diff --git a/langchain/vectorstores/typesense.py b/libs/langchain/langchain/vectorstores/typesense.py similarity index 100% rename from langchain/vectorstores/typesense.py rename to libs/langchain/langchain/vectorstores/typesense.py diff --git a/langchain/vectorstores/utils.py b/libs/langchain/langchain/vectorstores/utils.py similarity index 100% rename from langchain/vectorstores/utils.py rename to libs/langchain/langchain/vectorstores/utils.py diff --git a/langchain/vectorstores/vectara.py b/libs/langchain/langchain/vectorstores/vectara.py similarity index 100% rename from langchain/vectorstores/vectara.py rename to libs/langchain/langchain/vectorstores/vectara.py diff --git a/langchain/vectorstores/weaviate.py b/libs/langchain/langchain/vectorstores/weaviate.py similarity index 100% rename from langchain/vectorstores/weaviate.py rename to libs/langchain/langchain/vectorstores/weaviate.py diff --git a/langchain/vectorstores/zilliz.py b/libs/langchain/langchain/vectorstores/zilliz.py similarity index 100% rename from langchain/vectorstores/zilliz.py rename to libs/langchain/langchain/vectorstores/zilliz.py diff --git a/poetry.lock b/libs/langchain/poetry.lock similarity index 100% rename from poetry.lock rename to libs/langchain/poetry.lock diff --git a/poetry.toml b/libs/langchain/poetry.toml similarity index 100% rename from poetry.toml rename to libs/langchain/poetry.toml diff --git a/pyproject.toml b/libs/langchain/pyproject.toml similarity index 100% rename from pyproject.toml rename to libs/langchain/pyproject.toml diff --git a/tests/README.md b/libs/langchain/tests/README.md similarity index 100% rename from tests/README.md rename to libs/langchain/tests/README.md diff --git a/tests/__init__.py b/libs/langchain/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to libs/langchain/tests/__init__.py diff --git a/tests/data.py b/libs/langchain/tests/data.py similarity index 100% rename from tests/data.py rename to libs/langchain/tests/data.py diff --git a/tests/integration_tests/.env.example b/libs/langchain/tests/integration_tests/.env.example similarity index 100% rename from tests/integration_tests/.env.example rename to libs/langchain/tests/integration_tests/.env.example diff --git a/tests/integration_tests/__init__.py b/libs/langchain/tests/integration_tests/__init__.py similarity index 100% rename from tests/integration_tests/__init__.py rename to libs/langchain/tests/integration_tests/__init__.py diff --git a/tests/integration_tests/agent/test_csv_agent.py b/libs/langchain/tests/integration_tests/agent/test_csv_agent.py similarity index 100% rename from tests/integration_tests/agent/test_csv_agent.py rename to libs/langchain/tests/integration_tests/agent/test_csv_agent.py diff --git a/tests/integration_tests/agent/test_pandas_agent.py b/libs/langchain/tests/integration_tests/agent/test_pandas_agent.py similarity index 100% rename from tests/integration_tests/agent/test_pandas_agent.py rename to libs/langchain/tests/integration_tests/agent/test_pandas_agent.py diff --git a/tests/integration_tests/agent/test_powerbi_agent.py b/libs/langchain/tests/integration_tests/agent/test_powerbi_agent.py similarity index 100% rename from tests/integration_tests/agent/test_powerbi_agent.py rename to libs/langchain/tests/integration_tests/agent/test_powerbi_agent.py diff --git a/tests/integration_tests/cache/__init__.py b/libs/langchain/tests/integration_tests/cache/__init__.py similarity index 100% rename from tests/integration_tests/cache/__init__.py rename to libs/langchain/tests/integration_tests/cache/__init__.py diff --git a/tests/integration_tests/cache/test_gptcache.py b/libs/langchain/tests/integration_tests/cache/test_gptcache.py similarity index 100% rename from tests/integration_tests/cache/test_gptcache.py rename to libs/langchain/tests/integration_tests/cache/test_gptcache.py diff --git a/tests/integration_tests/cache/test_momento_cache.py b/libs/langchain/tests/integration_tests/cache/test_momento_cache.py similarity index 100% rename from tests/integration_tests/cache/test_momento_cache.py rename to libs/langchain/tests/integration_tests/cache/test_momento_cache.py diff --git a/tests/integration_tests/cache/test_redis_cache.py b/libs/langchain/tests/integration_tests/cache/test_redis_cache.py similarity index 100% rename from tests/integration_tests/cache/test_redis_cache.py rename to libs/langchain/tests/integration_tests/cache/test_redis_cache.py diff --git a/tests/integration_tests/callbacks/__init__.py b/libs/langchain/tests/integration_tests/callbacks/__init__.py similarity index 100% rename from tests/integration_tests/callbacks/__init__.py rename to libs/langchain/tests/integration_tests/callbacks/__init__.py diff --git a/tests/integration_tests/callbacks/test_langchain_tracer.py b/libs/langchain/tests/integration_tests/callbacks/test_langchain_tracer.py similarity index 100% rename from tests/integration_tests/callbacks/test_langchain_tracer.py rename to libs/langchain/tests/integration_tests/callbacks/test_langchain_tracer.py diff --git a/tests/integration_tests/callbacks/test_openai_callback.py b/libs/langchain/tests/integration_tests/callbacks/test_openai_callback.py similarity index 100% rename from tests/integration_tests/callbacks/test_openai_callback.py rename to libs/langchain/tests/integration_tests/callbacks/test_openai_callback.py diff --git a/tests/integration_tests/callbacks/test_streamlit_callback.py b/libs/langchain/tests/integration_tests/callbacks/test_streamlit_callback.py similarity index 100% rename from tests/integration_tests/callbacks/test_streamlit_callback.py rename to libs/langchain/tests/integration_tests/callbacks/test_streamlit_callback.py diff --git a/tests/integration_tests/callbacks/test_wandb_tracer.py b/libs/langchain/tests/integration_tests/callbacks/test_wandb_tracer.py similarity index 100% rename from tests/integration_tests/callbacks/test_wandb_tracer.py rename to libs/langchain/tests/integration_tests/callbacks/test_wandb_tracer.py diff --git a/tests/integration_tests/chains/__init__.py b/libs/langchain/tests/integration_tests/chains/__init__.py similarity index 100% rename from tests/integration_tests/chains/__init__.py rename to libs/langchain/tests/integration_tests/chains/__init__.py diff --git a/tests/integration_tests/chains/openai_functions/__init__.py b/libs/langchain/tests/integration_tests/chains/openai_functions/__init__.py similarity index 100% rename from tests/integration_tests/chains/openai_functions/__init__.py rename to libs/langchain/tests/integration_tests/chains/openai_functions/__init__.py diff --git a/tests/integration_tests/chains/openai_functions/test_openapi.py b/libs/langchain/tests/integration_tests/chains/openai_functions/test_openapi.py similarity index 100% rename from tests/integration_tests/chains/openai_functions/test_openapi.py rename to libs/langchain/tests/integration_tests/chains/openai_functions/test_openapi.py diff --git a/tests/integration_tests/chains/test_cpal.py b/libs/langchain/tests/integration_tests/chains/test_cpal.py similarity index 100% rename from tests/integration_tests/chains/test_cpal.py rename to libs/langchain/tests/integration_tests/chains/test_cpal.py diff --git a/tests/integration_tests/chains/test_graph_database.py b/libs/langchain/tests/integration_tests/chains/test_graph_database.py similarity index 100% rename from tests/integration_tests/chains/test_graph_database.py rename to libs/langchain/tests/integration_tests/chains/test_graph_database.py diff --git a/tests/integration_tests/chains/test_graph_database_sparql.py b/libs/langchain/tests/integration_tests/chains/test_graph_database_sparql.py similarity index 100% rename from tests/integration_tests/chains/test_graph_database_sparql.py rename to libs/langchain/tests/integration_tests/chains/test_graph_database_sparql.py diff --git a/tests/integration_tests/chains/test_memory.py b/libs/langchain/tests/integration_tests/chains/test_memory.py similarity index 100% rename from tests/integration_tests/chains/test_memory.py rename to libs/langchain/tests/integration_tests/chains/test_memory.py diff --git a/tests/integration_tests/chains/test_pal.py b/libs/langchain/tests/integration_tests/chains/test_pal.py similarity index 100% rename from tests/integration_tests/chains/test_pal.py rename to libs/langchain/tests/integration_tests/chains/test_pal.py diff --git a/tests/integration_tests/chains/test_react.py b/libs/langchain/tests/integration_tests/chains/test_react.py similarity index 100% rename from tests/integration_tests/chains/test_react.py rename to libs/langchain/tests/integration_tests/chains/test_react.py diff --git a/tests/integration_tests/chains/test_retrieval_qa.py b/libs/langchain/tests/integration_tests/chains/test_retrieval_qa.py similarity index 100% rename from tests/integration_tests/chains/test_retrieval_qa.py rename to libs/langchain/tests/integration_tests/chains/test_retrieval_qa.py diff --git a/tests/integration_tests/chains/test_self_ask_with_search.py b/libs/langchain/tests/integration_tests/chains/test_self_ask_with_search.py similarity index 100% rename from tests/integration_tests/chains/test_self_ask_with_search.py rename to libs/langchain/tests/integration_tests/chains/test_self_ask_with_search.py diff --git a/tests/integration_tests/chains/test_sql_database.py b/libs/langchain/tests/integration_tests/chains/test_sql_database.py similarity index 100% rename from tests/integration_tests/chains/test_sql_database.py rename to libs/langchain/tests/integration_tests/chains/test_sql_database.py diff --git a/tests/integration_tests/chat_models/__init__.py b/libs/langchain/tests/integration_tests/chat_models/__init__.py similarity index 100% rename from tests/integration_tests/chat_models/__init__.py rename to libs/langchain/tests/integration_tests/chat_models/__init__.py diff --git a/tests/integration_tests/chat_models/test_anthropic.py b/libs/langchain/tests/integration_tests/chat_models/test_anthropic.py similarity index 100% rename from tests/integration_tests/chat_models/test_anthropic.py rename to libs/langchain/tests/integration_tests/chat_models/test_anthropic.py diff --git a/tests/integration_tests/chat_models/test_google_palm.py b/libs/langchain/tests/integration_tests/chat_models/test_google_palm.py similarity index 100% rename from tests/integration_tests/chat_models/test_google_palm.py rename to libs/langchain/tests/integration_tests/chat_models/test_google_palm.py diff --git a/tests/integration_tests/chat_models/test_jinachat.py b/libs/langchain/tests/integration_tests/chat_models/test_jinachat.py similarity index 100% rename from tests/integration_tests/chat_models/test_jinachat.py rename to libs/langchain/tests/integration_tests/chat_models/test_jinachat.py diff --git a/tests/integration_tests/chat_models/test_openai.py b/libs/langchain/tests/integration_tests/chat_models/test_openai.py similarity index 100% rename from tests/integration_tests/chat_models/test_openai.py rename to libs/langchain/tests/integration_tests/chat_models/test_openai.py diff --git a/tests/integration_tests/chat_models/test_promptlayer_openai.py b/libs/langchain/tests/integration_tests/chat_models/test_promptlayer_openai.py similarity index 100% rename from tests/integration_tests/chat_models/test_promptlayer_openai.py rename to libs/langchain/tests/integration_tests/chat_models/test_promptlayer_openai.py diff --git a/tests/integration_tests/chat_models/test_vertexai.py b/libs/langchain/tests/integration_tests/chat_models/test_vertexai.py similarity index 100% rename from tests/integration_tests/chat_models/test_vertexai.py rename to libs/langchain/tests/integration_tests/chat_models/test_vertexai.py diff --git a/tests/integration_tests/conftest.py b/libs/langchain/tests/integration_tests/conftest.py similarity index 100% rename from tests/integration_tests/conftest.py rename to libs/langchain/tests/integration_tests/conftest.py diff --git a/tests/integration_tests/document_loaders/__init__.py b/libs/langchain/tests/integration_tests/document_loaders/__init__.py similarity index 100% rename from tests/integration_tests/document_loaders/__init__.py rename to libs/langchain/tests/integration_tests/document_loaders/__init__.py diff --git a/tests/integration_tests/document_loaders/parsers/__init__.py b/libs/langchain/tests/integration_tests/document_loaders/parsers/__init__.py similarity index 100% rename from tests/integration_tests/document_loaders/parsers/__init__.py rename to libs/langchain/tests/integration_tests/document_loaders/parsers/__init__.py diff --git a/tests/integration_tests/document_loaders/parsers/test_language.py b/libs/langchain/tests/integration_tests/document_loaders/parsers/test_language.py similarity index 100% rename from tests/integration_tests/document_loaders/parsers/test_language.py rename to libs/langchain/tests/integration_tests/document_loaders/parsers/test_language.py diff --git a/tests/integration_tests/document_loaders/parsers/test_pdf_parsers.py b/libs/langchain/tests/integration_tests/document_loaders/parsers/test_pdf_parsers.py similarity index 100% rename from tests/integration_tests/document_loaders/parsers/test_pdf_parsers.py rename to libs/langchain/tests/integration_tests/document_loaders/parsers/test_pdf_parsers.py diff --git a/tests/integration_tests/document_loaders/test_arxiv.py b/libs/langchain/tests/integration_tests/document_loaders/test_arxiv.py similarity index 100% rename from tests/integration_tests/document_loaders/test_arxiv.py rename to libs/langchain/tests/integration_tests/document_loaders/test_arxiv.py diff --git a/tests/integration_tests/document_loaders/test_bigquery.py b/libs/langchain/tests/integration_tests/document_loaders/test_bigquery.py similarity index 100% rename from tests/integration_tests/document_loaders/test_bigquery.py rename to libs/langchain/tests/integration_tests/document_loaders/test_bigquery.py diff --git a/tests/integration_tests/document_loaders/test_bilibili.py b/libs/langchain/tests/integration_tests/document_loaders/test_bilibili.py similarity index 100% rename from tests/integration_tests/document_loaders/test_bilibili.py rename to libs/langchain/tests/integration_tests/document_loaders/test_bilibili.py diff --git a/tests/integration_tests/document_loaders/test_blockchain.py b/libs/langchain/tests/integration_tests/document_loaders/test_blockchain.py similarity index 100% rename from tests/integration_tests/document_loaders/test_blockchain.py rename to libs/langchain/tests/integration_tests/document_loaders/test_blockchain.py diff --git a/tests/integration_tests/document_loaders/test_confluence.py b/libs/langchain/tests/integration_tests/document_loaders/test_confluence.py similarity index 100% rename from tests/integration_tests/document_loaders/test_confluence.py rename to libs/langchain/tests/integration_tests/document_loaders/test_confluence.py diff --git a/tests/integration_tests/document_loaders/test_csv_loader.py b/libs/langchain/tests/integration_tests/document_loaders/test_csv_loader.py similarity index 100% rename from tests/integration_tests/document_loaders/test_csv_loader.py rename to libs/langchain/tests/integration_tests/document_loaders/test_csv_loader.py diff --git a/tests/integration_tests/document_loaders/test_dataframe.py b/libs/langchain/tests/integration_tests/document_loaders/test_dataframe.py similarity index 100% rename from tests/integration_tests/document_loaders/test_dataframe.py rename to libs/langchain/tests/integration_tests/document_loaders/test_dataframe.py diff --git a/tests/integration_tests/document_loaders/test_duckdb.py b/libs/langchain/tests/integration_tests/document_loaders/test_duckdb.py similarity index 100% rename from tests/integration_tests/document_loaders/test_duckdb.py rename to libs/langchain/tests/integration_tests/document_loaders/test_duckdb.py diff --git a/tests/integration_tests/document_loaders/test_email.py b/libs/langchain/tests/integration_tests/document_loaders/test_email.py similarity index 100% rename from tests/integration_tests/document_loaders/test_email.py rename to libs/langchain/tests/integration_tests/document_loaders/test_email.py diff --git a/tests/integration_tests/document_loaders/test_embaas.py b/libs/langchain/tests/integration_tests/document_loaders/test_embaas.py similarity index 100% rename from tests/integration_tests/document_loaders/test_embaas.py rename to libs/langchain/tests/integration_tests/document_loaders/test_embaas.py diff --git a/tests/integration_tests/document_loaders/test_excel.py b/libs/langchain/tests/integration_tests/document_loaders/test_excel.py similarity index 100% rename from tests/integration_tests/document_loaders/test_excel.py rename to libs/langchain/tests/integration_tests/document_loaders/test_excel.py diff --git a/tests/integration_tests/document_loaders/test_facebook_chat.py b/libs/langchain/tests/integration_tests/document_loaders/test_facebook_chat.py similarity index 100% rename from tests/integration_tests/document_loaders/test_facebook_chat.py rename to libs/langchain/tests/integration_tests/document_loaders/test_facebook_chat.py diff --git a/tests/integration_tests/document_loaders/test_fauna.py b/libs/langchain/tests/integration_tests/document_loaders/test_fauna.py similarity index 100% rename from tests/integration_tests/document_loaders/test_fauna.py rename to libs/langchain/tests/integration_tests/document_loaders/test_fauna.py diff --git a/tests/integration_tests/document_loaders/test_figma.py b/libs/langchain/tests/integration_tests/document_loaders/test_figma.py similarity index 100% rename from tests/integration_tests/document_loaders/test_figma.py rename to libs/langchain/tests/integration_tests/document_loaders/test_figma.py diff --git a/tests/integration_tests/document_loaders/test_gitbook.py b/libs/langchain/tests/integration_tests/document_loaders/test_gitbook.py similarity index 100% rename from tests/integration_tests/document_loaders/test_gitbook.py rename to libs/langchain/tests/integration_tests/document_loaders/test_gitbook.py diff --git a/tests/integration_tests/document_loaders/test_github.py b/libs/langchain/tests/integration_tests/document_loaders/test_github.py similarity index 100% rename from tests/integration_tests/document_loaders/test_github.py rename to libs/langchain/tests/integration_tests/document_loaders/test_github.py diff --git a/tests/integration_tests/document_loaders/test_ifixit.py b/libs/langchain/tests/integration_tests/document_loaders/test_ifixit.py similarity index 100% rename from tests/integration_tests/document_loaders/test_ifixit.py rename to libs/langchain/tests/integration_tests/document_loaders/test_ifixit.py diff --git a/tests/integration_tests/document_loaders/test_joplin.py b/libs/langchain/tests/integration_tests/document_loaders/test_joplin.py similarity index 100% rename from tests/integration_tests/document_loaders/test_joplin.py rename to libs/langchain/tests/integration_tests/document_loaders/test_joplin.py diff --git a/tests/integration_tests/document_loaders/test_json_loader.py b/libs/langchain/tests/integration_tests/document_loaders/test_json_loader.py similarity index 100% rename from tests/integration_tests/document_loaders/test_json_loader.py rename to libs/langchain/tests/integration_tests/document_loaders/test_json_loader.py diff --git a/tests/integration_tests/document_loaders/test_language.py b/libs/langchain/tests/integration_tests/document_loaders/test_language.py similarity index 100% rename from tests/integration_tests/document_loaders/test_language.py rename to libs/langchain/tests/integration_tests/document_loaders/test_language.py diff --git a/tests/integration_tests/document_loaders/test_larksuite.py b/libs/langchain/tests/integration_tests/document_loaders/test_larksuite.py similarity index 100% rename from tests/integration_tests/document_loaders/test_larksuite.py rename to libs/langchain/tests/integration_tests/document_loaders/test_larksuite.py diff --git a/tests/integration_tests/document_loaders/test_mastodon.py b/libs/langchain/tests/integration_tests/document_loaders/test_mastodon.py similarity index 100% rename from tests/integration_tests/document_loaders/test_mastodon.py rename to libs/langchain/tests/integration_tests/document_loaders/test_mastodon.py diff --git a/tests/integration_tests/document_loaders/test_max_compute.py b/libs/langchain/tests/integration_tests/document_loaders/test_max_compute.py similarity index 100% rename from tests/integration_tests/document_loaders/test_max_compute.py rename to libs/langchain/tests/integration_tests/document_loaders/test_max_compute.py diff --git a/tests/integration_tests/document_loaders/test_modern_treasury.py b/libs/langchain/tests/integration_tests/document_loaders/test_modern_treasury.py similarity index 100% rename from tests/integration_tests/document_loaders/test_modern_treasury.py rename to libs/langchain/tests/integration_tests/document_loaders/test_modern_treasury.py diff --git a/tests/integration_tests/document_loaders/test_odt.py b/libs/langchain/tests/integration_tests/document_loaders/test_odt.py similarity index 100% rename from tests/integration_tests/document_loaders/test_odt.py rename to libs/langchain/tests/integration_tests/document_loaders/test_odt.py diff --git a/tests/integration_tests/document_loaders/test_org_mode.py b/libs/langchain/tests/integration_tests/document_loaders/test_org_mode.py similarity index 100% rename from tests/integration_tests/document_loaders/test_org_mode.py rename to libs/langchain/tests/integration_tests/document_loaders/test_org_mode.py diff --git a/tests/integration_tests/document_loaders/test_pdf.py b/libs/langchain/tests/integration_tests/document_loaders/test_pdf.py similarity index 100% rename from tests/integration_tests/document_loaders/test_pdf.py rename to libs/langchain/tests/integration_tests/document_loaders/test_pdf.py diff --git a/tests/integration_tests/document_loaders/test_pyspark_dataframe_loader.py b/libs/langchain/tests/integration_tests/document_loaders/test_pyspark_dataframe_loader.py similarity index 100% rename from tests/integration_tests/document_loaders/test_pyspark_dataframe_loader.py rename to libs/langchain/tests/integration_tests/document_loaders/test_pyspark_dataframe_loader.py diff --git a/tests/integration_tests/document_loaders/test_python.py b/libs/langchain/tests/integration_tests/document_loaders/test_python.py similarity index 100% rename from tests/integration_tests/document_loaders/test_python.py rename to libs/langchain/tests/integration_tests/document_loaders/test_python.py diff --git a/tests/integration_tests/document_loaders/test_rocksetdb.py b/libs/langchain/tests/integration_tests/document_loaders/test_rocksetdb.py similarity index 100% rename from tests/integration_tests/document_loaders/test_rocksetdb.py rename to libs/langchain/tests/integration_tests/document_loaders/test_rocksetdb.py diff --git a/tests/integration_tests/document_loaders/test_rst.py b/libs/langchain/tests/integration_tests/document_loaders/test_rst.py similarity index 100% rename from tests/integration_tests/document_loaders/test_rst.py rename to libs/langchain/tests/integration_tests/document_loaders/test_rst.py diff --git a/tests/integration_tests/document_loaders/test_sitemap.py b/libs/langchain/tests/integration_tests/document_loaders/test_sitemap.py similarity index 100% rename from tests/integration_tests/document_loaders/test_sitemap.py rename to libs/langchain/tests/integration_tests/document_loaders/test_sitemap.py diff --git a/tests/integration_tests/document_loaders/test_slack.py b/libs/langchain/tests/integration_tests/document_loaders/test_slack.py similarity index 100% rename from tests/integration_tests/document_loaders/test_slack.py rename to libs/langchain/tests/integration_tests/document_loaders/test_slack.py diff --git a/tests/integration_tests/document_loaders/test_spreedly.py b/libs/langchain/tests/integration_tests/document_loaders/test_spreedly.py similarity index 100% rename from tests/integration_tests/document_loaders/test_spreedly.py rename to libs/langchain/tests/integration_tests/document_loaders/test_spreedly.py diff --git a/tests/integration_tests/document_loaders/test_stripe.py b/libs/langchain/tests/integration_tests/document_loaders/test_stripe.py similarity index 100% rename from tests/integration_tests/document_loaders/test_stripe.py rename to libs/langchain/tests/integration_tests/document_loaders/test_stripe.py diff --git a/tests/integration_tests/document_loaders/test_tsv.py b/libs/langchain/tests/integration_tests/document_loaders/test_tsv.py similarity index 100% rename from tests/integration_tests/document_loaders/test_tsv.py rename to libs/langchain/tests/integration_tests/document_loaders/test_tsv.py diff --git a/tests/integration_tests/document_loaders/test_unstructured.py b/libs/langchain/tests/integration_tests/document_loaders/test_unstructured.py similarity index 100% rename from tests/integration_tests/document_loaders/test_unstructured.py rename to libs/langchain/tests/integration_tests/document_loaders/test_unstructured.py diff --git a/tests/integration_tests/document_loaders/test_url.py b/libs/langchain/tests/integration_tests/document_loaders/test_url.py similarity index 100% rename from tests/integration_tests/document_loaders/test_url.py rename to libs/langchain/tests/integration_tests/document_loaders/test_url.py diff --git a/tests/integration_tests/document_loaders/test_url_playwright.py b/libs/langchain/tests/integration_tests/document_loaders/test_url_playwright.py similarity index 100% rename from tests/integration_tests/document_loaders/test_url_playwright.py rename to libs/langchain/tests/integration_tests/document_loaders/test_url_playwright.py diff --git a/tests/integration_tests/document_loaders/test_whatsapp_chat.py b/libs/langchain/tests/integration_tests/document_loaders/test_whatsapp_chat.py similarity index 100% rename from tests/integration_tests/document_loaders/test_whatsapp_chat.py rename to libs/langchain/tests/integration_tests/document_loaders/test_whatsapp_chat.py diff --git a/tests/integration_tests/document_loaders/test_xml.py b/libs/langchain/tests/integration_tests/document_loaders/test_xml.py similarity index 100% rename from tests/integration_tests/document_loaders/test_xml.py rename to libs/langchain/tests/integration_tests/document_loaders/test_xml.py diff --git a/tests/integration_tests/document_loaders/test_xorbits.py b/libs/langchain/tests/integration_tests/document_loaders/test_xorbits.py similarity index 100% rename from tests/integration_tests/document_loaders/test_xorbits.py rename to libs/langchain/tests/integration_tests/document_loaders/test_xorbits.py diff --git a/tests/integration_tests/embeddings/__init__.py b/libs/langchain/tests/integration_tests/embeddings/__init__.py similarity index 100% rename from tests/integration_tests/embeddings/__init__.py rename to libs/langchain/tests/integration_tests/embeddings/__init__.py diff --git a/tests/integration_tests/embeddings/test_cohere.py b/libs/langchain/tests/integration_tests/embeddings/test_cohere.py similarity index 100% rename from tests/integration_tests/embeddings/test_cohere.py rename to libs/langchain/tests/integration_tests/embeddings/test_cohere.py diff --git a/tests/integration_tests/embeddings/test_dashscope.py b/libs/langchain/tests/integration_tests/embeddings/test_dashscope.py similarity index 100% rename from tests/integration_tests/embeddings/test_dashscope.py rename to libs/langchain/tests/integration_tests/embeddings/test_dashscope.py diff --git a/tests/integration_tests/embeddings/test_deepinfra.py b/libs/langchain/tests/integration_tests/embeddings/test_deepinfra.py similarity index 100% rename from tests/integration_tests/embeddings/test_deepinfra.py rename to libs/langchain/tests/integration_tests/embeddings/test_deepinfra.py diff --git a/tests/integration_tests/embeddings/test_elasticsearch.py b/libs/langchain/tests/integration_tests/embeddings/test_elasticsearch.py similarity index 100% rename from tests/integration_tests/embeddings/test_elasticsearch.py rename to libs/langchain/tests/integration_tests/embeddings/test_elasticsearch.py diff --git a/tests/integration_tests/embeddings/test_embaas.py b/libs/langchain/tests/integration_tests/embeddings/test_embaas.py similarity index 100% rename from tests/integration_tests/embeddings/test_embaas.py rename to libs/langchain/tests/integration_tests/embeddings/test_embaas.py diff --git a/tests/integration_tests/embeddings/test_google_palm.py b/libs/langchain/tests/integration_tests/embeddings/test_google_palm.py similarity index 100% rename from tests/integration_tests/embeddings/test_google_palm.py rename to libs/langchain/tests/integration_tests/embeddings/test_google_palm.py diff --git a/tests/integration_tests/embeddings/test_huggingface.py b/libs/langchain/tests/integration_tests/embeddings/test_huggingface.py similarity index 100% rename from tests/integration_tests/embeddings/test_huggingface.py rename to libs/langchain/tests/integration_tests/embeddings/test_huggingface.py diff --git a/tests/integration_tests/embeddings/test_huggingface_hub.py b/libs/langchain/tests/integration_tests/embeddings/test_huggingface_hub.py similarity index 100% rename from tests/integration_tests/embeddings/test_huggingface_hub.py rename to libs/langchain/tests/integration_tests/embeddings/test_huggingface_hub.py diff --git a/tests/integration_tests/embeddings/test_jina.py b/libs/langchain/tests/integration_tests/embeddings/test_jina.py similarity index 100% rename from tests/integration_tests/embeddings/test_jina.py rename to libs/langchain/tests/integration_tests/embeddings/test_jina.py diff --git a/tests/integration_tests/embeddings/test_llamacpp.py b/libs/langchain/tests/integration_tests/embeddings/test_llamacpp.py similarity index 100% rename from tests/integration_tests/embeddings/test_llamacpp.py rename to libs/langchain/tests/integration_tests/embeddings/test_llamacpp.py diff --git a/tests/integration_tests/embeddings/test_modelscope_hub.py b/libs/langchain/tests/integration_tests/embeddings/test_modelscope_hub.py similarity index 100% rename from tests/integration_tests/embeddings/test_modelscope_hub.py rename to libs/langchain/tests/integration_tests/embeddings/test_modelscope_hub.py diff --git a/tests/integration_tests/embeddings/test_mosaicml.py b/libs/langchain/tests/integration_tests/embeddings/test_mosaicml.py similarity index 100% rename from tests/integration_tests/embeddings/test_mosaicml.py rename to libs/langchain/tests/integration_tests/embeddings/test_mosaicml.py diff --git a/tests/integration_tests/embeddings/test_octoai_embeddings.py b/libs/langchain/tests/integration_tests/embeddings/test_octoai_embeddings.py similarity index 100% rename from tests/integration_tests/embeddings/test_octoai_embeddings.py rename to libs/langchain/tests/integration_tests/embeddings/test_octoai_embeddings.py diff --git a/tests/integration_tests/embeddings/test_openai.py b/libs/langchain/tests/integration_tests/embeddings/test_openai.py similarity index 100% rename from tests/integration_tests/embeddings/test_openai.py rename to libs/langchain/tests/integration_tests/embeddings/test_openai.py diff --git a/tests/integration_tests/embeddings/test_self_hosted.py b/libs/langchain/tests/integration_tests/embeddings/test_self_hosted.py similarity index 100% rename from tests/integration_tests/embeddings/test_self_hosted.py rename to libs/langchain/tests/integration_tests/embeddings/test_self_hosted.py diff --git a/tests/integration_tests/embeddings/test_sentence_transformer.py b/libs/langchain/tests/integration_tests/embeddings/test_sentence_transformer.py similarity index 100% rename from tests/integration_tests/embeddings/test_sentence_transformer.py rename to libs/langchain/tests/integration_tests/embeddings/test_sentence_transformer.py diff --git a/tests/integration_tests/embeddings/test_tensorflow_hub.py b/libs/langchain/tests/integration_tests/embeddings/test_tensorflow_hub.py similarity index 100% rename from tests/integration_tests/embeddings/test_tensorflow_hub.py rename to libs/langchain/tests/integration_tests/embeddings/test_tensorflow_hub.py diff --git a/tests/integration_tests/embeddings/test_vertexai.py b/libs/langchain/tests/integration_tests/embeddings/test_vertexai.py similarity index 100% rename from tests/integration_tests/embeddings/test_vertexai.py rename to libs/langchain/tests/integration_tests/embeddings/test_vertexai.py diff --git a/tests/integration_tests/evaluation/__init__.py b/libs/langchain/tests/integration_tests/evaluation/__init__.py similarity index 100% rename from tests/integration_tests/evaluation/__init__.py rename to libs/langchain/tests/integration_tests/evaluation/__init__.py diff --git a/tests/integration_tests/evaluation/embedding_distance/test_embedding.py b/libs/langchain/tests/integration_tests/evaluation/embedding_distance/test_embedding.py similarity index 100% rename from tests/integration_tests/evaluation/embedding_distance/test_embedding.py rename to libs/langchain/tests/integration_tests/evaluation/embedding_distance/test_embedding.py diff --git a/tests/integration_tests/examples/README.org b/libs/langchain/tests/integration_tests/examples/README.org similarity index 100% rename from tests/integration_tests/examples/README.org rename to libs/langchain/tests/integration_tests/examples/README.org diff --git a/tests/integration_tests/examples/README.rst b/libs/langchain/tests/integration_tests/examples/README.rst similarity index 100% rename from tests/integration_tests/examples/README.rst rename to libs/langchain/tests/integration_tests/examples/README.rst diff --git a/tests/integration_tests/examples/brandfetch-brandfetch-2.0.0-resolved.json b/libs/langchain/tests/integration_tests/examples/brandfetch-brandfetch-2.0.0-resolved.json similarity index 100% rename from tests/integration_tests/examples/brandfetch-brandfetch-2.0.0-resolved.json rename to libs/langchain/tests/integration_tests/examples/brandfetch-brandfetch-2.0.0-resolved.json diff --git a/tests/integration_tests/examples/default-encoding.py b/libs/langchain/tests/integration_tests/examples/default-encoding.py similarity index 100% rename from tests/integration_tests/examples/default-encoding.py rename to libs/langchain/tests/integration_tests/examples/default-encoding.py diff --git a/tests/integration_tests/examples/example-utf8.html b/libs/langchain/tests/integration_tests/examples/example-utf8.html similarity index 100% rename from tests/integration_tests/examples/example-utf8.html rename to libs/langchain/tests/integration_tests/examples/example-utf8.html diff --git a/tests/integration_tests/examples/example.html b/libs/langchain/tests/integration_tests/examples/example.html similarity index 100% rename from tests/integration_tests/examples/example.html rename to libs/langchain/tests/integration_tests/examples/example.html diff --git a/tests/integration_tests/examples/example.json b/libs/langchain/tests/integration_tests/examples/example.json similarity index 100% rename from tests/integration_tests/examples/example.json rename to libs/langchain/tests/integration_tests/examples/example.json diff --git a/tests/integration_tests/examples/example.mht b/libs/langchain/tests/integration_tests/examples/example.mht similarity index 97% rename from tests/integration_tests/examples/example.mht rename to libs/langchain/tests/integration_tests/examples/example.mht index 44a45ea020e..4827353c4dd 100644 --- a/tests/integration_tests/examples/example.mht +++ b/libs/langchain/tests/integration_tests/examples/example.mht @@ -1,108 +1,108 @@ -From:+ {formatted_generation} +
+
- LANG C=
-HAIN =F0=9F=A6=9C=EF=B8=8F=
-=F0=9F=94=97
Official Home Page =
-
-
|
-
-
|
-
|
- - |
| - | -- |
| - | -- |
| - | -- |
-
|
-
-
|
If you have any comments about our WEB page, you can=20 -write us at the address shown above. However, due to=20 -the limited number of personnel in our corporate office, we are unable to= -=20 -provide a direct response.
-Copyright =C2=A9 2023-2023 LangChain = -Inc.=20 -
- - -------MultipartBoundary--dYaUgeoeP18TqraaeOwkeZyu1vI09OtkFwH2rcnJMt------ +From:
+ LANG C=
+HAIN =F0=9F=A6=9C=EF=B8=8F=
+=F0=9F=94=97
Official Home Page =
+
+
|
+
+
|
+
|
+ + |
| + | ++ |
| + | ++ |
| + | ++ |
+
|
+
+
|
If you have any comments about our WEB page, you can=20 +write us at the address shown above. However, due to=20 +the limited number of personnel in our corporate office, we are unable to= +=20 +provide a direct response.
+Copyright =C2=A9 2023-2023 LangChain = +Inc.=20 +
+ + +------MultipartBoundary--dYaUgeoeP18TqraaeOwkeZyu1vI09OtkFwH2rcnJMt------ diff --git a/tests/integration_tests/examples/facebook_chat.json b/libs/langchain/tests/integration_tests/examples/facebook_chat.json similarity index 100% rename from tests/integration_tests/examples/facebook_chat.json rename to libs/langchain/tests/integration_tests/examples/facebook_chat.json diff --git a/tests/integration_tests/examples/factbook.xml b/libs/langchain/tests/integration_tests/examples/factbook.xml similarity index 100% rename from tests/integration_tests/examples/factbook.xml rename to libs/langchain/tests/integration_tests/examples/factbook.xml diff --git a/tests/integration_tests/examples/fake-email-attachment.eml b/libs/langchain/tests/integration_tests/examples/fake-email-attachment.eml similarity index 100% rename from tests/integration_tests/examples/fake-email-attachment.eml rename to libs/langchain/tests/integration_tests/examples/fake-email-attachment.eml diff --git a/tests/integration_tests/examples/fake.odt b/libs/langchain/tests/integration_tests/examples/fake.odt similarity index 100% rename from tests/integration_tests/examples/fake.odt rename to libs/langchain/tests/integration_tests/examples/fake.odt diff --git a/tests/integration_tests/examples/hello.msg b/libs/langchain/tests/integration_tests/examples/hello.msg similarity index 100% rename from tests/integration_tests/examples/hello.msg rename to libs/langchain/tests/integration_tests/examples/hello.msg diff --git a/tests/integration_tests/examples/hello.pdf b/libs/langchain/tests/integration_tests/examples/hello.pdf similarity index 100% rename from tests/integration_tests/examples/hello.pdf rename to libs/langchain/tests/integration_tests/examples/hello.pdf diff --git a/tests/integration_tests/examples/hello_world.js b/libs/langchain/tests/integration_tests/examples/hello_world.js similarity index 100% rename from tests/integration_tests/examples/hello_world.js rename to libs/langchain/tests/integration_tests/examples/hello_world.js diff --git a/tests/integration_tests/examples/hello_world.py b/libs/langchain/tests/integration_tests/examples/hello_world.py similarity index 100% rename from tests/integration_tests/examples/hello_world.py rename to libs/langchain/tests/integration_tests/examples/hello_world.py diff --git a/tests/integration_tests/examples/layout-parser-paper.pdf b/libs/langchain/tests/integration_tests/examples/layout-parser-paper.pdf similarity index 100% rename from tests/integration_tests/examples/layout-parser-paper.pdf rename to libs/langchain/tests/integration_tests/examples/layout-parser-paper.pdf diff --git a/tests/integration_tests/examples/non-utf8-encoding.py b/libs/langchain/tests/integration_tests/examples/non-utf8-encoding.py similarity index 100% rename from tests/integration_tests/examples/non-utf8-encoding.py rename to libs/langchain/tests/integration_tests/examples/non-utf8-encoding.py diff --git a/tests/integration_tests/examples/sitemap.xml b/libs/langchain/tests/integration_tests/examples/sitemap.xml similarity index 100% rename from tests/integration_tests/examples/sitemap.xml rename to libs/langchain/tests/integration_tests/examples/sitemap.xml diff --git a/tests/integration_tests/examples/slack_export.zip b/libs/langchain/tests/integration_tests/examples/slack_export.zip similarity index 100% rename from tests/integration_tests/examples/slack_export.zip rename to libs/langchain/tests/integration_tests/examples/slack_export.zip diff --git a/tests/integration_tests/examples/stanley-cups.csv b/libs/langchain/tests/integration_tests/examples/stanley-cups.csv similarity index 95% rename from tests/integration_tests/examples/stanley-cups.csv rename to libs/langchain/tests/integration_tests/examples/stanley-cups.csv index 4414023f005..482a10ddfd1 100644 --- a/tests/integration_tests/examples/stanley-cups.csv +++ b/libs/langchain/tests/integration_tests/examples/stanley-cups.csv @@ -1,5 +1,5 @@ -Stanley Cups,, -Team,Location,Stanley Cups -Blues,STL,1 -Flyers,PHI,2 +Stanley Cups,, +Team,Location,Stanley Cups +Blues,STL,1 +Flyers,PHI,2 Maple Leafs,TOR,13 \ No newline at end of file diff --git a/tests/integration_tests/examples/stanley-cups.tsv b/libs/langchain/tests/integration_tests/examples/stanley-cups.tsv similarity index 100% rename from tests/integration_tests/examples/stanley-cups.tsv rename to libs/langchain/tests/integration_tests/examples/stanley-cups.tsv diff --git a/tests/integration_tests/examples/stanley-cups.xlsx b/libs/langchain/tests/integration_tests/examples/stanley-cups.xlsx similarity index 100% rename from tests/integration_tests/examples/stanley-cups.xlsx rename to libs/langchain/tests/integration_tests/examples/stanley-cups.xlsx diff --git a/tests/integration_tests/examples/whatsapp_chat.txt b/libs/langchain/tests/integration_tests/examples/whatsapp_chat.txt similarity index 100% rename from tests/integration_tests/examples/whatsapp_chat.txt rename to libs/langchain/tests/integration_tests/examples/whatsapp_chat.txt diff --git a/tests/integration_tests/graphs/__init__.py b/libs/langchain/tests/integration_tests/graphs/__init__.py similarity index 100% rename from tests/integration_tests/graphs/__init__.py rename to libs/langchain/tests/integration_tests/graphs/__init__.py diff --git a/tests/integration_tests/graphs/test_hugegraph.py b/libs/langchain/tests/integration_tests/graphs/test_hugegraph.py similarity index 100% rename from tests/integration_tests/graphs/test_hugegraph.py rename to libs/langchain/tests/integration_tests/graphs/test_hugegraph.py diff --git a/tests/integration_tests/llms/__init__.py b/libs/langchain/tests/integration_tests/llms/__init__.py similarity index 100% rename from tests/integration_tests/llms/__init__.py rename to libs/langchain/tests/integration_tests/llms/__init__.py diff --git a/tests/integration_tests/llms/test_ai21.py b/libs/langchain/tests/integration_tests/llms/test_ai21.py similarity index 100% rename from tests/integration_tests/llms/test_ai21.py rename to libs/langchain/tests/integration_tests/llms/test_ai21.py diff --git a/tests/integration_tests/llms/test_aleph_alpha.py b/libs/langchain/tests/integration_tests/llms/test_aleph_alpha.py similarity index 100% rename from tests/integration_tests/llms/test_aleph_alpha.py rename to libs/langchain/tests/integration_tests/llms/test_aleph_alpha.py diff --git a/tests/integration_tests/llms/test_anthropic.py b/libs/langchain/tests/integration_tests/llms/test_anthropic.py similarity index 100% rename from tests/integration_tests/llms/test_anthropic.py rename to libs/langchain/tests/integration_tests/llms/test_anthropic.py diff --git a/tests/integration_tests/llms/test_anyscale.py b/libs/langchain/tests/integration_tests/llms/test_anyscale.py similarity index 100% rename from tests/integration_tests/llms/test_anyscale.py rename to libs/langchain/tests/integration_tests/llms/test_anyscale.py diff --git a/tests/integration_tests/llms/test_aviary.py b/libs/langchain/tests/integration_tests/llms/test_aviary.py similarity index 100% rename from tests/integration_tests/llms/test_aviary.py rename to libs/langchain/tests/integration_tests/llms/test_aviary.py diff --git a/tests/integration_tests/llms/test_azureml_endpoint.py b/libs/langchain/tests/integration_tests/llms/test_azureml_endpoint.py similarity index 100% rename from tests/integration_tests/llms/test_azureml_endpoint.py rename to libs/langchain/tests/integration_tests/llms/test_azureml_endpoint.py diff --git a/tests/integration_tests/llms/test_banana.py b/libs/langchain/tests/integration_tests/llms/test_banana.py similarity index 100% rename from tests/integration_tests/llms/test_banana.py rename to libs/langchain/tests/integration_tests/llms/test_banana.py diff --git a/tests/integration_tests/llms/test_baseten.py b/libs/langchain/tests/integration_tests/llms/test_baseten.py similarity index 100% rename from tests/integration_tests/llms/test_baseten.py rename to libs/langchain/tests/integration_tests/llms/test_baseten.py diff --git a/tests/integration_tests/llms/test_beam.py b/libs/langchain/tests/integration_tests/llms/test_beam.py similarity index 100% rename from tests/integration_tests/llms/test_beam.py rename to libs/langchain/tests/integration_tests/llms/test_beam.py diff --git a/tests/integration_tests/llms/test_cerebrium.py b/libs/langchain/tests/integration_tests/llms/test_cerebrium.py similarity index 100% rename from tests/integration_tests/llms/test_cerebrium.py rename to libs/langchain/tests/integration_tests/llms/test_cerebrium.py diff --git a/tests/integration_tests/llms/test_clarifai.py b/libs/langchain/tests/integration_tests/llms/test_clarifai.py similarity index 100% rename from tests/integration_tests/llms/test_clarifai.py rename to libs/langchain/tests/integration_tests/llms/test_clarifai.py diff --git a/tests/integration_tests/llms/test_cohere.py b/libs/langchain/tests/integration_tests/llms/test_cohere.py similarity index 100% rename from tests/integration_tests/llms/test_cohere.py rename to libs/langchain/tests/integration_tests/llms/test_cohere.py diff --git a/tests/integration_tests/llms/test_ctransformers.py b/libs/langchain/tests/integration_tests/llms/test_ctransformers.py similarity index 100% rename from tests/integration_tests/llms/test_ctransformers.py rename to libs/langchain/tests/integration_tests/llms/test_ctransformers.py diff --git a/tests/integration_tests/llms/test_deepinfra.py b/libs/langchain/tests/integration_tests/llms/test_deepinfra.py similarity index 100% rename from tests/integration_tests/llms/test_deepinfra.py rename to libs/langchain/tests/integration_tests/llms/test_deepinfra.py diff --git a/tests/integration_tests/llms/test_forefrontai.py b/libs/langchain/tests/integration_tests/llms/test_forefrontai.py similarity index 100% rename from tests/integration_tests/llms/test_forefrontai.py rename to libs/langchain/tests/integration_tests/llms/test_forefrontai.py diff --git a/tests/integration_tests/llms/test_google_palm.py b/libs/langchain/tests/integration_tests/llms/test_google_palm.py similarity index 100% rename from tests/integration_tests/llms/test_google_palm.py rename to libs/langchain/tests/integration_tests/llms/test_google_palm.py diff --git a/tests/integration_tests/llms/test_gooseai.py b/libs/langchain/tests/integration_tests/llms/test_gooseai.py similarity index 100% rename from tests/integration_tests/llms/test_gooseai.py rename to libs/langchain/tests/integration_tests/llms/test_gooseai.py diff --git a/tests/integration_tests/llms/test_gpt4all.py b/libs/langchain/tests/integration_tests/llms/test_gpt4all.py similarity index 100% rename from tests/integration_tests/llms/test_gpt4all.py rename to libs/langchain/tests/integration_tests/llms/test_gpt4all.py diff --git a/tests/integration_tests/llms/test_huggingface_endpoint.py b/libs/langchain/tests/integration_tests/llms/test_huggingface_endpoint.py similarity index 100% rename from tests/integration_tests/llms/test_huggingface_endpoint.py rename to libs/langchain/tests/integration_tests/llms/test_huggingface_endpoint.py diff --git a/tests/integration_tests/llms/test_huggingface_hub.py b/libs/langchain/tests/integration_tests/llms/test_huggingface_hub.py similarity index 100% rename from tests/integration_tests/llms/test_huggingface_hub.py rename to libs/langchain/tests/integration_tests/llms/test_huggingface_hub.py diff --git a/tests/integration_tests/llms/test_huggingface_pipeline.py b/libs/langchain/tests/integration_tests/llms/test_huggingface_pipeline.py similarity index 100% rename from tests/integration_tests/llms/test_huggingface_pipeline.py rename to libs/langchain/tests/integration_tests/llms/test_huggingface_pipeline.py diff --git a/tests/integration_tests/llms/test_llamacpp.py b/libs/langchain/tests/integration_tests/llms/test_llamacpp.py similarity index 100% rename from tests/integration_tests/llms/test_llamacpp.py rename to libs/langchain/tests/integration_tests/llms/test_llamacpp.py diff --git a/tests/integration_tests/llms/test_manifest.py b/libs/langchain/tests/integration_tests/llms/test_manifest.py similarity index 100% rename from tests/integration_tests/llms/test_manifest.py rename to libs/langchain/tests/integration_tests/llms/test_manifest.py diff --git a/tests/integration_tests/llms/test_modal.py b/libs/langchain/tests/integration_tests/llms/test_modal.py similarity index 100% rename from tests/integration_tests/llms/test_modal.py rename to libs/langchain/tests/integration_tests/llms/test_modal.py diff --git a/tests/integration_tests/llms/test_mosaicml.py b/libs/langchain/tests/integration_tests/llms/test_mosaicml.py similarity index 100% rename from tests/integration_tests/llms/test_mosaicml.py rename to libs/langchain/tests/integration_tests/llms/test_mosaicml.py diff --git a/tests/integration_tests/llms/test_nlpcloud.py b/libs/langchain/tests/integration_tests/llms/test_nlpcloud.py similarity index 100% rename from tests/integration_tests/llms/test_nlpcloud.py rename to libs/langchain/tests/integration_tests/llms/test_nlpcloud.py diff --git a/tests/integration_tests/llms/test_octoai_endpoint.py b/libs/langchain/tests/integration_tests/llms/test_octoai_endpoint.py similarity index 100% rename from tests/integration_tests/llms/test_octoai_endpoint.py rename to libs/langchain/tests/integration_tests/llms/test_octoai_endpoint.py diff --git a/tests/integration_tests/llms/test_openai.py b/libs/langchain/tests/integration_tests/llms/test_openai.py similarity index 100% rename from tests/integration_tests/llms/test_openai.py rename to libs/langchain/tests/integration_tests/llms/test_openai.py diff --git a/tests/integration_tests/llms/test_openllm.py b/libs/langchain/tests/integration_tests/llms/test_openllm.py similarity index 100% rename from tests/integration_tests/llms/test_openllm.py rename to libs/langchain/tests/integration_tests/llms/test_openllm.py diff --git a/tests/integration_tests/llms/test_openlm.py b/libs/langchain/tests/integration_tests/llms/test_openlm.py similarity index 100% rename from tests/integration_tests/llms/test_openlm.py rename to libs/langchain/tests/integration_tests/llms/test_openlm.py diff --git a/tests/integration_tests/llms/test_petals.py b/libs/langchain/tests/integration_tests/llms/test_petals.py similarity index 100% rename from tests/integration_tests/llms/test_petals.py rename to libs/langchain/tests/integration_tests/llms/test_petals.py diff --git a/tests/integration_tests/llms/test_pipelineai.py b/libs/langchain/tests/integration_tests/llms/test_pipelineai.py similarity index 100% rename from tests/integration_tests/llms/test_pipelineai.py rename to libs/langchain/tests/integration_tests/llms/test_pipelineai.py diff --git a/tests/integration_tests/llms/test_predictionguard.py b/libs/langchain/tests/integration_tests/llms/test_predictionguard.py similarity index 100% rename from tests/integration_tests/llms/test_predictionguard.py rename to libs/langchain/tests/integration_tests/llms/test_predictionguard.py diff --git a/tests/integration_tests/llms/test_promptlayer_openai.py b/libs/langchain/tests/integration_tests/llms/test_promptlayer_openai.py similarity index 100% rename from tests/integration_tests/llms/test_promptlayer_openai.py rename to libs/langchain/tests/integration_tests/llms/test_promptlayer_openai.py diff --git a/tests/integration_tests/llms/test_propmptlayer_openai_chat.py b/libs/langchain/tests/integration_tests/llms/test_propmptlayer_openai_chat.py similarity index 100% rename from tests/integration_tests/llms/test_propmptlayer_openai_chat.py rename to libs/langchain/tests/integration_tests/llms/test_propmptlayer_openai_chat.py diff --git a/tests/integration_tests/llms/test_replicate.py b/libs/langchain/tests/integration_tests/llms/test_replicate.py similarity index 100% rename from tests/integration_tests/llms/test_replicate.py rename to libs/langchain/tests/integration_tests/llms/test_replicate.py diff --git a/tests/integration_tests/llms/test_rwkv.py b/libs/langchain/tests/integration_tests/llms/test_rwkv.py similarity index 100% rename from tests/integration_tests/llms/test_rwkv.py rename to libs/langchain/tests/integration_tests/llms/test_rwkv.py diff --git a/tests/integration_tests/llms/test_self_hosted_llm.py b/libs/langchain/tests/integration_tests/llms/test_self_hosted_llm.py similarity index 100% rename from tests/integration_tests/llms/test_self_hosted_llm.py rename to libs/langchain/tests/integration_tests/llms/test_self_hosted_llm.py diff --git a/tests/integration_tests/llms/test_stochasticai.py b/libs/langchain/tests/integration_tests/llms/test_stochasticai.py similarity index 100% rename from tests/integration_tests/llms/test_stochasticai.py rename to libs/langchain/tests/integration_tests/llms/test_stochasticai.py diff --git a/tests/integration_tests/llms/test_tongyi.py b/libs/langchain/tests/integration_tests/llms/test_tongyi.py similarity index 100% rename from tests/integration_tests/llms/test_tongyi.py rename to libs/langchain/tests/integration_tests/llms/test_tongyi.py diff --git a/tests/integration_tests/llms/test_vertexai.py b/libs/langchain/tests/integration_tests/llms/test_vertexai.py similarity index 100% rename from tests/integration_tests/llms/test_vertexai.py rename to libs/langchain/tests/integration_tests/llms/test_vertexai.py diff --git a/tests/integration_tests/llms/test_writer.py b/libs/langchain/tests/integration_tests/llms/test_writer.py similarity index 100% rename from tests/integration_tests/llms/test_writer.py rename to libs/langchain/tests/integration_tests/llms/test_writer.py diff --git a/tests/integration_tests/llms/utils.py b/libs/langchain/tests/integration_tests/llms/utils.py similarity index 100% rename from tests/integration_tests/llms/utils.py rename to libs/langchain/tests/integration_tests/llms/utils.py diff --git a/tests/integration_tests/memory/__init__.py b/libs/langchain/tests/integration_tests/memory/__init__.py similarity index 100% rename from tests/integration_tests/memory/__init__.py rename to libs/langchain/tests/integration_tests/memory/__init__.py diff --git a/tests/integration_tests/memory/test_cassandra.py b/libs/langchain/tests/integration_tests/memory/test_cassandra.py similarity index 100% rename from tests/integration_tests/memory/test_cassandra.py rename to libs/langchain/tests/integration_tests/memory/test_cassandra.py diff --git a/tests/integration_tests/memory/test_cosmos_db.py b/libs/langchain/tests/integration_tests/memory/test_cosmos_db.py similarity index 100% rename from tests/integration_tests/memory/test_cosmos_db.py rename to libs/langchain/tests/integration_tests/memory/test_cosmos_db.py diff --git a/tests/integration_tests/memory/test_firestore.py b/libs/langchain/tests/integration_tests/memory/test_firestore.py similarity index 100% rename from tests/integration_tests/memory/test_firestore.py rename to libs/langchain/tests/integration_tests/memory/test_firestore.py diff --git a/tests/integration_tests/memory/test_momento.py b/libs/langchain/tests/integration_tests/memory/test_momento.py similarity index 100% rename from tests/integration_tests/memory/test_momento.py rename to libs/langchain/tests/integration_tests/memory/test_momento.py diff --git a/tests/integration_tests/memory/test_mongodb.py b/libs/langchain/tests/integration_tests/memory/test_mongodb.py similarity index 100% rename from tests/integration_tests/memory/test_mongodb.py rename to libs/langchain/tests/integration_tests/memory/test_mongodb.py diff --git a/tests/integration_tests/memory/test_redis.py b/libs/langchain/tests/integration_tests/memory/test_redis.py similarity index 100% rename from tests/integration_tests/memory/test_redis.py rename to libs/langchain/tests/integration_tests/memory/test_redis.py diff --git a/tests/integration_tests/prompts/__init__.py b/libs/langchain/tests/integration_tests/prompts/__init__.py similarity index 100% rename from tests/integration_tests/prompts/__init__.py rename to libs/langchain/tests/integration_tests/prompts/__init__.py diff --git a/tests/integration_tests/prompts/test_ngram_overlap_example_selector.py b/libs/langchain/tests/integration_tests/prompts/test_ngram_overlap_example_selector.py similarity index 100% rename from tests/integration_tests/prompts/test_ngram_overlap_example_selector.py rename to libs/langchain/tests/integration_tests/prompts/test_ngram_overlap_example_selector.py diff --git a/tests/integration_tests/retrievers/__init__.py b/libs/langchain/tests/integration_tests/retrievers/__init__.py similarity index 100% rename from tests/integration_tests/retrievers/__init__.py rename to libs/langchain/tests/integration_tests/retrievers/__init__.py diff --git a/tests/integration_tests/retrievers/docarray/__init__.py b/libs/langchain/tests/integration_tests/retrievers/docarray/__init__.py similarity index 100% rename from tests/integration_tests/retrievers/docarray/__init__.py rename to libs/langchain/tests/integration_tests/retrievers/docarray/__init__.py diff --git a/tests/integration_tests/retrievers/docarray/fixtures.py b/libs/langchain/tests/integration_tests/retrievers/docarray/fixtures.py similarity index 100% rename from tests/integration_tests/retrievers/docarray/fixtures.py rename to libs/langchain/tests/integration_tests/retrievers/docarray/fixtures.py diff --git a/tests/integration_tests/retrievers/docarray/test_backends.py b/libs/langchain/tests/integration_tests/retrievers/docarray/test_backends.py similarity index 100% rename from tests/integration_tests/retrievers/docarray/test_backends.py rename to libs/langchain/tests/integration_tests/retrievers/docarray/test_backends.py diff --git a/tests/integration_tests/retrievers/document_compressors/__init__.py b/libs/langchain/tests/integration_tests/retrievers/document_compressors/__init__.py similarity index 100% rename from tests/integration_tests/retrievers/document_compressors/__init__.py rename to libs/langchain/tests/integration_tests/retrievers/document_compressors/__init__.py diff --git a/tests/integration_tests/retrievers/document_compressors/test_base.py b/libs/langchain/tests/integration_tests/retrievers/document_compressors/test_base.py similarity index 100% rename from tests/integration_tests/retrievers/document_compressors/test_base.py rename to libs/langchain/tests/integration_tests/retrievers/document_compressors/test_base.py diff --git a/tests/integration_tests/retrievers/document_compressors/test_chain_extract.py b/libs/langchain/tests/integration_tests/retrievers/document_compressors/test_chain_extract.py similarity index 100% rename from tests/integration_tests/retrievers/document_compressors/test_chain_extract.py rename to libs/langchain/tests/integration_tests/retrievers/document_compressors/test_chain_extract.py diff --git a/tests/integration_tests/retrievers/document_compressors/test_chain_filter.py b/libs/langchain/tests/integration_tests/retrievers/document_compressors/test_chain_filter.py similarity index 100% rename from tests/integration_tests/retrievers/document_compressors/test_chain_filter.py rename to libs/langchain/tests/integration_tests/retrievers/document_compressors/test_chain_filter.py diff --git a/tests/integration_tests/retrievers/document_compressors/test_cohere_reranker.py b/libs/langchain/tests/integration_tests/retrievers/document_compressors/test_cohere_reranker.py similarity index 100% rename from tests/integration_tests/retrievers/document_compressors/test_cohere_reranker.py rename to libs/langchain/tests/integration_tests/retrievers/document_compressors/test_cohere_reranker.py diff --git a/tests/integration_tests/retrievers/document_compressors/test_embeddings_filter.py b/libs/langchain/tests/integration_tests/retrievers/document_compressors/test_embeddings_filter.py similarity index 100% rename from tests/integration_tests/retrievers/document_compressors/test_embeddings_filter.py rename to libs/langchain/tests/integration_tests/retrievers/document_compressors/test_embeddings_filter.py diff --git a/tests/integration_tests/retrievers/test_arxiv.py b/libs/langchain/tests/integration_tests/retrievers/test_arxiv.py similarity index 100% rename from tests/integration_tests/retrievers/test_arxiv.py rename to libs/langchain/tests/integration_tests/retrievers/test_arxiv.py diff --git a/tests/integration_tests/retrievers/test_azure_cognitive_search.py b/libs/langchain/tests/integration_tests/retrievers/test_azure_cognitive_search.py similarity index 100% rename from tests/integration_tests/retrievers/test_azure_cognitive_search.py rename to libs/langchain/tests/integration_tests/retrievers/test_azure_cognitive_search.py diff --git a/tests/integration_tests/retrievers/test_contextual_compression.py b/libs/langchain/tests/integration_tests/retrievers/test_contextual_compression.py similarity index 100% rename from tests/integration_tests/retrievers/test_contextual_compression.py rename to libs/langchain/tests/integration_tests/retrievers/test_contextual_compression.py diff --git a/tests/integration_tests/retrievers/test_merger_retriever.py b/libs/langchain/tests/integration_tests/retrievers/test_merger_retriever.py similarity index 100% rename from tests/integration_tests/retrievers/test_merger_retriever.py rename to libs/langchain/tests/integration_tests/retrievers/test_merger_retriever.py diff --git a/tests/integration_tests/retrievers/test_pupmed.py b/libs/langchain/tests/integration_tests/retrievers/test_pupmed.py similarity index 100% rename from tests/integration_tests/retrievers/test_pupmed.py rename to libs/langchain/tests/integration_tests/retrievers/test_pupmed.py diff --git a/tests/integration_tests/retrievers/test_weaviate_hybrid_search.py b/libs/langchain/tests/integration_tests/retrievers/test_weaviate_hybrid_search.py similarity index 100% rename from tests/integration_tests/retrievers/test_weaviate_hybrid_search.py rename to libs/langchain/tests/integration_tests/retrievers/test_weaviate_hybrid_search.py diff --git a/tests/integration_tests/retrievers/test_wikipedia.py b/libs/langchain/tests/integration_tests/retrievers/test_wikipedia.py similarity index 100% rename from tests/integration_tests/retrievers/test_wikipedia.py rename to libs/langchain/tests/integration_tests/retrievers/test_wikipedia.py diff --git a/tests/integration_tests/smith/evaluation/test_runner_utils.py b/libs/langchain/tests/integration_tests/smith/evaluation/test_runner_utils.py similarity index 100% rename from tests/integration_tests/smith/evaluation/test_runner_utils.py rename to libs/langchain/tests/integration_tests/smith/evaluation/test_runner_utils.py diff --git a/tests/integration_tests/test_document_transformers.py b/libs/langchain/tests/integration_tests/test_document_transformers.py similarity index 100% rename from tests/integration_tests/test_document_transformers.py rename to libs/langchain/tests/integration_tests/test_document_transformers.py diff --git a/tests/integration_tests/test_kuzu.py b/libs/langchain/tests/integration_tests/test_kuzu.py similarity index 100% rename from tests/integration_tests/test_kuzu.py rename to libs/langchain/tests/integration_tests/test_kuzu.py diff --git a/tests/integration_tests/test_nebulagraph.py b/libs/langchain/tests/integration_tests/test_nebulagraph.py similarity index 100% rename from tests/integration_tests/test_nebulagraph.py rename to libs/langchain/tests/integration_tests/test_nebulagraph.py diff --git a/tests/integration_tests/test_nlp_text_splitters.py b/libs/langchain/tests/integration_tests/test_nlp_text_splitters.py similarity index 100% rename from tests/integration_tests/test_nlp_text_splitters.py rename to libs/langchain/tests/integration_tests/test_nlp_text_splitters.py diff --git a/tests/integration_tests/test_pdf_pagesplitter.py b/libs/langchain/tests/integration_tests/test_pdf_pagesplitter.py similarity index 97% rename from tests/integration_tests/test_pdf_pagesplitter.py rename to libs/langchain/tests/integration_tests/test_pdf_pagesplitter.py index e2086d89f79..f86c2f166a7 100644 --- a/tests/integration_tests/test_pdf_pagesplitter.py +++ b/libs/langchain/tests/integration_tests/test_pdf_pagesplitter.py @@ -1,19 +1,19 @@ -"""Test splitting with page numbers included.""" -import os - -from langchain.document_loaders import PyPDFLoader -from langchain.embeddings.openai import OpenAIEmbeddings -from langchain.vectorstores import FAISS - - -def test_pdf_pagesplitter() -> None: - """Test splitting with page numbers included.""" - script_dir = os.path.dirname(__file__) - loader = PyPDFLoader(os.path.join(script_dir, "examples/hello.pdf")) - docs = loader.load() - assert "page" in docs[0].metadata - assert "source" in docs[0].metadata - - faiss_index = FAISS.from_documents(docs, OpenAIEmbeddings()) - docs = faiss_index.similarity_search("Complete this sentence: Hello", k=1) - assert "Hello world" in docs[0].page_content +"""Test splitting with page numbers included.""" +import os + +from langchain.document_loaders import PyPDFLoader +from langchain.embeddings.openai import OpenAIEmbeddings +from langchain.vectorstores import FAISS + + +def test_pdf_pagesplitter() -> None: + """Test splitting with page numbers included.""" + script_dir = os.path.dirname(__file__) + loader = PyPDFLoader(os.path.join(script_dir, "examples/hello.pdf")) + docs = loader.load() + assert "page" in docs[0].metadata + assert "source" in docs[0].metadata + + faiss_index = FAISS.from_documents(docs, OpenAIEmbeddings()) + docs = faiss_index.similarity_search("Complete this sentence: Hello", k=1) + assert "Hello world" in docs[0].page_content diff --git a/tests/integration_tests/test_schema.py b/libs/langchain/tests/integration_tests/test_schema.py similarity index 100% rename from tests/integration_tests/test_schema.py rename to libs/langchain/tests/integration_tests/test_schema.py diff --git a/tests/integration_tests/test_text_splitter.py b/libs/langchain/tests/integration_tests/test_text_splitter.py similarity index 100% rename from tests/integration_tests/test_text_splitter.py rename to libs/langchain/tests/integration_tests/test_text_splitter.py diff --git a/tests/integration_tests/utilities/__init__.py b/libs/langchain/tests/integration_tests/utilities/__init__.py similarity index 100% rename from tests/integration_tests/utilities/__init__.py rename to libs/langchain/tests/integration_tests/utilities/__init__.py diff --git a/tests/integration_tests/utilities/test_arxiv.py b/libs/langchain/tests/integration_tests/utilities/test_arxiv.py similarity index 100% rename from tests/integration_tests/utilities/test_arxiv.py rename to libs/langchain/tests/integration_tests/utilities/test_arxiv.py diff --git a/tests/integration_tests/utilities/test_dataforseo_api.py b/libs/langchain/tests/integration_tests/utilities/test_dataforseo_api.py similarity index 100% rename from tests/integration_tests/utilities/test_dataforseo_api.py rename to libs/langchain/tests/integration_tests/utilities/test_dataforseo_api.py diff --git a/tests/integration_tests/utilities/test_duckduckdgo_search_api.py b/libs/langchain/tests/integration_tests/utilities/test_duckduckdgo_search_api.py similarity index 100% rename from tests/integration_tests/utilities/test_duckduckdgo_search_api.py rename to libs/langchain/tests/integration_tests/utilities/test_duckduckdgo_search_api.py diff --git a/tests/integration_tests/utilities/test_googlesearch_api.py b/libs/langchain/tests/integration_tests/utilities/test_googlesearch_api.py similarity index 100% rename from tests/integration_tests/utilities/test_googlesearch_api.py rename to libs/langchain/tests/integration_tests/utilities/test_googlesearch_api.py diff --git a/tests/integration_tests/utilities/test_googleserper_api.py b/libs/langchain/tests/integration_tests/utilities/test_googleserper_api.py similarity index 100% rename from tests/integration_tests/utilities/test_googleserper_api.py rename to libs/langchain/tests/integration_tests/utilities/test_googleserper_api.py diff --git a/tests/integration_tests/utilities/test_jira_api.py b/libs/langchain/tests/integration_tests/utilities/test_jira_api.py similarity index 100% rename from tests/integration_tests/utilities/test_jira_api.py rename to libs/langchain/tests/integration_tests/utilities/test_jira_api.py diff --git a/tests/integration_tests/utilities/test_openweathermap.py b/libs/langchain/tests/integration_tests/utilities/test_openweathermap.py similarity index 97% rename from tests/integration_tests/utilities/test_openweathermap.py rename to libs/langchain/tests/integration_tests/utilities/test_openweathermap.py index 8bbf476d125..df25c67ebb9 100644 --- a/tests/integration_tests/utilities/test_openweathermap.py +++ b/libs/langchain/tests/integration_tests/utilities/test_openweathermap.py @@ -1,24 +1,24 @@ -from langchain.utilities.openweathermap import OpenWeatherMapAPIWrapper - - -def test_openweathermap_api_wrapper() -> None: - """Test that OpenWeatherMapAPIWrapper returns correct data for London, GB.""" - - weather = OpenWeatherMapAPIWrapper() - weather_data = weather.run("London,GB") - - assert weather_data is not None - assert "London" in weather_data - assert "GB" in weather_data - assert "Detailed status:" in weather_data - assert "Wind speed:" in weather_data - assert "direction:" in weather_data - assert "Humidity:" in weather_data - assert "Temperature:" in weather_data - assert "Current:" in weather_data - assert "High:" in weather_data - assert "Low:" in weather_data - assert "Feels like:" in weather_data - assert "Rain:" in weather_data - assert "Heat index:" in weather_data - assert "Cloud cover:" in weather_data +from langchain.utilities.openweathermap import OpenWeatherMapAPIWrapper + + +def test_openweathermap_api_wrapper() -> None: + """Test that OpenWeatherMapAPIWrapper returns correct data for London, GB.""" + + weather = OpenWeatherMapAPIWrapper() + weather_data = weather.run("London,GB") + + assert weather_data is not None + assert "London" in weather_data + assert "GB" in weather_data + assert "Detailed status:" in weather_data + assert "Wind speed:" in weather_data + assert "direction:" in weather_data + assert "Humidity:" in weather_data + assert "Temperature:" in weather_data + assert "Current:" in weather_data + assert "High:" in weather_data + assert "Low:" in weather_data + assert "Feels like:" in weather_data + assert "Rain:" in weather_data + assert "Heat index:" in weather_data + assert "Cloud cover:" in weather_data diff --git a/tests/integration_tests/utilities/test_powerbi_api.py b/libs/langchain/tests/integration_tests/utilities/test_powerbi_api.py similarity index 100% rename from tests/integration_tests/utilities/test_powerbi_api.py rename to libs/langchain/tests/integration_tests/utilities/test_powerbi_api.py diff --git a/tests/integration_tests/utilities/test_pupmed.py b/libs/langchain/tests/integration_tests/utilities/test_pupmed.py similarity index 100% rename from tests/integration_tests/utilities/test_pupmed.py rename to libs/langchain/tests/integration_tests/utilities/test_pupmed.py diff --git a/tests/integration_tests/utilities/test_serpapi.py b/libs/langchain/tests/integration_tests/utilities/test_serpapi.py similarity index 100% rename from tests/integration_tests/utilities/test_serpapi.py rename to libs/langchain/tests/integration_tests/utilities/test_serpapi.py diff --git a/tests/integration_tests/utilities/test_twilio.py b/libs/langchain/tests/integration_tests/utilities/test_twilio.py similarity index 100% rename from tests/integration_tests/utilities/test_twilio.py rename to libs/langchain/tests/integration_tests/utilities/test_twilio.py diff --git a/tests/integration_tests/utilities/test_wikipedia_api.py b/libs/langchain/tests/integration_tests/utilities/test_wikipedia_api.py similarity index 100% rename from tests/integration_tests/utilities/test_wikipedia_api.py rename to libs/langchain/tests/integration_tests/utilities/test_wikipedia_api.py diff --git a/tests/integration_tests/utilities/test_wolfram_alpha_api.py b/libs/langchain/tests/integration_tests/utilities/test_wolfram_alpha_api.py similarity index 100% rename from tests/integration_tests/utilities/test_wolfram_alpha_api.py rename to libs/langchain/tests/integration_tests/utilities/test_wolfram_alpha_api.py diff --git a/tests/integration_tests/vectorstores/__init__.py b/libs/langchain/tests/integration_tests/vectorstores/__init__.py similarity index 100% rename from tests/integration_tests/vectorstores/__init__.py rename to libs/langchain/tests/integration_tests/vectorstores/__init__.py diff --git a/tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_custom_index_add_documents.yaml b/libs/langchain/tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_custom_index_add_documents.yaml similarity index 100% rename from tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_custom_index_add_documents.yaml rename to libs/langchain/tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_custom_index_add_documents.yaml diff --git a/tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_custom_index_from_documents.yaml b/libs/langchain/tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_custom_index_from_documents.yaml similarity index 100% rename from tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_custom_index_from_documents.yaml rename to libs/langchain/tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_custom_index_from_documents.yaml diff --git a/tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_default_index_from_documents.yaml b/libs/langchain/tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_default_index_from_documents.yaml similarity index 100% rename from tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_default_index_from_documents.yaml rename to libs/langchain/tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_default_index_from_documents.yaml diff --git a/tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts.yaml b/libs/langchain/tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts.yaml similarity index 100% rename from tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts.yaml rename to libs/langchain/tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts.yaml diff --git a/tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts_with_metadatas.yaml b/libs/langchain/tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts_with_metadatas.yaml similarity index 100% rename from tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts_with_metadatas.yaml rename to libs/langchain/tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts_with_metadatas.yaml diff --git a/tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts_with_scores.yaml b/libs/langchain/tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts_with_scores.yaml similarity index 100% rename from tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts_with_scores.yaml rename to libs/langchain/tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts_with_scores.yaml diff --git a/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search.yaml b/libs/langchain/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search.yaml similarity index 100% rename from tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search.yaml rename to libs/langchain/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search.yaml diff --git a/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search_by_vector.yaml b/libs/langchain/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search_by_vector.yaml similarity index 100% rename from tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search_by_vector.yaml rename to libs/langchain/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search_by_vector.yaml diff --git a/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search_with_filter.yaml b/libs/langchain/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search_with_filter.yaml similarity index 100% rename from tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search_with_filter.yaml rename to libs/langchain/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search_with_filter.yaml diff --git a/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_similarity_search_with_metadata.yaml b/libs/langchain/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_similarity_search_with_metadata.yaml similarity index 100% rename from tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_similarity_search_with_metadata.yaml rename to libs/langchain/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_similarity_search_with_metadata.yaml diff --git a/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_similarity_search_with_metadata_and_filter.yaml b/libs/langchain/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_similarity_search_with_metadata_and_filter.yaml similarity index 100% rename from tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_similarity_search_with_metadata_and_filter.yaml rename to libs/langchain/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_similarity_search_with_metadata_and_filter.yaml diff --git a/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_similarity_search_without_metadata.yaml b/libs/langchain/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_similarity_search_without_metadata.yaml similarity index 100% rename from tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_similarity_search_without_metadata.yaml rename to libs/langchain/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_similarity_search_without_metadata.yaml diff --git a/tests/integration_tests/vectorstores/conftest.py b/libs/langchain/tests/integration_tests/vectorstores/conftest.py similarity index 100% rename from tests/integration_tests/vectorstores/conftest.py rename to libs/langchain/tests/integration_tests/vectorstores/conftest.py diff --git a/tests/integration_tests/vectorstores/docarray/__init__.py b/libs/langchain/tests/integration_tests/vectorstores/docarray/__init__.py similarity index 100% rename from tests/integration_tests/vectorstores/docarray/__init__.py rename to libs/langchain/tests/integration_tests/vectorstores/docarray/__init__.py diff --git a/tests/integration_tests/vectorstores/docarray/test_hnsw.py b/libs/langchain/tests/integration_tests/vectorstores/docarray/test_hnsw.py similarity index 100% rename from tests/integration_tests/vectorstores/docarray/test_hnsw.py rename to libs/langchain/tests/integration_tests/vectorstores/docarray/test_hnsw.py diff --git a/tests/integration_tests/vectorstores/docarray/test_in_memory.py b/libs/langchain/tests/integration_tests/vectorstores/docarray/test_in_memory.py similarity index 100% rename from tests/integration_tests/vectorstores/docarray/test_in_memory.py rename to libs/langchain/tests/integration_tests/vectorstores/docarray/test_in_memory.py diff --git a/tests/integration_tests/vectorstores/docker-compose/elasticsearch.yml b/libs/langchain/tests/integration_tests/vectorstores/docker-compose/elasticsearch.yml similarity index 100% rename from tests/integration_tests/vectorstores/docker-compose/elasticsearch.yml rename to libs/langchain/tests/integration_tests/vectorstores/docker-compose/elasticsearch.yml diff --git a/tests/integration_tests/vectorstores/docker-compose/weaviate.yml b/libs/langchain/tests/integration_tests/vectorstores/docker-compose/weaviate.yml similarity index 100% rename from tests/integration_tests/vectorstores/docker-compose/weaviate.yml rename to libs/langchain/tests/integration_tests/vectorstores/docker-compose/weaviate.yml diff --git a/tests/integration_tests/vectorstores/fake_embeddings.py b/libs/langchain/tests/integration_tests/vectorstores/fake_embeddings.py similarity index 100% rename from tests/integration_tests/vectorstores/fake_embeddings.py rename to libs/langchain/tests/integration_tests/vectorstores/fake_embeddings.py diff --git a/tests/integration_tests/vectorstores/fixtures/sharks.txt b/libs/langchain/tests/integration_tests/vectorstores/fixtures/sharks.txt similarity index 100% rename from tests/integration_tests/vectorstores/fixtures/sharks.txt rename to libs/langchain/tests/integration_tests/vectorstores/fixtures/sharks.txt diff --git a/tests/integration_tests/vectorstores/qdrant/__init__.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/__init__.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/__init__.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/__init__.py diff --git a/tests/integration_tests/vectorstores/qdrant/async/__init__.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async/__init__.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/async/__init__.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/async/__init__.py diff --git a/tests/integration_tests/vectorstores/qdrant/async/common.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async/common.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/async/common.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/async/common.py diff --git a/tests/integration_tests/vectorstores/qdrant/async/test_add_texts.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async/test_add_texts.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/async/test_add_texts.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/async/test_add_texts.py diff --git a/tests/integration_tests/vectorstores/qdrant/async/test_from_texts.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async/test_from_texts.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/async/test_from_texts.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/async/test_from_texts.py diff --git a/tests/integration_tests/vectorstores/qdrant/async/test_max_marginal_relevance.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async/test_max_marginal_relevance.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/async/test_max_marginal_relevance.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/async/test_max_marginal_relevance.py diff --git a/tests/integration_tests/vectorstores/qdrant/async/test_similarity_search.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/async/test_similarity_search.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/async/test_similarity_search.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/async/test_similarity_search.py diff --git a/tests/integration_tests/vectorstores/qdrant/fixtures.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/fixtures.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/fixtures.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/fixtures.py diff --git a/tests/integration_tests/vectorstores/qdrant/test_add_texts.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/test_add_texts.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/test_add_texts.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/test_add_texts.py diff --git a/tests/integration_tests/vectorstores/qdrant/test_delete.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/test_delete.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/test_delete.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/test_delete.py diff --git a/tests/integration_tests/vectorstores/qdrant/test_embedding_interface.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/test_embedding_interface.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/test_embedding_interface.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/test_embedding_interface.py diff --git a/tests/integration_tests/vectorstores/qdrant/test_from_texts.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/test_from_texts.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/test_from_texts.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/test_from_texts.py diff --git a/tests/integration_tests/vectorstores/qdrant/test_max_marginal_relevance.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/test_max_marginal_relevance.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/test_max_marginal_relevance.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/test_max_marginal_relevance.py diff --git a/tests/integration_tests/vectorstores/qdrant/test_similarity_search.py b/libs/langchain/tests/integration_tests/vectorstores/qdrant/test_similarity_search.py similarity index 100% rename from tests/integration_tests/vectorstores/qdrant/test_similarity_search.py rename to libs/langchain/tests/integration_tests/vectorstores/qdrant/test_similarity_search.py diff --git a/tests/integration_tests/vectorstores/test_alibabacloud_opensearch.py b/libs/langchain/tests/integration_tests/vectorstores/test_alibabacloud_opensearch.py similarity index 100% rename from tests/integration_tests/vectorstores/test_alibabacloud_opensearch.py rename to libs/langchain/tests/integration_tests/vectorstores/test_alibabacloud_opensearch.py diff --git a/tests/integration_tests/vectorstores/test_analyticdb.py b/libs/langchain/tests/integration_tests/vectorstores/test_analyticdb.py similarity index 100% rename from tests/integration_tests/vectorstores/test_analyticdb.py rename to libs/langchain/tests/integration_tests/vectorstores/test_analyticdb.py diff --git a/tests/integration_tests/vectorstores/test_annoy.py b/libs/langchain/tests/integration_tests/vectorstores/test_annoy.py similarity index 100% rename from tests/integration_tests/vectorstores/test_annoy.py rename to libs/langchain/tests/integration_tests/vectorstores/test_annoy.py diff --git a/tests/integration_tests/vectorstores/test_atlas.py b/libs/langchain/tests/integration_tests/vectorstores/test_atlas.py similarity index 100% rename from tests/integration_tests/vectorstores/test_atlas.py rename to libs/langchain/tests/integration_tests/vectorstores/test_atlas.py diff --git a/tests/integration_tests/vectorstores/test_awadb.py b/libs/langchain/tests/integration_tests/vectorstores/test_awadb.py similarity index 100% rename from tests/integration_tests/vectorstores/test_awadb.py rename to libs/langchain/tests/integration_tests/vectorstores/test_awadb.py diff --git a/tests/integration_tests/vectorstores/test_azuresearch.py b/libs/langchain/tests/integration_tests/vectorstores/test_azuresearch.py similarity index 100% rename from tests/integration_tests/vectorstores/test_azuresearch.py rename to libs/langchain/tests/integration_tests/vectorstores/test_azuresearch.py diff --git a/tests/integration_tests/vectorstores/test_cassandra.py b/libs/langchain/tests/integration_tests/vectorstores/test_cassandra.py similarity index 100% rename from tests/integration_tests/vectorstores/test_cassandra.py rename to libs/langchain/tests/integration_tests/vectorstores/test_cassandra.py diff --git a/tests/integration_tests/vectorstores/test_chroma.py b/libs/langchain/tests/integration_tests/vectorstores/test_chroma.py similarity index 100% rename from tests/integration_tests/vectorstores/test_chroma.py rename to libs/langchain/tests/integration_tests/vectorstores/test_chroma.py diff --git a/tests/integration_tests/vectorstores/test_clarifai.py b/libs/langchain/tests/integration_tests/vectorstores/test_clarifai.py similarity index 100% rename from tests/integration_tests/vectorstores/test_clarifai.py rename to libs/langchain/tests/integration_tests/vectorstores/test_clarifai.py diff --git a/tests/integration_tests/vectorstores/test_clickhouse.py b/libs/langchain/tests/integration_tests/vectorstores/test_clickhouse.py similarity index 100% rename from tests/integration_tests/vectorstores/test_clickhouse.py rename to libs/langchain/tests/integration_tests/vectorstores/test_clickhouse.py diff --git a/tests/integration_tests/vectorstores/test_deeplake.py b/libs/langchain/tests/integration_tests/vectorstores/test_deeplake.py similarity index 100% rename from tests/integration_tests/vectorstores/test_deeplake.py rename to libs/langchain/tests/integration_tests/vectorstores/test_deeplake.py diff --git a/tests/integration_tests/vectorstores/test_elasticsearch.py b/libs/langchain/tests/integration_tests/vectorstores/test_elasticsearch.py similarity index 100% rename from tests/integration_tests/vectorstores/test_elasticsearch.py rename to libs/langchain/tests/integration_tests/vectorstores/test_elasticsearch.py diff --git a/tests/integration_tests/vectorstores/test_faiss.py b/libs/langchain/tests/integration_tests/vectorstores/test_faiss.py similarity index 100% rename from tests/integration_tests/vectorstores/test_faiss.py rename to libs/langchain/tests/integration_tests/vectorstores/test_faiss.py diff --git a/tests/integration_tests/vectorstores/test_hologres.py b/libs/langchain/tests/integration_tests/vectorstores/test_hologres.py similarity index 100% rename from tests/integration_tests/vectorstores/test_hologres.py rename to libs/langchain/tests/integration_tests/vectorstores/test_hologres.py diff --git a/tests/integration_tests/vectorstores/test_lancedb.py b/libs/langchain/tests/integration_tests/vectorstores/test_lancedb.py similarity index 100% rename from tests/integration_tests/vectorstores/test_lancedb.py rename to libs/langchain/tests/integration_tests/vectorstores/test_lancedb.py diff --git a/tests/integration_tests/vectorstores/test_marqo.py b/libs/langchain/tests/integration_tests/vectorstores/test_marqo.py similarity index 100% rename from tests/integration_tests/vectorstores/test_marqo.py rename to libs/langchain/tests/integration_tests/vectorstores/test_marqo.py diff --git a/tests/integration_tests/vectorstores/test_milvus.py b/libs/langchain/tests/integration_tests/vectorstores/test_milvus.py similarity index 100% rename from tests/integration_tests/vectorstores/test_milvus.py rename to libs/langchain/tests/integration_tests/vectorstores/test_milvus.py diff --git a/tests/integration_tests/vectorstores/test_mongodb_atlas.py b/libs/langchain/tests/integration_tests/vectorstores/test_mongodb_atlas.py similarity index 100% rename from tests/integration_tests/vectorstores/test_mongodb_atlas.py rename to libs/langchain/tests/integration_tests/vectorstores/test_mongodb_atlas.py diff --git a/tests/integration_tests/vectorstores/test_myscale.py b/libs/langchain/tests/integration_tests/vectorstores/test_myscale.py similarity index 100% rename from tests/integration_tests/vectorstores/test_myscale.py rename to libs/langchain/tests/integration_tests/vectorstores/test_myscale.py diff --git a/tests/integration_tests/vectorstores/test_opensearch.py b/libs/langchain/tests/integration_tests/vectorstores/test_opensearch.py similarity index 100% rename from tests/integration_tests/vectorstores/test_opensearch.py rename to libs/langchain/tests/integration_tests/vectorstores/test_opensearch.py diff --git a/tests/integration_tests/vectorstores/test_pgvector.py b/libs/langchain/tests/integration_tests/vectorstores/test_pgvector.py similarity index 100% rename from tests/integration_tests/vectorstores/test_pgvector.py rename to libs/langchain/tests/integration_tests/vectorstores/test_pgvector.py diff --git a/tests/integration_tests/vectorstores/test_pinecone.py b/libs/langchain/tests/integration_tests/vectorstores/test_pinecone.py similarity index 100% rename from tests/integration_tests/vectorstores/test_pinecone.py rename to libs/langchain/tests/integration_tests/vectorstores/test_pinecone.py diff --git a/tests/integration_tests/vectorstores/test_redis.py b/libs/langchain/tests/integration_tests/vectorstores/test_redis.py similarity index 100% rename from tests/integration_tests/vectorstores/test_redis.py rename to libs/langchain/tests/integration_tests/vectorstores/test_redis.py diff --git a/tests/integration_tests/vectorstores/test_rocksetdb.py b/libs/langchain/tests/integration_tests/vectorstores/test_rocksetdb.py similarity index 100% rename from tests/integration_tests/vectorstores/test_rocksetdb.py rename to libs/langchain/tests/integration_tests/vectorstores/test_rocksetdb.py diff --git a/tests/integration_tests/vectorstores/test_singlestoredb.py b/libs/langchain/tests/integration_tests/vectorstores/test_singlestoredb.py similarity index 100% rename from tests/integration_tests/vectorstores/test_singlestoredb.py rename to libs/langchain/tests/integration_tests/vectorstores/test_singlestoredb.py diff --git a/tests/integration_tests/vectorstores/test_tair.py b/libs/langchain/tests/integration_tests/vectorstores/test_tair.py similarity index 100% rename from tests/integration_tests/vectorstores/test_tair.py rename to libs/langchain/tests/integration_tests/vectorstores/test_tair.py diff --git a/tests/integration_tests/vectorstores/test_vectara.py b/libs/langchain/tests/integration_tests/vectorstores/test_vectara.py similarity index 100% rename from tests/integration_tests/vectorstores/test_vectara.py rename to libs/langchain/tests/integration_tests/vectorstores/test_vectara.py diff --git a/tests/integration_tests/vectorstores/test_weaviate.py b/libs/langchain/tests/integration_tests/vectorstores/test_weaviate.py similarity index 100% rename from tests/integration_tests/vectorstores/test_weaviate.py rename to libs/langchain/tests/integration_tests/vectorstores/test_weaviate.py diff --git a/tests/integration_tests/vectorstores/test_zilliz.py b/libs/langchain/tests/integration_tests/vectorstores/test_zilliz.py similarity index 100% rename from tests/integration_tests/vectorstores/test_zilliz.py rename to libs/langchain/tests/integration_tests/vectorstores/test_zilliz.py diff --git a/tests/mock_servers/__init__.py b/libs/langchain/tests/mock_servers/__init__.py similarity index 100% rename from tests/mock_servers/__init__.py rename to libs/langchain/tests/mock_servers/__init__.py diff --git a/tests/mock_servers/robot/__init__.py b/libs/langchain/tests/mock_servers/robot/__init__.py similarity index 100% rename from tests/mock_servers/robot/__init__.py rename to libs/langchain/tests/mock_servers/robot/__init__.py diff --git a/tests/mock_servers/robot/server.py b/libs/langchain/tests/mock_servers/robot/server.py similarity index 100% rename from tests/mock_servers/robot/server.py rename to libs/langchain/tests/mock_servers/robot/server.py diff --git a/tests/unit_tests/__init__.py b/libs/langchain/tests/unit_tests/__init__.py similarity index 100% rename from tests/unit_tests/__init__.py rename to libs/langchain/tests/unit_tests/__init__.py diff --git a/tests/unit_tests/agents/__init__.py b/libs/langchain/tests/unit_tests/agents/__init__.py similarity index 100% rename from tests/unit_tests/agents/__init__.py rename to libs/langchain/tests/unit_tests/agents/__init__.py diff --git a/tests/unit_tests/agents/test_agent.py b/libs/langchain/tests/unit_tests/agents/test_agent.py similarity index 100% rename from tests/unit_tests/agents/test_agent.py rename to libs/langchain/tests/unit_tests/agents/test_agent.py diff --git a/tests/unit_tests/agents/test_chat.py b/libs/langchain/tests/unit_tests/agents/test_chat.py similarity index 100% rename from tests/unit_tests/agents/test_chat.py rename to libs/langchain/tests/unit_tests/agents/test_chat.py diff --git a/tests/unit_tests/agents/test_initialize.py b/libs/langchain/tests/unit_tests/agents/test_initialize.py similarity index 100% rename from tests/unit_tests/agents/test_initialize.py rename to libs/langchain/tests/unit_tests/agents/test_initialize.py diff --git a/tests/unit_tests/agents/test_mrkl.py b/libs/langchain/tests/unit_tests/agents/test_mrkl.py similarity index 100% rename from tests/unit_tests/agents/test_mrkl.py rename to libs/langchain/tests/unit_tests/agents/test_mrkl.py diff --git a/tests/unit_tests/agents/test_public_api.py b/libs/langchain/tests/unit_tests/agents/test_public_api.py similarity index 100% rename from tests/unit_tests/agents/test_public_api.py rename to libs/langchain/tests/unit_tests/agents/test_public_api.py diff --git a/tests/unit_tests/agents/test_react.py b/libs/langchain/tests/unit_tests/agents/test_react.py similarity index 100% rename from tests/unit_tests/agents/test_react.py rename to libs/langchain/tests/unit_tests/agents/test_react.py diff --git a/tests/unit_tests/agents/test_serialization.py b/libs/langchain/tests/unit_tests/agents/test_serialization.py similarity index 100% rename from tests/unit_tests/agents/test_serialization.py rename to libs/langchain/tests/unit_tests/agents/test_serialization.py diff --git a/tests/unit_tests/agents/test_sql.py b/libs/langchain/tests/unit_tests/agents/test_sql.py similarity index 100% rename from tests/unit_tests/agents/test_sql.py rename to libs/langchain/tests/unit_tests/agents/test_sql.py diff --git a/tests/unit_tests/agents/test_tools.py b/libs/langchain/tests/unit_tests/agents/test_tools.py similarity index 100% rename from tests/unit_tests/agents/test_tools.py rename to libs/langchain/tests/unit_tests/agents/test_tools.py diff --git a/tests/unit_tests/agents/test_types.py b/libs/langchain/tests/unit_tests/agents/test_types.py similarity index 100% rename from tests/unit_tests/agents/test_types.py rename to libs/langchain/tests/unit_tests/agents/test_types.py diff --git a/tests/unit_tests/callbacks/__init__.py b/libs/langchain/tests/unit_tests/callbacks/__init__.py similarity index 100% rename from tests/unit_tests/callbacks/__init__.py rename to libs/langchain/tests/unit_tests/callbacks/__init__.py diff --git a/tests/unit_tests/callbacks/fake_callback_handler.py b/libs/langchain/tests/unit_tests/callbacks/fake_callback_handler.py similarity index 100% rename from tests/unit_tests/callbacks/fake_callback_handler.py rename to libs/langchain/tests/unit_tests/callbacks/fake_callback_handler.py diff --git a/tests/unit_tests/callbacks/test_callback_manager.py b/libs/langchain/tests/unit_tests/callbacks/test_callback_manager.py similarity index 100% rename from tests/unit_tests/callbacks/test_callback_manager.py rename to libs/langchain/tests/unit_tests/callbacks/test_callback_manager.py diff --git a/tests/unit_tests/callbacks/test_openai_info.py b/libs/langchain/tests/unit_tests/callbacks/test_openai_info.py similarity index 100% rename from tests/unit_tests/callbacks/test_openai_info.py rename to libs/langchain/tests/unit_tests/callbacks/test_openai_info.py diff --git a/tests/unit_tests/callbacks/test_schemas.py b/libs/langchain/tests/unit_tests/callbacks/test_schemas.py similarity index 100% rename from tests/unit_tests/callbacks/test_schemas.py rename to libs/langchain/tests/unit_tests/callbacks/test_schemas.py diff --git a/tests/unit_tests/callbacks/test_streamlit_callback.py b/libs/langchain/tests/unit_tests/callbacks/test_streamlit_callback.py similarity index 100% rename from tests/unit_tests/callbacks/test_streamlit_callback.py rename to libs/langchain/tests/unit_tests/callbacks/test_streamlit_callback.py diff --git a/tests/unit_tests/callbacks/tracers/__init__.py b/libs/langchain/tests/unit_tests/callbacks/tracers/__init__.py similarity index 100% rename from tests/unit_tests/callbacks/tracers/__init__.py rename to libs/langchain/tests/unit_tests/callbacks/tracers/__init__.py diff --git a/tests/unit_tests/callbacks/tracers/test_base_tracer.py b/libs/langchain/tests/unit_tests/callbacks/tracers/test_base_tracer.py similarity index 100% rename from tests/unit_tests/callbacks/tracers/test_base_tracer.py rename to libs/langchain/tests/unit_tests/callbacks/tracers/test_base_tracer.py diff --git a/tests/unit_tests/callbacks/tracers/test_langchain.py b/libs/langchain/tests/unit_tests/callbacks/tracers/test_langchain.py similarity index 100% rename from tests/unit_tests/callbacks/tracers/test_langchain.py rename to libs/langchain/tests/unit_tests/callbacks/tracers/test_langchain.py diff --git a/tests/unit_tests/callbacks/tracers/test_langchain_v1.py b/libs/langchain/tests/unit_tests/callbacks/tracers/test_langchain_v1.py similarity index 100% rename from tests/unit_tests/callbacks/tracers/test_langchain_v1.py rename to libs/langchain/tests/unit_tests/callbacks/tracers/test_langchain_v1.py diff --git a/tests/unit_tests/chains/__init__.py b/libs/langchain/tests/unit_tests/chains/__init__.py similarity index 100% rename from tests/unit_tests/chains/__init__.py rename to libs/langchain/tests/unit_tests/chains/__init__.py diff --git a/tests/unit_tests/chains/query_constructor/__init__.py b/libs/langchain/tests/unit_tests/chains/query_constructor/__init__.py similarity index 100% rename from tests/unit_tests/chains/query_constructor/__init__.py rename to libs/langchain/tests/unit_tests/chains/query_constructor/__init__.py diff --git a/tests/unit_tests/chains/query_constructor/test_parser.py b/libs/langchain/tests/unit_tests/chains/query_constructor/test_parser.py similarity index 100% rename from tests/unit_tests/chains/query_constructor/test_parser.py rename to libs/langchain/tests/unit_tests/chains/query_constructor/test_parser.py diff --git a/tests/unit_tests/chains/question_answering/__init__.py b/libs/langchain/tests/unit_tests/chains/question_answering/__init__.py similarity index 100% rename from tests/unit_tests/chains/question_answering/__init__.py rename to libs/langchain/tests/unit_tests/chains/question_answering/__init__.py diff --git a/tests/unit_tests/chains/question_answering/test_map_rerank_prompt.py b/libs/langchain/tests/unit_tests/chains/question_answering/test_map_rerank_prompt.py similarity index 100% rename from tests/unit_tests/chains/question_answering/test_map_rerank_prompt.py rename to libs/langchain/tests/unit_tests/chains/question_answering/test_map_rerank_prompt.py diff --git a/tests/unit_tests/chains/test_api.py b/libs/langchain/tests/unit_tests/chains/test_api.py similarity index 100% rename from tests/unit_tests/chains/test_api.py rename to libs/langchain/tests/unit_tests/chains/test_api.py diff --git a/tests/unit_tests/chains/test_base.py b/libs/langchain/tests/unit_tests/chains/test_base.py similarity index 100% rename from tests/unit_tests/chains/test_base.py rename to libs/langchain/tests/unit_tests/chains/test_base.py diff --git a/tests/unit_tests/chains/test_combine_documents.py b/libs/langchain/tests/unit_tests/chains/test_combine_documents.py similarity index 100% rename from tests/unit_tests/chains/test_combine_documents.py rename to libs/langchain/tests/unit_tests/chains/test_combine_documents.py diff --git a/tests/unit_tests/chains/test_constitutional_ai.py b/libs/langchain/tests/unit_tests/chains/test_constitutional_ai.py similarity index 100% rename from tests/unit_tests/chains/test_constitutional_ai.py rename to libs/langchain/tests/unit_tests/chains/test_constitutional_ai.py diff --git a/tests/unit_tests/chains/test_conversation.py b/libs/langchain/tests/unit_tests/chains/test_conversation.py similarity index 100% rename from tests/unit_tests/chains/test_conversation.py rename to libs/langchain/tests/unit_tests/chains/test_conversation.py diff --git a/tests/unit_tests/chains/test_graph_qa.py b/libs/langchain/tests/unit_tests/chains/test_graph_qa.py similarity index 100% rename from tests/unit_tests/chains/test_graph_qa.py rename to libs/langchain/tests/unit_tests/chains/test_graph_qa.py diff --git a/tests/unit_tests/chains/test_hyde.py b/libs/langchain/tests/unit_tests/chains/test_hyde.py similarity index 100% rename from tests/unit_tests/chains/test_hyde.py rename to libs/langchain/tests/unit_tests/chains/test_hyde.py diff --git a/tests/unit_tests/chains/test_llm.py b/libs/langchain/tests/unit_tests/chains/test_llm.py similarity index 100% rename from tests/unit_tests/chains/test_llm.py rename to libs/langchain/tests/unit_tests/chains/test_llm.py diff --git a/tests/unit_tests/chains/test_llm_bash.py b/libs/langchain/tests/unit_tests/chains/test_llm_bash.py similarity index 100% rename from tests/unit_tests/chains/test_llm_bash.py rename to libs/langchain/tests/unit_tests/chains/test_llm_bash.py diff --git a/tests/unit_tests/chains/test_llm_checker.py b/libs/langchain/tests/unit_tests/chains/test_llm_checker.py similarity index 100% rename from tests/unit_tests/chains/test_llm_checker.py rename to libs/langchain/tests/unit_tests/chains/test_llm_checker.py diff --git a/tests/unit_tests/chains/test_llm_math.py b/libs/langchain/tests/unit_tests/chains/test_llm_math.py similarity index 100% rename from tests/unit_tests/chains/test_llm_math.py rename to libs/langchain/tests/unit_tests/chains/test_llm_math.py diff --git a/tests/unit_tests/chains/test_llm_summarization_checker.py b/libs/langchain/tests/unit_tests/chains/test_llm_summarization_checker.py similarity index 100% rename from tests/unit_tests/chains/test_llm_summarization_checker.py rename to libs/langchain/tests/unit_tests/chains/test_llm_summarization_checker.py diff --git a/tests/unit_tests/chains/test_llm_symbolic_math.py b/libs/langchain/tests/unit_tests/chains/test_llm_symbolic_math.py similarity index 100% rename from tests/unit_tests/chains/test_llm_symbolic_math.py rename to libs/langchain/tests/unit_tests/chains/test_llm_symbolic_math.py diff --git a/tests/unit_tests/chains/test_memory.py b/libs/langchain/tests/unit_tests/chains/test_memory.py similarity index 100% rename from tests/unit_tests/chains/test_memory.py rename to libs/langchain/tests/unit_tests/chains/test_memory.py diff --git a/tests/unit_tests/chains/test_natbot.py b/libs/langchain/tests/unit_tests/chains/test_natbot.py similarity index 100% rename from tests/unit_tests/chains/test_natbot.py rename to libs/langchain/tests/unit_tests/chains/test_natbot.py diff --git a/tests/unit_tests/chains/test_sequential.py b/libs/langchain/tests/unit_tests/chains/test_sequential.py similarity index 100% rename from tests/unit_tests/chains/test_sequential.py rename to libs/langchain/tests/unit_tests/chains/test_sequential.py diff --git a/tests/unit_tests/chains/test_transform.py b/libs/langchain/tests/unit_tests/chains/test_transform.py similarity index 100% rename from tests/unit_tests/chains/test_transform.py rename to libs/langchain/tests/unit_tests/chains/test_transform.py diff --git a/tests/unit_tests/chat_models/__init__.py b/libs/langchain/tests/unit_tests/chat_models/__init__.py similarity index 100% rename from tests/unit_tests/chat_models/__init__.py rename to libs/langchain/tests/unit_tests/chat_models/__init__.py diff --git a/tests/unit_tests/chat_models/test_google_palm.py b/libs/langchain/tests/unit_tests/chat_models/test_google_palm.py similarity index 100% rename from tests/unit_tests/chat_models/test_google_palm.py rename to libs/langchain/tests/unit_tests/chat_models/test_google_palm.py diff --git a/tests/unit_tests/chat_models/test_openai.py b/libs/langchain/tests/unit_tests/chat_models/test_openai.py similarity index 100% rename from tests/unit_tests/chat_models/test_openai.py rename to libs/langchain/tests/unit_tests/chat_models/test_openai.py diff --git a/tests/unit_tests/conftest.py b/libs/langchain/tests/unit_tests/conftest.py similarity index 100% rename from tests/unit_tests/conftest.py rename to libs/langchain/tests/unit_tests/conftest.py diff --git a/tests/unit_tests/data/prompt_file.txt b/libs/langchain/tests/unit_tests/data/prompt_file.txt similarity index 100% rename from tests/unit_tests/data/prompt_file.txt rename to libs/langchain/tests/unit_tests/data/prompt_file.txt diff --git a/tests/unit_tests/data/prompts/prompt_extra_args.json b/libs/langchain/tests/unit_tests/data/prompts/prompt_extra_args.json similarity index 100% rename from tests/unit_tests/data/prompts/prompt_extra_args.json rename to libs/langchain/tests/unit_tests/data/prompts/prompt_extra_args.json diff --git a/tests/unit_tests/data/prompts/prompt_missing_args.json b/libs/langchain/tests/unit_tests/data/prompts/prompt_missing_args.json similarity index 100% rename from tests/unit_tests/data/prompts/prompt_missing_args.json rename to libs/langchain/tests/unit_tests/data/prompts/prompt_missing_args.json diff --git a/tests/unit_tests/data/prompts/simple_prompt.json b/libs/langchain/tests/unit_tests/data/prompts/simple_prompt.json similarity index 100% rename from tests/unit_tests/data/prompts/simple_prompt.json rename to libs/langchain/tests/unit_tests/data/prompts/simple_prompt.json diff --git a/tests/unit_tests/docstore/__init__.py b/libs/langchain/tests/unit_tests/docstore/__init__.py similarity index 100% rename from tests/unit_tests/docstore/__init__.py rename to libs/langchain/tests/unit_tests/docstore/__init__.py diff --git a/tests/unit_tests/docstore/test_arbitrary_fn.py b/libs/langchain/tests/unit_tests/docstore/test_arbitrary_fn.py similarity index 100% rename from tests/unit_tests/docstore/test_arbitrary_fn.py rename to libs/langchain/tests/unit_tests/docstore/test_arbitrary_fn.py diff --git a/tests/unit_tests/docstore/test_inmemory.py b/libs/langchain/tests/unit_tests/docstore/test_inmemory.py similarity index 100% rename from tests/unit_tests/docstore/test_inmemory.py rename to libs/langchain/tests/unit_tests/docstore/test_inmemory.py diff --git a/tests/unit_tests/document_loaders/__init__.py b/libs/langchain/tests/unit_tests/document_loaders/__init__.py similarity index 100% rename from tests/unit_tests/document_loaders/__init__.py rename to libs/langchain/tests/unit_tests/document_loaders/__init__.py diff --git a/tests/unit_tests/document_loaders/blob_loaders/__init__.py b/libs/langchain/tests/unit_tests/document_loaders/blob_loaders/__init__.py similarity index 100% rename from tests/unit_tests/document_loaders/blob_loaders/__init__.py rename to libs/langchain/tests/unit_tests/document_loaders/blob_loaders/__init__.py diff --git a/tests/unit_tests/document_loaders/blob_loaders/test_filesystem_blob_loader.py b/libs/langchain/tests/unit_tests/document_loaders/blob_loaders/test_filesystem_blob_loader.py similarity index 100% rename from tests/unit_tests/document_loaders/blob_loaders/test_filesystem_blob_loader.py rename to libs/langchain/tests/unit_tests/document_loaders/blob_loaders/test_filesystem_blob_loader.py diff --git a/tests/unit_tests/document_loaders/blob_loaders/test_public_api.py b/libs/langchain/tests/unit_tests/document_loaders/blob_loaders/test_public_api.py similarity index 100% rename from tests/unit_tests/document_loaders/blob_loaders/test_public_api.py rename to libs/langchain/tests/unit_tests/document_loaders/blob_loaders/test_public_api.py diff --git a/tests/unit_tests/document_loaders/blob_loaders/test_schema.py b/libs/langchain/tests/unit_tests/document_loaders/blob_loaders/test_schema.py similarity index 100% rename from tests/unit_tests/document_loaders/blob_loaders/test_schema.py rename to libs/langchain/tests/unit_tests/document_loaders/blob_loaders/test_schema.py diff --git a/tests/unit_tests/document_loaders/loaders/__init__.py b/libs/langchain/tests/unit_tests/document_loaders/loaders/__init__.py similarity index 100% rename from tests/unit_tests/document_loaders/loaders/__init__.py rename to libs/langchain/tests/unit_tests/document_loaders/loaders/__init__.py diff --git a/tests/unit_tests/document_loaders/loaders/vendors/__init__.py b/libs/langchain/tests/unit_tests/document_loaders/loaders/vendors/__init__.py similarity index 100% rename from tests/unit_tests/document_loaders/loaders/vendors/__init__.py rename to libs/langchain/tests/unit_tests/document_loaders/loaders/vendors/__init__.py diff --git a/tests/unit_tests/document_loaders/loaders/vendors/test_data/docugami-example.xml b/libs/langchain/tests/unit_tests/document_loaders/loaders/vendors/test_data/docugami-example.xml similarity index 100% rename from tests/unit_tests/document_loaders/loaders/vendors/test_data/docugami-example.xml rename to libs/langchain/tests/unit_tests/document_loaders/loaders/vendors/test_data/docugami-example.xml diff --git a/tests/unit_tests/document_loaders/loaders/vendors/test_docugami.py b/libs/langchain/tests/unit_tests/document_loaders/loaders/vendors/test_docugami.py similarity index 100% rename from tests/unit_tests/document_loaders/loaders/vendors/test_docugami.py rename to libs/langchain/tests/unit_tests/document_loaders/loaders/vendors/test_docugami.py diff --git a/tests/unit_tests/document_loaders/parsers/__init__.py b/libs/langchain/tests/unit_tests/document_loaders/parsers/__init__.py similarity index 100% rename from tests/unit_tests/document_loaders/parsers/__init__.py rename to libs/langchain/tests/unit_tests/document_loaders/parsers/__init__.py diff --git a/tests/unit_tests/document_loaders/parsers/language/__init__.py b/libs/langchain/tests/unit_tests/document_loaders/parsers/language/__init__.py similarity index 100% rename from tests/unit_tests/document_loaders/parsers/language/__init__.py rename to libs/langchain/tests/unit_tests/document_loaders/parsers/language/__init__.py diff --git a/tests/unit_tests/document_loaders/parsers/language/test_javascript.py b/libs/langchain/tests/unit_tests/document_loaders/parsers/language/test_javascript.py similarity index 100% rename from tests/unit_tests/document_loaders/parsers/language/test_javascript.py rename to libs/langchain/tests/unit_tests/document_loaders/parsers/language/test_javascript.py diff --git a/tests/unit_tests/document_loaders/parsers/language/test_python.py b/libs/langchain/tests/unit_tests/document_loaders/parsers/language/test_python.py similarity index 100% rename from tests/unit_tests/document_loaders/parsers/language/test_python.py rename to libs/langchain/tests/unit_tests/document_loaders/parsers/language/test_python.py diff --git a/tests/unit_tests/document_loaders/parsers/test_generic.py b/libs/langchain/tests/unit_tests/document_loaders/parsers/test_generic.py similarity index 100% rename from tests/unit_tests/document_loaders/parsers/test_generic.py rename to libs/langchain/tests/unit_tests/document_loaders/parsers/test_generic.py diff --git a/tests/unit_tests/document_loaders/parsers/test_html_parsers.py b/libs/langchain/tests/unit_tests/document_loaders/parsers/test_html_parsers.py similarity index 100% rename from tests/unit_tests/document_loaders/parsers/test_html_parsers.py rename to libs/langchain/tests/unit_tests/document_loaders/parsers/test_html_parsers.py diff --git a/tests/unit_tests/document_loaders/parsers/test_pdf_parsers.py b/libs/langchain/tests/unit_tests/document_loaders/parsers/test_pdf_parsers.py similarity index 100% rename from tests/unit_tests/document_loaders/parsers/test_pdf_parsers.py rename to libs/langchain/tests/unit_tests/document_loaders/parsers/test_pdf_parsers.py diff --git a/tests/unit_tests/document_loaders/parsers/test_public_api.py b/libs/langchain/tests/unit_tests/document_loaders/parsers/test_public_api.py similarity index 100% rename from tests/unit_tests/document_loaders/parsers/test_public_api.py rename to libs/langchain/tests/unit_tests/document_loaders/parsers/test_public_api.py diff --git a/tests/unit_tests/document_loaders/sample_documents/__init__.py b/libs/langchain/tests/unit_tests/document_loaders/sample_documents/__init__.py similarity index 100% rename from tests/unit_tests/document_loaders/sample_documents/__init__.py rename to libs/langchain/tests/unit_tests/document_loaders/sample_documents/__init__.py diff --git a/tests/unit_tests/document_loaders/sample_documents/bibtex.bib b/libs/langchain/tests/unit_tests/document_loaders/sample_documents/bibtex.bib similarity index 100% rename from tests/unit_tests/document_loaders/sample_documents/bibtex.bib rename to libs/langchain/tests/unit_tests/document_loaders/sample_documents/bibtex.bib diff --git a/tests/unit_tests/document_loaders/sample_documents/empty_export.enex b/libs/langchain/tests/unit_tests/document_loaders/sample_documents/empty_export.enex similarity index 100% rename from tests/unit_tests/document_loaders/sample_documents/empty_export.enex rename to libs/langchain/tests/unit_tests/document_loaders/sample_documents/empty_export.enex diff --git a/tests/unit_tests/document_loaders/sample_documents/layout-parser-paper.pdf b/libs/langchain/tests/unit_tests/document_loaders/sample_documents/layout-parser-paper.pdf similarity index 100% rename from tests/unit_tests/document_loaders/sample_documents/layout-parser-paper.pdf rename to libs/langchain/tests/unit_tests/document_loaders/sample_documents/layout-parser-paper.pdf diff --git a/tests/unit_tests/document_loaders/sample_documents/mwtest_current_pages.xml b/libs/langchain/tests/unit_tests/document_loaders/sample_documents/mwtest_current_pages.xml similarity index 100% rename from tests/unit_tests/document_loaders/sample_documents/mwtest_current_pages.xml rename to libs/langchain/tests/unit_tests/document_loaders/sample_documents/mwtest_current_pages.xml diff --git a/tests/unit_tests/document_loaders/sample_documents/sample_notebook.enex b/libs/langchain/tests/unit_tests/document_loaders/sample_documents/sample_notebook.enex similarity index 100% rename from tests/unit_tests/document_loaders/sample_documents/sample_notebook.enex rename to libs/langchain/tests/unit_tests/document_loaders/sample_documents/sample_notebook.enex diff --git a/tests/unit_tests/document_loaders/sample_documents/sample_notebook_2.enex b/libs/langchain/tests/unit_tests/document_loaders/sample_documents/sample_notebook_2.enex similarity index 100% rename from tests/unit_tests/document_loaders/sample_documents/sample_notebook_2.enex rename to libs/langchain/tests/unit_tests/document_loaders/sample_documents/sample_notebook_2.enex diff --git a/tests/unit_tests/document_loaders/sample_documents/sample_notebook_emptynote.enex b/libs/langchain/tests/unit_tests/document_loaders/sample_documents/sample_notebook_emptynote.enex similarity index 100% rename from tests/unit_tests/document_loaders/sample_documents/sample_notebook_emptynote.enex rename to libs/langchain/tests/unit_tests/document_loaders/sample_documents/sample_notebook_emptynote.enex diff --git a/tests/unit_tests/document_loaders/sample_documents/sample_notebook_missingcontenttag.enex b/libs/langchain/tests/unit_tests/document_loaders/sample_documents/sample_notebook_missingcontenttag.enex similarity index 100% rename from tests/unit_tests/document_loaders/sample_documents/sample_notebook_missingcontenttag.enex rename to libs/langchain/tests/unit_tests/document_loaders/sample_documents/sample_notebook_missingcontenttag.enex diff --git a/tests/unit_tests/document_loaders/sample_documents/sample_notebook_missingmetadata.enex b/libs/langchain/tests/unit_tests/document_loaders/sample_documents/sample_notebook_missingmetadata.enex similarity index 100% rename from tests/unit_tests/document_loaders/sample_documents/sample_notebook_missingmetadata.enex rename to libs/langchain/tests/unit_tests/document_loaders/sample_documents/sample_notebook_missingmetadata.enex diff --git a/tests/unit_tests/document_loaders/sample_documents/sample_notebook_with_media.enex b/libs/langchain/tests/unit_tests/document_loaders/sample_documents/sample_notebook_with_media.enex similarity index 100% rename from tests/unit_tests/document_loaders/sample_documents/sample_notebook_with_media.enex rename to libs/langchain/tests/unit_tests/document_loaders/sample_documents/sample_notebook_with_media.enex diff --git a/tests/unit_tests/document_loaders/test_base.py b/libs/langchain/tests/unit_tests/document_loaders/test_base.py similarity index 100% rename from tests/unit_tests/document_loaders/test_base.py rename to libs/langchain/tests/unit_tests/document_loaders/test_base.py diff --git a/tests/unit_tests/document_loaders/test_bibtex.py b/libs/langchain/tests/unit_tests/document_loaders/test_bibtex.py similarity index 100% rename from tests/unit_tests/document_loaders/test_bibtex.py rename to libs/langchain/tests/unit_tests/document_loaders/test_bibtex.py diff --git a/tests/unit_tests/document_loaders/test_bshtml.py b/libs/langchain/tests/unit_tests/document_loaders/test_bshtml.py similarity index 100% rename from tests/unit_tests/document_loaders/test_bshtml.py rename to libs/langchain/tests/unit_tests/document_loaders/test_bshtml.py diff --git a/tests/unit_tests/document_loaders/test_confluence.py b/libs/langchain/tests/unit_tests/document_loaders/test_confluence.py similarity index 100% rename from tests/unit_tests/document_loaders/test_confluence.py rename to libs/langchain/tests/unit_tests/document_loaders/test_confluence.py diff --git a/tests/unit_tests/document_loaders/test_csv_loader.py b/libs/langchain/tests/unit_tests/document_loaders/test_csv_loader.py similarity index 100% rename from tests/unit_tests/document_loaders/test_csv_loader.py rename to libs/langchain/tests/unit_tests/document_loaders/test_csv_loader.py diff --git a/tests/unit_tests/document_loaders/test_cube_semantic.py b/libs/langchain/tests/unit_tests/document_loaders/test_cube_semantic.py similarity index 100% rename from tests/unit_tests/document_loaders/test_cube_semantic.py rename to libs/langchain/tests/unit_tests/document_loaders/test_cube_semantic.py diff --git a/tests/unit_tests/document_loaders/test_detect_encoding.py b/libs/langchain/tests/unit_tests/document_loaders/test_detect_encoding.py similarity index 100% rename from tests/unit_tests/document_loaders/test_detect_encoding.py rename to libs/langchain/tests/unit_tests/document_loaders/test_detect_encoding.py diff --git a/tests/unit_tests/document_loaders/test_directory.py b/libs/langchain/tests/unit_tests/document_loaders/test_directory.py similarity index 100% rename from tests/unit_tests/document_loaders/test_directory.py rename to libs/langchain/tests/unit_tests/document_loaders/test_directory.py diff --git a/tests/unit_tests/document_loaders/test_docs/csv/test_empty.csv b/libs/langchain/tests/unit_tests/document_loaders/test_docs/csv/test_empty.csv similarity index 100% rename from tests/unit_tests/document_loaders/test_docs/csv/test_empty.csv rename to libs/langchain/tests/unit_tests/document_loaders/test_docs/csv/test_empty.csv diff --git a/tests/unit_tests/document_loaders/test_docs/csv/test_nominal.csv b/libs/langchain/tests/unit_tests/document_loaders/test_docs/csv/test_nominal.csv similarity index 100% rename from tests/unit_tests/document_loaders/test_docs/csv/test_nominal.csv rename to libs/langchain/tests/unit_tests/document_loaders/test_docs/csv/test_nominal.csv diff --git a/tests/unit_tests/document_loaders/test_docs/csv/test_one_col.csv b/libs/langchain/tests/unit_tests/document_loaders/test_docs/csv/test_one_col.csv similarity index 100% rename from tests/unit_tests/document_loaders/test_docs/csv/test_one_col.csv rename to libs/langchain/tests/unit_tests/document_loaders/test_docs/csv/test_one_col.csv diff --git a/tests/unit_tests/document_loaders/test_docs/csv/test_one_row.csv b/libs/langchain/tests/unit_tests/document_loaders/test_docs/csv/test_one_row.csv similarity index 100% rename from tests/unit_tests/document_loaders/test_docs/csv/test_one_row.csv rename to libs/langchain/tests/unit_tests/document_loaders/test_docs/csv/test_one_row.csv diff --git a/tests/unit_tests/document_loaders/test_docs/readthedocs/custom/test.html b/libs/langchain/tests/unit_tests/document_loaders/test_docs/readthedocs/custom/test.html similarity index 100% rename from tests/unit_tests/document_loaders/test_docs/readthedocs/custom/test.html rename to libs/langchain/tests/unit_tests/document_loaders/test_docs/readthedocs/custom/test.html diff --git a/tests/unit_tests/document_loaders/test_docs/readthedocs/div_role_main/test.html b/libs/langchain/tests/unit_tests/document_loaders/test_docs/readthedocs/div_role_main/test.html similarity index 100% rename from tests/unit_tests/document_loaders/test_docs/readthedocs/div_role_main/test.html rename to libs/langchain/tests/unit_tests/document_loaders/test_docs/readthedocs/div_role_main/test.html diff --git a/tests/unit_tests/document_loaders/test_docs/readthedocs/main_id_main_content/test.html b/libs/langchain/tests/unit_tests/document_loaders/test_docs/readthedocs/main_id_main_content/test.html similarity index 100% rename from tests/unit_tests/document_loaders/test_docs/readthedocs/main_id_main_content/test.html rename to libs/langchain/tests/unit_tests/document_loaders/test_docs/readthedocs/main_id_main_content/test.html diff --git a/tests/unit_tests/document_loaders/test_docs/telegram.json b/libs/langchain/tests/unit_tests/document_loaders/test_docs/telegram.json similarity index 100% rename from tests/unit_tests/document_loaders/test_docs/telegram.json rename to libs/langchain/tests/unit_tests/document_loaders/test_docs/telegram.json diff --git a/tests/unit_tests/document_loaders/test_docs/telegram_channel.json b/libs/langchain/tests/unit_tests/document_loaders/test_docs/telegram_channel.json similarity index 100% rename from tests/unit_tests/document_loaders/test_docs/telegram_channel.json rename to libs/langchain/tests/unit_tests/document_loaders/test_docs/telegram_channel.json diff --git a/tests/unit_tests/document_loaders/test_evernote_loader.py b/libs/langchain/tests/unit_tests/document_loaders/test_evernote_loader.py similarity index 100% rename from tests/unit_tests/document_loaders/test_evernote_loader.py rename to libs/langchain/tests/unit_tests/document_loaders/test_evernote_loader.py diff --git a/tests/unit_tests/document_loaders/test_generic_loader.py b/libs/langchain/tests/unit_tests/document_loaders/test_generic_loader.py similarity index 100% rename from tests/unit_tests/document_loaders/test_generic_loader.py rename to libs/langchain/tests/unit_tests/document_loaders/test_generic_loader.py diff --git a/tests/unit_tests/document_loaders/test_github.py b/libs/langchain/tests/unit_tests/document_loaders/test_github.py similarity index 100% rename from tests/unit_tests/document_loaders/test_github.py rename to libs/langchain/tests/unit_tests/document_loaders/test_github.py diff --git a/tests/unit_tests/document_loaders/test_json_loader.py b/libs/langchain/tests/unit_tests/document_loaders/test_json_loader.py similarity index 100% rename from tests/unit_tests/document_loaders/test_json_loader.py rename to libs/langchain/tests/unit_tests/document_loaders/test_json_loader.py diff --git a/tests/unit_tests/document_loaders/test_mediawikidump.py b/libs/langchain/tests/unit_tests/document_loaders/test_mediawikidump.py similarity index 100% rename from tests/unit_tests/document_loaders/test_mediawikidump.py rename to libs/langchain/tests/unit_tests/document_loaders/test_mediawikidump.py diff --git a/tests/unit_tests/document_loaders/test_mhtml.py b/libs/langchain/tests/unit_tests/document_loaders/test_mhtml.py similarity index 100% rename from tests/unit_tests/document_loaders/test_mhtml.py rename to libs/langchain/tests/unit_tests/document_loaders/test_mhtml.py diff --git a/tests/unit_tests/document_loaders/test_psychic.py b/libs/langchain/tests/unit_tests/document_loaders/test_psychic.py similarity index 100% rename from tests/unit_tests/document_loaders/test_psychic.py rename to libs/langchain/tests/unit_tests/document_loaders/test_psychic.py diff --git a/tests/unit_tests/document_loaders/test_readthedoc.py b/libs/langchain/tests/unit_tests/document_loaders/test_readthedoc.py similarity index 100% rename from tests/unit_tests/document_loaders/test_readthedoc.py rename to libs/langchain/tests/unit_tests/document_loaders/test_readthedoc.py diff --git a/tests/unit_tests/document_loaders/test_telegram.py b/libs/langchain/tests/unit_tests/document_loaders/test_telegram.py similarity index 100% rename from tests/unit_tests/document_loaders/test_telegram.py rename to libs/langchain/tests/unit_tests/document_loaders/test_telegram.py diff --git a/tests/unit_tests/document_loaders/test_trello.py b/libs/langchain/tests/unit_tests/document_loaders/test_trello.py similarity index 100% rename from tests/unit_tests/document_loaders/test_trello.py rename to libs/langchain/tests/unit_tests/document_loaders/test_trello.py diff --git a/tests/unit_tests/document_loaders/test_web_base.py b/libs/langchain/tests/unit_tests/document_loaders/test_web_base.py similarity index 100% rename from tests/unit_tests/document_loaders/test_web_base.py rename to libs/langchain/tests/unit_tests/document_loaders/test_web_base.py diff --git a/tests/unit_tests/document_loaders/test_youtube.py b/libs/langchain/tests/unit_tests/document_loaders/test_youtube.py similarity index 100% rename from tests/unit_tests/document_loaders/test_youtube.py rename to libs/langchain/tests/unit_tests/document_loaders/test_youtube.py diff --git a/tests/unit_tests/evaluation/__init__.py b/libs/langchain/tests/unit_tests/evaluation/__init__.py similarity index 100% rename from tests/unit_tests/evaluation/__init__.py rename to libs/langchain/tests/unit_tests/evaluation/__init__.py diff --git a/tests/unit_tests/evaluation/agents/__init__.py b/libs/langchain/tests/unit_tests/evaluation/agents/__init__.py similarity index 100% rename from tests/unit_tests/evaluation/agents/__init__.py rename to libs/langchain/tests/unit_tests/evaluation/agents/__init__.py diff --git a/tests/unit_tests/evaluation/agents/test_eval_chain.py b/libs/langchain/tests/unit_tests/evaluation/agents/test_eval_chain.py similarity index 100% rename from tests/unit_tests/evaluation/agents/test_eval_chain.py rename to libs/langchain/tests/unit_tests/evaluation/agents/test_eval_chain.py diff --git a/tests/unit_tests/evaluation/comparison/__init__.py b/libs/langchain/tests/unit_tests/evaluation/comparison/__init__.py similarity index 100% rename from tests/unit_tests/evaluation/comparison/__init__.py rename to libs/langchain/tests/unit_tests/evaluation/comparison/__init__.py diff --git a/tests/unit_tests/evaluation/comparison/test_eval_chain.py b/libs/langchain/tests/unit_tests/evaluation/comparison/test_eval_chain.py similarity index 100% rename from tests/unit_tests/evaluation/comparison/test_eval_chain.py rename to libs/langchain/tests/unit_tests/evaluation/comparison/test_eval_chain.py diff --git a/tests/unit_tests/evaluation/criteria/__init__.py b/libs/langchain/tests/unit_tests/evaluation/criteria/__init__.py similarity index 100% rename from tests/unit_tests/evaluation/criteria/__init__.py rename to libs/langchain/tests/unit_tests/evaluation/criteria/__init__.py diff --git a/tests/unit_tests/evaluation/criteria/test_eval_chain.py b/libs/langchain/tests/unit_tests/evaluation/criteria/test_eval_chain.py similarity index 100% rename from tests/unit_tests/evaluation/criteria/test_eval_chain.py rename to libs/langchain/tests/unit_tests/evaluation/criteria/test_eval_chain.py diff --git a/tests/unit_tests/evaluation/qa/__init__.py b/libs/langchain/tests/unit_tests/evaluation/qa/__init__.py similarity index 100% rename from tests/unit_tests/evaluation/qa/__init__.py rename to libs/langchain/tests/unit_tests/evaluation/qa/__init__.py diff --git a/tests/unit_tests/evaluation/qa/test_eval_chain.py b/libs/langchain/tests/unit_tests/evaluation/qa/test_eval_chain.py similarity index 100% rename from tests/unit_tests/evaluation/qa/test_eval_chain.py rename to libs/langchain/tests/unit_tests/evaluation/qa/test_eval_chain.py diff --git a/tests/unit_tests/evaluation/run_evaluators/__init__.py b/libs/langchain/tests/unit_tests/evaluation/run_evaluators/__init__.py similarity index 100% rename from tests/unit_tests/evaluation/run_evaluators/__init__.py rename to libs/langchain/tests/unit_tests/evaluation/run_evaluators/__init__.py diff --git a/tests/unit_tests/evaluation/string_distance/__init__.py b/libs/langchain/tests/unit_tests/evaluation/string_distance/__init__.py similarity index 100% rename from tests/unit_tests/evaluation/string_distance/__init__.py rename to libs/langchain/tests/unit_tests/evaluation/string_distance/__init__.py diff --git a/tests/unit_tests/evaluation/string_distance/test_base.py b/libs/langchain/tests/unit_tests/evaluation/string_distance/test_base.py similarity index 100% rename from tests/unit_tests/evaluation/string_distance/test_base.py rename to libs/langchain/tests/unit_tests/evaluation/string_distance/test_base.py diff --git a/tests/unit_tests/evaluation/test_loading.py b/libs/langchain/tests/unit_tests/evaluation/test_loading.py similarity index 100% rename from tests/unit_tests/evaluation/test_loading.py rename to libs/langchain/tests/unit_tests/evaluation/test_loading.py diff --git a/tests/unit_tests/examples/example-non-utf8.txt b/libs/langchain/tests/unit_tests/examples/example-non-utf8.txt similarity index 100% rename from tests/unit_tests/examples/example-non-utf8.txt rename to libs/langchain/tests/unit_tests/examples/example-non-utf8.txt diff --git a/tests/unit_tests/examples/example-utf8.txt b/libs/langchain/tests/unit_tests/examples/example-utf8.txt similarity index 100% rename from tests/unit_tests/examples/example-utf8.txt rename to libs/langchain/tests/unit_tests/examples/example-utf8.txt diff --git a/tests/unit_tests/examples/example_prompt.json b/libs/langchain/tests/unit_tests/examples/example_prompt.json similarity index 100% rename from tests/unit_tests/examples/example_prompt.json rename to libs/langchain/tests/unit_tests/examples/example_prompt.json diff --git a/tests/unit_tests/examples/examples.json b/libs/langchain/tests/unit_tests/examples/examples.json similarity index 100% rename from tests/unit_tests/examples/examples.json rename to libs/langchain/tests/unit_tests/examples/examples.json diff --git a/tests/unit_tests/examples/examples.yaml b/libs/langchain/tests/unit_tests/examples/examples.yaml similarity index 100% rename from tests/unit_tests/examples/examples.yaml rename to libs/langchain/tests/unit_tests/examples/examples.yaml diff --git a/tests/unit_tests/examples/few_shot_prompt.json b/libs/langchain/tests/unit_tests/examples/few_shot_prompt.json similarity index 100% rename from tests/unit_tests/examples/few_shot_prompt.json rename to libs/langchain/tests/unit_tests/examples/few_shot_prompt.json diff --git a/tests/unit_tests/examples/few_shot_prompt.yaml b/libs/langchain/tests/unit_tests/examples/few_shot_prompt.yaml similarity index 100% rename from tests/unit_tests/examples/few_shot_prompt.yaml rename to libs/langchain/tests/unit_tests/examples/few_shot_prompt.yaml diff --git a/tests/unit_tests/examples/few_shot_prompt_example_prompt.json b/libs/langchain/tests/unit_tests/examples/few_shot_prompt_example_prompt.json similarity index 100% rename from tests/unit_tests/examples/few_shot_prompt_example_prompt.json rename to libs/langchain/tests/unit_tests/examples/few_shot_prompt_example_prompt.json diff --git a/tests/unit_tests/examples/few_shot_prompt_examples_in.json b/libs/langchain/tests/unit_tests/examples/few_shot_prompt_examples_in.json similarity index 100% rename from tests/unit_tests/examples/few_shot_prompt_examples_in.json rename to libs/langchain/tests/unit_tests/examples/few_shot_prompt_examples_in.json diff --git a/tests/unit_tests/examples/few_shot_prompt_yaml_examples.yaml b/libs/langchain/tests/unit_tests/examples/few_shot_prompt_yaml_examples.yaml similarity index 100% rename from tests/unit_tests/examples/few_shot_prompt_yaml_examples.yaml rename to libs/langchain/tests/unit_tests/examples/few_shot_prompt_yaml_examples.yaml diff --git a/tests/unit_tests/examples/prompt_with_output_parser.json b/libs/langchain/tests/unit_tests/examples/prompt_with_output_parser.json similarity index 100% rename from tests/unit_tests/examples/prompt_with_output_parser.json rename to libs/langchain/tests/unit_tests/examples/prompt_with_output_parser.json diff --git a/tests/unit_tests/examples/simple_prompt.json b/libs/langchain/tests/unit_tests/examples/simple_prompt.json similarity index 100% rename from tests/unit_tests/examples/simple_prompt.json rename to libs/langchain/tests/unit_tests/examples/simple_prompt.json diff --git a/tests/unit_tests/examples/simple_prompt.yaml b/libs/langchain/tests/unit_tests/examples/simple_prompt.yaml similarity index 100% rename from tests/unit_tests/examples/simple_prompt.yaml rename to libs/langchain/tests/unit_tests/examples/simple_prompt.yaml diff --git a/tests/unit_tests/examples/simple_prompt_with_template_file.json b/libs/langchain/tests/unit_tests/examples/simple_prompt_with_template_file.json similarity index 100% rename from tests/unit_tests/examples/simple_prompt_with_template_file.json rename to libs/langchain/tests/unit_tests/examples/simple_prompt_with_template_file.json diff --git a/tests/unit_tests/examples/simple_template.txt b/libs/langchain/tests/unit_tests/examples/simple_template.txt similarity index 100% rename from tests/unit_tests/examples/simple_template.txt rename to libs/langchain/tests/unit_tests/examples/simple_template.txt diff --git a/tests/unit_tests/examples/test_specs/apis-guru/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/apis-guru/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/apis-guru/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/apis-guru/apispec.json diff --git a/tests/unit_tests/examples/test_specs/biztoc/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/biztoc/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/biztoc/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/biztoc/apispec.json diff --git a/tests/unit_tests/examples/test_specs/calculator/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/calculator/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/calculator/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/calculator/apispec.json diff --git a/tests/unit_tests/examples/test_specs/datasette/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/datasette/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/datasette/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/datasette/apispec.json diff --git a/tests/unit_tests/examples/test_specs/freetv-app/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/freetv-app/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/freetv-app/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/freetv-app/apispec.json diff --git a/tests/unit_tests/examples/test_specs/joinmilo/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/joinmilo/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/joinmilo/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/joinmilo/apispec.json diff --git a/tests/unit_tests/examples/test_specs/klarna/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/klarna/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/klarna/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/klarna/apispec.json diff --git a/tests/unit_tests/examples/test_specs/milo/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/milo/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/milo/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/milo/apispec.json diff --git a/tests/unit_tests/examples/test_specs/quickchart/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/quickchart/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/quickchart/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/quickchart/apispec.json diff --git a/tests/unit_tests/examples/test_specs/robot/apispec.yaml b/libs/langchain/tests/unit_tests/examples/test_specs/robot/apispec.yaml similarity index 100% rename from tests/unit_tests/examples/test_specs/robot/apispec.yaml rename to libs/langchain/tests/unit_tests/examples/test_specs/robot/apispec.yaml diff --git a/tests/unit_tests/examples/test_specs/robot_openapi.yaml b/libs/langchain/tests/unit_tests/examples/test_specs/robot_openapi.yaml similarity index 100% rename from tests/unit_tests/examples/test_specs/robot_openapi.yaml rename to libs/langchain/tests/unit_tests/examples/test_specs/robot_openapi.yaml diff --git a/tests/unit_tests/examples/test_specs/schooldigger/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/schooldigger/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/schooldigger/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/schooldigger/apispec.json diff --git a/tests/unit_tests/examples/test_specs/shop/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/shop/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/shop/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/shop/apispec.json diff --git a/tests/unit_tests/examples/test_specs/slack/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/slack/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/slack/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/slack/apispec.json diff --git a/tests/unit_tests/examples/test_specs/speak/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/speak/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/speak/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/speak/apispec.json diff --git a/tests/unit_tests/examples/test_specs/urlbox/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/urlbox/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/urlbox/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/urlbox/apispec.json diff --git a/tests/unit_tests/examples/test_specs/wellknown/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/wellknown/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/wellknown/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/wellknown/apispec.json diff --git a/tests/unit_tests/examples/test_specs/wolframalpha/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/wolframalpha/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/wolframalpha/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/wolframalpha/apispec.json diff --git a/tests/unit_tests/examples/test_specs/wolframcloud/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/wolframcloud/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/wolframcloud/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/wolframcloud/apispec.json diff --git a/tests/unit_tests/examples/test_specs/zapier/apispec.json b/libs/langchain/tests/unit_tests/examples/test_specs/zapier/apispec.json similarity index 100% rename from tests/unit_tests/examples/test_specs/zapier/apispec.json rename to libs/langchain/tests/unit_tests/examples/test_specs/zapier/apispec.json diff --git a/tests/unit_tests/llms/__init__.py b/libs/langchain/tests/unit_tests/llms/__init__.py similarity index 100% rename from tests/unit_tests/llms/__init__.py rename to libs/langchain/tests/unit_tests/llms/__init__.py diff --git a/tests/unit_tests/llms/fake_chat_model.py b/libs/langchain/tests/unit_tests/llms/fake_chat_model.py similarity index 100% rename from tests/unit_tests/llms/fake_chat_model.py rename to libs/langchain/tests/unit_tests/llms/fake_chat_model.py diff --git a/tests/unit_tests/llms/fake_llm.py b/libs/langchain/tests/unit_tests/llms/fake_llm.py similarity index 100% rename from tests/unit_tests/llms/fake_llm.py rename to libs/langchain/tests/unit_tests/llms/fake_llm.py diff --git a/tests/unit_tests/llms/test_base.py b/libs/langchain/tests/unit_tests/llms/test_base.py similarity index 100% rename from tests/unit_tests/llms/test_base.py rename to libs/langchain/tests/unit_tests/llms/test_base.py diff --git a/tests/unit_tests/llms/test_callbacks.py b/libs/langchain/tests/unit_tests/llms/test_callbacks.py similarity index 100% rename from tests/unit_tests/llms/test_callbacks.py rename to libs/langchain/tests/unit_tests/llms/test_callbacks.py diff --git a/tests/unit_tests/llms/test_loading.py b/libs/langchain/tests/unit_tests/llms/test_loading.py similarity index 100% rename from tests/unit_tests/llms/test_loading.py rename to libs/langchain/tests/unit_tests/llms/test_loading.py diff --git a/tests/unit_tests/llms/test_utils.py b/libs/langchain/tests/unit_tests/llms/test_utils.py similarity index 100% rename from tests/unit_tests/llms/test_utils.py rename to libs/langchain/tests/unit_tests/llms/test_utils.py diff --git a/tests/unit_tests/load/__snapshots__/test_dump.ambr b/libs/langchain/tests/unit_tests/load/__snapshots__/test_dump.ambr similarity index 100% rename from tests/unit_tests/load/__snapshots__/test_dump.ambr rename to libs/langchain/tests/unit_tests/load/__snapshots__/test_dump.ambr diff --git a/tests/unit_tests/load/test_dump.py b/libs/langchain/tests/unit_tests/load/test_dump.py similarity index 100% rename from tests/unit_tests/load/test_dump.py rename to libs/langchain/tests/unit_tests/load/test_dump.py diff --git a/tests/unit_tests/load/test_load.py b/libs/langchain/tests/unit_tests/load/test_load.py similarity index 100% rename from tests/unit_tests/load/test_load.py rename to libs/langchain/tests/unit_tests/load/test_load.py diff --git a/tests/unit_tests/memory/__init__.py b/libs/langchain/tests/unit_tests/memory/__init__.py similarity index 100% rename from tests/unit_tests/memory/__init__.py rename to libs/langchain/tests/unit_tests/memory/__init__.py diff --git a/tests/unit_tests/memory/chat_message_histories/__init__.py b/libs/langchain/tests/unit_tests/memory/chat_message_histories/__init__.py similarity index 100% rename from tests/unit_tests/memory/chat_message_histories/__init__.py rename to libs/langchain/tests/unit_tests/memory/chat_message_histories/__init__.py diff --git a/tests/unit_tests/memory/chat_message_histories/test_file.py b/libs/langchain/tests/unit_tests/memory/chat_message_histories/test_file.py similarity index 100% rename from tests/unit_tests/memory/chat_message_histories/test_file.py rename to libs/langchain/tests/unit_tests/memory/chat_message_histories/test_file.py diff --git a/tests/unit_tests/memory/chat_message_histories/test_sql.py b/libs/langchain/tests/unit_tests/memory/chat_message_histories/test_sql.py similarity index 100% rename from tests/unit_tests/memory/chat_message_histories/test_sql.py rename to libs/langchain/tests/unit_tests/memory/chat_message_histories/test_sql.py diff --git a/tests/unit_tests/memory/chat_message_histories/test_zep.py b/libs/langchain/tests/unit_tests/memory/chat_message_histories/test_zep.py similarity index 100% rename from tests/unit_tests/memory/chat_message_histories/test_zep.py rename to libs/langchain/tests/unit_tests/memory/chat_message_histories/test_zep.py diff --git a/tests/unit_tests/memory/test_combined_memory.py b/libs/langchain/tests/unit_tests/memory/test_combined_memory.py similarity index 97% rename from tests/unit_tests/memory/test_combined_memory.py rename to libs/langchain/tests/unit_tests/memory/test_combined_memory.py index dcaf240183e..b056e53c4ec 100644 --- a/tests/unit_tests/memory/test_combined_memory.py +++ b/libs/langchain/tests/unit_tests/memory/test_combined_memory.py @@ -1,37 +1,37 @@ -"""Test for CombinedMemory class""" -# from langchain.prompts import PromptTemplate -from typing import List - -import pytest - -from langchain.memory import CombinedMemory, ConversationBufferMemory - - -@pytest.fixture() -def example_memory() -> List[ConversationBufferMemory]: - example_1 = ConversationBufferMemory(memory_key="foo") - example_2 = ConversationBufferMemory(memory_key="bar") - example_3 = ConversationBufferMemory(memory_key="bar") - return [example_1, example_2, example_3] - - -def test_basic_functionality(example_memory: List[ConversationBufferMemory]) -> None: - """Test basic functionality of methods exposed by class""" - combined_memory = CombinedMemory(memories=[example_memory[0], example_memory[1]]) - assert combined_memory.memory_variables == ["foo", "bar"] - assert combined_memory.load_memory_variables({}) == {"foo": "", "bar": ""} - combined_memory.save_context( - {"input": "Hello there"}, {"output": "Hello, how can I help you?"} - ) - assert combined_memory.load_memory_variables({}) == { - "foo": "Human: Hello there\nAI: Hello, how can I help you?", - "bar": "Human: Hello there\nAI: Hello, how can I help you?", - } - combined_memory.clear() - assert combined_memory.load_memory_variables({}) == {"foo": "", "bar": ""} - - -def test_repeated_memory_var(example_memory: List[ConversationBufferMemory]) -> None: - """Test raising error when repeated memory variables found""" - with pytest.raises(ValueError): - CombinedMemory(memories=[example_memory[1], example_memory[2]]) +"""Test for CombinedMemory class""" +# from langchain.prompts import PromptTemplate +from typing import List + +import pytest + +from langchain.memory import CombinedMemory, ConversationBufferMemory + + +@pytest.fixture() +def example_memory() -> List[ConversationBufferMemory]: + example_1 = ConversationBufferMemory(memory_key="foo") + example_2 = ConversationBufferMemory(memory_key="bar") + example_3 = ConversationBufferMemory(memory_key="bar") + return [example_1, example_2, example_3] + + +def test_basic_functionality(example_memory: List[ConversationBufferMemory]) -> None: + """Test basic functionality of methods exposed by class""" + combined_memory = CombinedMemory(memories=[example_memory[0], example_memory[1]]) + assert combined_memory.memory_variables == ["foo", "bar"] + assert combined_memory.load_memory_variables({}) == {"foo": "", "bar": ""} + combined_memory.save_context( + {"input": "Hello there"}, {"output": "Hello, how can I help you?"} + ) + assert combined_memory.load_memory_variables({}) == { + "foo": "Human: Hello there\nAI: Hello, how can I help you?", + "bar": "Human: Hello there\nAI: Hello, how can I help you?", + } + combined_memory.clear() + assert combined_memory.load_memory_variables({}) == {"foo": "", "bar": ""} + + +def test_repeated_memory_var(example_memory: List[ConversationBufferMemory]) -> None: + """Test raising error when repeated memory variables found""" + with pytest.raises(ValueError): + CombinedMemory(memories=[example_memory[1], example_memory[2]]) diff --git a/tests/unit_tests/output_parsers/__init__.py b/libs/langchain/tests/unit_tests/output_parsers/__init__.py similarity index 100% rename from tests/unit_tests/output_parsers/__init__.py rename to libs/langchain/tests/unit_tests/output_parsers/__init__.py diff --git a/tests/unit_tests/output_parsers/test_base_output_parser.py b/libs/langchain/tests/unit_tests/output_parsers/test_base_output_parser.py similarity index 100% rename from tests/unit_tests/output_parsers/test_base_output_parser.py rename to libs/langchain/tests/unit_tests/output_parsers/test_base_output_parser.py diff --git a/tests/unit_tests/output_parsers/test_boolean_parser.py b/libs/langchain/tests/unit_tests/output_parsers/test_boolean_parser.py similarity index 100% rename from tests/unit_tests/output_parsers/test_boolean_parser.py rename to libs/langchain/tests/unit_tests/output_parsers/test_boolean_parser.py diff --git a/tests/unit_tests/output_parsers/test_combining_parser.py b/libs/langchain/tests/unit_tests/output_parsers/test_combining_parser.py similarity index 100% rename from tests/unit_tests/output_parsers/test_combining_parser.py rename to libs/langchain/tests/unit_tests/output_parsers/test_combining_parser.py diff --git a/tests/unit_tests/output_parsers/test_datetime_parser.py b/libs/langchain/tests/unit_tests/output_parsers/test_datetime_parser.py similarity index 100% rename from tests/unit_tests/output_parsers/test_datetime_parser.py rename to libs/langchain/tests/unit_tests/output_parsers/test_datetime_parser.py diff --git a/tests/unit_tests/output_parsers/test_enum_parser.py b/libs/langchain/tests/unit_tests/output_parsers/test_enum_parser.py similarity index 100% rename from tests/unit_tests/output_parsers/test_enum_parser.py rename to libs/langchain/tests/unit_tests/output_parsers/test_enum_parser.py diff --git a/tests/unit_tests/output_parsers/test_json.py b/libs/langchain/tests/unit_tests/output_parsers/test_json.py similarity index 100% rename from tests/unit_tests/output_parsers/test_json.py rename to libs/langchain/tests/unit_tests/output_parsers/test_json.py diff --git a/tests/unit_tests/output_parsers/test_list_parser.py b/libs/langchain/tests/unit_tests/output_parsers/test_list_parser.py similarity index 100% rename from tests/unit_tests/output_parsers/test_list_parser.py rename to libs/langchain/tests/unit_tests/output_parsers/test_list_parser.py diff --git a/tests/unit_tests/output_parsers/test_pydantic_parser.py b/libs/langchain/tests/unit_tests/output_parsers/test_pydantic_parser.py similarity index 100% rename from tests/unit_tests/output_parsers/test_pydantic_parser.py rename to libs/langchain/tests/unit_tests/output_parsers/test_pydantic_parser.py diff --git a/tests/unit_tests/output_parsers/test_regex_dict.py b/libs/langchain/tests/unit_tests/output_parsers/test_regex_dict.py similarity index 100% rename from tests/unit_tests/output_parsers/test_regex_dict.py rename to libs/langchain/tests/unit_tests/output_parsers/test_regex_dict.py diff --git a/tests/unit_tests/output_parsers/test_structured_parser.py b/libs/langchain/tests/unit_tests/output_parsers/test_structured_parser.py similarity index 100% rename from tests/unit_tests/output_parsers/test_structured_parser.py rename to libs/langchain/tests/unit_tests/output_parsers/test_structured_parser.py diff --git a/tests/unit_tests/prompts/__init__.py b/libs/langchain/tests/unit_tests/prompts/__init__.py similarity index 100% rename from tests/unit_tests/prompts/__init__.py rename to libs/langchain/tests/unit_tests/prompts/__init__.py diff --git a/tests/unit_tests/prompts/test_chat.py b/libs/langchain/tests/unit_tests/prompts/test_chat.py similarity index 100% rename from tests/unit_tests/prompts/test_chat.py rename to libs/langchain/tests/unit_tests/prompts/test_chat.py diff --git a/tests/unit_tests/prompts/test_few_shot.py b/libs/langchain/tests/unit_tests/prompts/test_few_shot.py similarity index 100% rename from tests/unit_tests/prompts/test_few_shot.py rename to libs/langchain/tests/unit_tests/prompts/test_few_shot.py diff --git a/tests/unit_tests/prompts/test_few_shot_with_templates.py b/libs/langchain/tests/unit_tests/prompts/test_few_shot_with_templates.py similarity index 100% rename from tests/unit_tests/prompts/test_few_shot_with_templates.py rename to libs/langchain/tests/unit_tests/prompts/test_few_shot_with_templates.py diff --git a/tests/unit_tests/prompts/test_length_based_example_selector.py b/libs/langchain/tests/unit_tests/prompts/test_length_based_example_selector.py similarity index 100% rename from tests/unit_tests/prompts/test_length_based_example_selector.py rename to libs/langchain/tests/unit_tests/prompts/test_length_based_example_selector.py diff --git a/tests/unit_tests/prompts/test_loading.py b/libs/langchain/tests/unit_tests/prompts/test_loading.py similarity index 100% rename from tests/unit_tests/prompts/test_loading.py rename to libs/langchain/tests/unit_tests/prompts/test_loading.py diff --git a/tests/unit_tests/prompts/test_pipeline_prompt.py b/libs/langchain/tests/unit_tests/prompts/test_pipeline_prompt.py similarity index 100% rename from tests/unit_tests/prompts/test_pipeline_prompt.py rename to libs/langchain/tests/unit_tests/prompts/test_pipeline_prompt.py diff --git a/tests/unit_tests/prompts/test_prompt.py b/libs/langchain/tests/unit_tests/prompts/test_prompt.py similarity index 100% rename from tests/unit_tests/prompts/test_prompt.py rename to libs/langchain/tests/unit_tests/prompts/test_prompt.py diff --git a/tests/unit_tests/prompts/test_utils.py b/libs/langchain/tests/unit_tests/prompts/test_utils.py similarity index 100% rename from tests/unit_tests/prompts/test_utils.py rename to libs/langchain/tests/unit_tests/prompts/test_utils.py diff --git a/tests/unit_tests/retrievers/__init__.py b/libs/langchain/tests/unit_tests/retrievers/__init__.py similarity index 100% rename from tests/unit_tests/retrievers/__init__.py rename to libs/langchain/tests/unit_tests/retrievers/__init__.py diff --git a/tests/unit_tests/retrievers/self_query/__init__.py b/libs/langchain/tests/unit_tests/retrievers/self_query/__init__.py similarity index 100% rename from tests/unit_tests/retrievers/self_query/__init__.py rename to libs/langchain/tests/unit_tests/retrievers/self_query/__init__.py diff --git a/tests/unit_tests/retrievers/self_query/test_myscale.py b/libs/langchain/tests/unit_tests/retrievers/self_query/test_myscale.py similarity index 100% rename from tests/unit_tests/retrievers/self_query/test_myscale.py rename to libs/langchain/tests/unit_tests/retrievers/self_query/test_myscale.py diff --git a/tests/unit_tests/retrievers/self_query/test_pinecone.py b/libs/langchain/tests/unit_tests/retrievers/self_query/test_pinecone.py similarity index 100% rename from tests/unit_tests/retrievers/self_query/test_pinecone.py rename to libs/langchain/tests/unit_tests/retrievers/self_query/test_pinecone.py diff --git a/tests/unit_tests/retrievers/test_base.py b/libs/langchain/tests/unit_tests/retrievers/test_base.py similarity index 100% rename from tests/unit_tests/retrievers/test_base.py rename to libs/langchain/tests/unit_tests/retrievers/test_base.py diff --git a/tests/unit_tests/retrievers/test_tfidf.py b/libs/langchain/tests/unit_tests/retrievers/test_tfidf.py similarity index 100% rename from tests/unit_tests/retrievers/test_tfidf.py rename to libs/langchain/tests/unit_tests/retrievers/test_tfidf.py diff --git a/tests/unit_tests/retrievers/test_time_weighted_retriever.py b/libs/langchain/tests/unit_tests/retrievers/test_time_weighted_retriever.py similarity index 100% rename from tests/unit_tests/retrievers/test_time_weighted_retriever.py rename to libs/langchain/tests/unit_tests/retrievers/test_time_weighted_retriever.py diff --git a/tests/unit_tests/retrievers/test_zep.py b/libs/langchain/tests/unit_tests/retrievers/test_zep.py similarity index 100% rename from tests/unit_tests/retrievers/test_zep.py rename to libs/langchain/tests/unit_tests/retrievers/test_zep.py diff --git a/tests/unit_tests/smith/__init__.py b/libs/langchain/tests/unit_tests/smith/__init__.py similarity index 100% rename from tests/unit_tests/smith/__init__.py rename to libs/langchain/tests/unit_tests/smith/__init__.py diff --git a/tests/unit_tests/smith/evaluation/__init__.py b/libs/langchain/tests/unit_tests/smith/evaluation/__init__.py similarity index 100% rename from tests/unit_tests/smith/evaluation/__init__.py rename to libs/langchain/tests/unit_tests/smith/evaluation/__init__.py diff --git a/tests/unit_tests/smith/evaluation/test_runner_utils.py b/libs/langchain/tests/unit_tests/smith/evaluation/test_runner_utils.py similarity index 100% rename from tests/unit_tests/smith/evaluation/test_runner_utils.py rename to libs/langchain/tests/unit_tests/smith/evaluation/test_runner_utils.py diff --git a/tests/unit_tests/smith/test_runner_utils.py b/libs/langchain/tests/unit_tests/smith/test_runner_utils.py similarity index 100% rename from tests/unit_tests/smith/test_runner_utils.py rename to libs/langchain/tests/unit_tests/smith/test_runner_utils.py diff --git a/tests/unit_tests/test_bash.py b/libs/langchain/tests/unit_tests/test_bash.py similarity index 100% rename from tests/unit_tests/test_bash.py rename to libs/langchain/tests/unit_tests/test_bash.py diff --git a/tests/unit_tests/test_cache.py b/libs/langchain/tests/unit_tests/test_cache.py similarity index 100% rename from tests/unit_tests/test_cache.py rename to libs/langchain/tests/unit_tests/test_cache.py diff --git a/tests/unit_tests/test_dependencies.py b/libs/langchain/tests/unit_tests/test_dependencies.py similarity index 100% rename from tests/unit_tests/test_dependencies.py rename to libs/langchain/tests/unit_tests/test_dependencies.py diff --git a/tests/unit_tests/test_document_transformers.py b/libs/langchain/tests/unit_tests/test_document_transformers.py similarity index 100% rename from tests/unit_tests/test_document_transformers.py rename to libs/langchain/tests/unit_tests/test_document_transformers.py diff --git a/tests/unit_tests/test_formatting.py b/libs/langchain/tests/unit_tests/test_formatting.py similarity index 100% rename from tests/unit_tests/test_formatting.py rename to libs/langchain/tests/unit_tests/test_formatting.py diff --git a/tests/unit_tests/test_math_utils.py b/libs/langchain/tests/unit_tests/test_math_utils.py similarity index 100% rename from tests/unit_tests/test_math_utils.py rename to libs/langchain/tests/unit_tests/test_math_utils.py diff --git a/tests/unit_tests/test_pytest_config.py b/libs/langchain/tests/unit_tests/test_pytest_config.py similarity index 100% rename from tests/unit_tests/test_pytest_config.py rename to libs/langchain/tests/unit_tests/test_pytest_config.py diff --git a/tests/unit_tests/test_python.py b/libs/langchain/tests/unit_tests/test_python.py similarity index 100% rename from tests/unit_tests/test_python.py rename to libs/langchain/tests/unit_tests/test_python.py diff --git a/tests/unit_tests/test_schema.py b/libs/langchain/tests/unit_tests/test_schema.py similarity index 100% rename from tests/unit_tests/test_schema.py rename to libs/langchain/tests/unit_tests/test_schema.py diff --git a/tests/unit_tests/test_sql_database.py b/libs/langchain/tests/unit_tests/test_sql_database.py similarity index 100% rename from tests/unit_tests/test_sql_database.py rename to libs/langchain/tests/unit_tests/test_sql_database.py diff --git a/tests/unit_tests/test_sql_database_schema.py b/libs/langchain/tests/unit_tests/test_sql_database_schema.py similarity index 100% rename from tests/unit_tests/test_sql_database_schema.py rename to libs/langchain/tests/unit_tests/test_sql_database_schema.py diff --git a/tests/unit_tests/test_sqlalchemy.py b/libs/langchain/tests/unit_tests/test_sqlalchemy.py similarity index 100% rename from tests/unit_tests/test_sqlalchemy.py rename to libs/langchain/tests/unit_tests/test_sqlalchemy.py diff --git a/tests/unit_tests/test_text_splitter.py b/libs/langchain/tests/unit_tests/test_text_splitter.py similarity index 100% rename from tests/unit_tests/test_text_splitter.py rename to libs/langchain/tests/unit_tests/test_text_splitter.py diff --git a/tests/unit_tests/test_utils.py b/libs/langchain/tests/unit_tests/test_utils.py similarity index 100% rename from tests/unit_tests/test_utils.py rename to libs/langchain/tests/unit_tests/test_utils.py diff --git a/tests/unit_tests/tools/__init__.py b/libs/langchain/tests/unit_tests/tools/__init__.py similarity index 100% rename from tests/unit_tests/tools/__init__.py rename to libs/langchain/tests/unit_tests/tools/__init__.py diff --git a/tests/unit_tests/tools/file_management/__init__.py b/libs/langchain/tests/unit_tests/tools/file_management/__init__.py similarity index 100% rename from tests/unit_tests/tools/file_management/__init__.py rename to libs/langchain/tests/unit_tests/tools/file_management/__init__.py diff --git a/tests/unit_tests/tools/file_management/test_copy.py b/libs/langchain/tests/unit_tests/tools/file_management/test_copy.py similarity index 100% rename from tests/unit_tests/tools/file_management/test_copy.py rename to libs/langchain/tests/unit_tests/tools/file_management/test_copy.py diff --git a/tests/unit_tests/tools/file_management/test_file_search.py b/libs/langchain/tests/unit_tests/tools/file_management/test_file_search.py similarity index 100% rename from tests/unit_tests/tools/file_management/test_file_search.py rename to libs/langchain/tests/unit_tests/tools/file_management/test_file_search.py diff --git a/tests/unit_tests/tools/file_management/test_list_dir.py b/libs/langchain/tests/unit_tests/tools/file_management/test_list_dir.py similarity index 100% rename from tests/unit_tests/tools/file_management/test_list_dir.py rename to libs/langchain/tests/unit_tests/tools/file_management/test_list_dir.py diff --git a/tests/unit_tests/tools/file_management/test_move.py b/libs/langchain/tests/unit_tests/tools/file_management/test_move.py similarity index 100% rename from tests/unit_tests/tools/file_management/test_move.py rename to libs/langchain/tests/unit_tests/tools/file_management/test_move.py diff --git a/tests/unit_tests/tools/file_management/test_read.py b/libs/langchain/tests/unit_tests/tools/file_management/test_read.py similarity index 100% rename from tests/unit_tests/tools/file_management/test_read.py rename to libs/langchain/tests/unit_tests/tools/file_management/test_read.py diff --git a/tests/unit_tests/tools/file_management/test_toolkit.py b/libs/langchain/tests/unit_tests/tools/file_management/test_toolkit.py similarity index 100% rename from tests/unit_tests/tools/file_management/test_toolkit.py rename to libs/langchain/tests/unit_tests/tools/file_management/test_toolkit.py diff --git a/tests/unit_tests/tools/file_management/test_utils.py b/libs/langchain/tests/unit_tests/tools/file_management/test_utils.py similarity index 100% rename from tests/unit_tests/tools/file_management/test_utils.py rename to libs/langchain/tests/unit_tests/tools/file_management/test_utils.py diff --git a/tests/unit_tests/tools/file_management/test_write.py b/libs/langchain/tests/unit_tests/tools/file_management/test_write.py similarity index 100% rename from tests/unit_tests/tools/file_management/test_write.py rename to libs/langchain/tests/unit_tests/tools/file_management/test_write.py diff --git a/tests/unit_tests/tools/openapi/__init__.py b/libs/langchain/tests/unit_tests/tools/openapi/__init__.py similarity index 100% rename from tests/unit_tests/tools/openapi/__init__.py rename to libs/langchain/tests/unit_tests/tools/openapi/__init__.py diff --git a/tests/unit_tests/tools/openapi/test_api_models.py b/libs/langchain/tests/unit_tests/tools/openapi/test_api_models.py similarity index 100% rename from tests/unit_tests/tools/openapi/test_api_models.py rename to libs/langchain/tests/unit_tests/tools/openapi/test_api_models.py diff --git a/tests/unit_tests/tools/powerbi/__init__.py b/libs/langchain/tests/unit_tests/tools/powerbi/__init__.py similarity index 100% rename from tests/unit_tests/tools/powerbi/__init__.py rename to libs/langchain/tests/unit_tests/tools/powerbi/__init__.py diff --git a/tests/unit_tests/tools/powerbi/test_powerbi.py b/libs/langchain/tests/unit_tests/tools/powerbi/test_powerbi.py similarity index 100% rename from tests/unit_tests/tools/powerbi/test_powerbi.py rename to libs/langchain/tests/unit_tests/tools/powerbi/test_powerbi.py diff --git a/tests/unit_tests/tools/python/__init__.py b/libs/langchain/tests/unit_tests/tools/python/__init__.py similarity index 100% rename from tests/unit_tests/tools/python/__init__.py rename to libs/langchain/tests/unit_tests/tools/python/__init__.py diff --git a/tests/unit_tests/tools/python/test_python.py b/libs/langchain/tests/unit_tests/tools/python/test_python.py similarity index 100% rename from tests/unit_tests/tools/python/test_python.py rename to libs/langchain/tests/unit_tests/tools/python/test_python.py diff --git a/tests/unit_tests/tools/requests/__init__.py b/libs/langchain/tests/unit_tests/tools/requests/__init__.py similarity index 100% rename from tests/unit_tests/tools/requests/__init__.py rename to libs/langchain/tests/unit_tests/tools/requests/__init__.py diff --git a/tests/unit_tests/tools/requests/test_tool.py b/libs/langchain/tests/unit_tests/tools/requests/test_tool.py similarity index 100% rename from tests/unit_tests/tools/requests/test_tool.py rename to libs/langchain/tests/unit_tests/tools/requests/test_tool.py diff --git a/tests/unit_tests/tools/shell/__init__.py b/libs/langchain/tests/unit_tests/tools/shell/__init__.py similarity index 100% rename from tests/unit_tests/tools/shell/__init__.py rename to libs/langchain/tests/unit_tests/tools/shell/__init__.py diff --git a/tests/unit_tests/tools/shell/test_shell.py b/libs/langchain/tests/unit_tests/tools/shell/test_shell.py similarity index 100% rename from tests/unit_tests/tools/shell/test_shell.py rename to libs/langchain/tests/unit_tests/tools/shell/test_shell.py diff --git a/tests/unit_tests/tools/test_base.py b/libs/langchain/tests/unit_tests/tools/test_base.py similarity index 100% rename from tests/unit_tests/tools/test_base.py rename to libs/langchain/tests/unit_tests/tools/test_base.py diff --git a/tests/unit_tests/tools/test_exported.py b/libs/langchain/tests/unit_tests/tools/test_exported.py similarity index 100% rename from tests/unit_tests/tools/test_exported.py rename to libs/langchain/tests/unit_tests/tools/test_exported.py diff --git a/tests/unit_tests/tools/test_json.py b/libs/langchain/tests/unit_tests/tools/test_json.py similarity index 100% rename from tests/unit_tests/tools/test_json.py rename to libs/langchain/tests/unit_tests/tools/test_json.py diff --git a/tests/unit_tests/tools/test_public_api.py b/libs/langchain/tests/unit_tests/tools/test_public_api.py similarity index 100% rename from tests/unit_tests/tools/test_public_api.py rename to libs/langchain/tests/unit_tests/tools/test_public_api.py diff --git a/tests/unit_tests/tools/test_signatures.py b/libs/langchain/tests/unit_tests/tools/test_signatures.py similarity index 100% rename from tests/unit_tests/tools/test_signatures.py rename to libs/langchain/tests/unit_tests/tools/test_signatures.py diff --git a/tests/unit_tests/tools/test_zapier.py b/libs/langchain/tests/unit_tests/tools/test_zapier.py similarity index 97% rename from tests/unit_tests/tools/test_zapier.py rename to libs/langchain/tests/unit_tests/tools/test_zapier.py index 05ae4230e0c..44b93180a95 100644 --- a/tests/unit_tests/tools/test_zapier.py +++ b/libs/langchain/tests/unit_tests/tools/test_zapier.py @@ -1,286 +1,286 @@ -"""Test building the Zapier tool, not running it.""" -from unittest.mock import MagicMock, patch - -import pytest -import requests - -from langchain.tools.zapier.prompt import BASE_ZAPIER_TOOL_PROMPT -from langchain.tools.zapier.tool import ZapierNLARunAction -from langchain.utilities.zapier import ZapierNLAWrapper - - -def test_default_base_prompt() -> None: - """Test that the default prompt is being inserted.""" - tool = ZapierNLARunAction( - action_id="test", - zapier_description="test", - params_schema={"test": "test"}, - api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), - ) - - # Test that the base prompt was successfully assigned to the default prompt - assert tool.base_prompt == BASE_ZAPIER_TOOL_PROMPT - assert tool.description == BASE_ZAPIER_TOOL_PROMPT.format( - zapier_description="test", - params=str(list({"test": "test"}.keys())), - ) - - -def test_custom_base_prompt() -> None: - """Test that a custom prompt is being inserted.""" - base_prompt = "Test. {zapier_description} and {params}." - tool = ZapierNLARunAction( - action_id="test", - zapier_description="test", - params_schema={"test": "test"}, - base_prompt=base_prompt, - api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), - ) - - # Test that the base prompt was successfully assigned to the default prompt - assert tool.base_prompt == base_prompt - assert tool.description == "Test. test and ['test']." - - -def test_custom_base_prompt_fail() -> None: - """Test validating an invalid custom prompt.""" - base_prompt = "Test. {zapier_description}." - with pytest.raises(ValueError): - ZapierNLARunAction( - action_id="test", - zapier_description="test", - params={"test": "test"}, - base_prompt=base_prompt, - api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), - ) - - -def test_format_headers_api_key() -> None: - """Test that the action headers is being created correctly.""" - tool = ZapierNLARunAction( - action_id="test", - zapier_description="test", - params_schema={"test": "test"}, - api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), - ) - headers = tool.api_wrapper._format_headers() - assert headers["Content-Type"] == "application/json" - assert headers["Accept"] == "application/json" - assert headers["X-API-Key"] == "test" - - -def test_format_headers_access_token() -> None: - """Test that the action headers is being created correctly.""" - tool = ZapierNLARunAction( - action_id="test", - zapier_description="test", - params_schema={"test": "test"}, - api_wrapper=ZapierNLAWrapper(zapier_nla_oauth_access_token="test"), - ) - headers = tool.api_wrapper._format_headers() - assert headers["Content-Type"] == "application/json" - assert headers["Accept"] == "application/json" - assert headers["Authorization"] == "Bearer test" - - -def test_create_action_payload() -> None: - """Test that the action payload is being created correctly.""" - tool = ZapierNLARunAction( - action_id="test", - zapier_description="test", - params_schema={"test": "test"}, - api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), - ) - - payload = tool.api_wrapper._create_action_payload("some instructions") - assert payload["instructions"] == "some instructions" - assert payload.get("preview_only") is None - - -def test_create_action_payload_preview() -> None: - """Test that the action payload with preview is being created correctly.""" - tool = ZapierNLARunAction( - action_id="test", - zapier_description="test", - params_schema={"test": "test"}, - api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), - ) - - payload = tool.api_wrapper._create_action_payload( - "some instructions", - preview_only=True, - ) - assert payload["instructions"] == "some instructions" - assert payload["preview_only"] is True - - -def test_create_action_payload_with_params() -> None: - """Test that the action payload with params is being created correctly.""" - tool = ZapierNLARunAction( - action_id="test", - zapier_description="test", - params_schema={"test": "test"}, - api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), - ) - - payload = tool.api_wrapper._create_action_payload( - "some instructions", - {"test": "test"}, - preview_only=True, - ) - assert payload["instructions"] == "some instructions" - assert payload["preview_only"] is True - assert payload["test"] == "test" - - -@pytest.mark.asyncio -async def test_apreview(mocker) -> None: # type: ignore[no-untyped-def] - """Test that the action payload with params is being created correctly.""" - tool = ZapierNLARunAction( - action_id="test", - zapier_description="test", - params_schema={"test": "test"}, - api_wrapper=ZapierNLAWrapper( - zapier_nla_api_key="test", - zapier_nla_api_base="http://localhost:8080/v1/", - ), - ) - mockObj = mocker.patch.object(ZapierNLAWrapper, "_arequest") - await tool.api_wrapper.apreview( - "random_action_id", - "some instructions", - {"test": "test"}, - ) - mockObj.assert_called_once_with( - "POST", - "http://localhost:8080/v1/exposed/random_action_id/execute/", - json={ - "instructions": "some instructions", - "preview_only": True, - "test": "test", - }, - ) - - -@pytest.mark.asyncio -async def test_arun(mocker) -> None: # type: ignore[no-untyped-def] - """Test that the action payload with params is being created correctly.""" - tool = ZapierNLARunAction( - action_id="test", - zapier_description="test", - params_schema={"test": "test"}, - api_wrapper=ZapierNLAWrapper( - zapier_nla_api_key="test", - zapier_nla_api_base="http://localhost:8080/v1/", - ), - ) - mockObj = mocker.patch.object(ZapierNLAWrapper, "_arequest") - await tool.api_wrapper.arun( - "random_action_id", - "some instructions", - {"test": "test"}, - ) - mockObj.assert_called_once_with( - "POST", - "http://localhost:8080/v1/exposed/random_action_id/execute/", - json={"instructions": "some instructions", "test": "test"}, - ) - - -@pytest.mark.asyncio -async def test_alist(mocker) -> None: # type: ignore[no-untyped-def] - """Test that the action payload with params is being created correctly.""" - tool = ZapierNLARunAction( - action_id="test", - zapier_description="test", - params_schema={"test": "test"}, - api_wrapper=ZapierNLAWrapper( - zapier_nla_api_key="test", - zapier_nla_api_base="http://localhost:8080/v1/", - ), - ) - mockObj = mocker.patch.object(ZapierNLAWrapper, "_arequest") - await tool.api_wrapper.alist() - mockObj.assert_called_once_with( - "GET", - "http://localhost:8080/v1/exposed/", - ) - - -def test_wrapper_fails_no_api_key_or_access_token_initialization() -> None: - """Test Wrapper requires either an API Key or OAuth Access Token.""" - with pytest.raises(ValueError): - ZapierNLAWrapper() - - -def test_wrapper_api_key_initialization() -> None: - """Test Wrapper initializes with an API Key.""" - ZapierNLAWrapper(zapier_nla_api_key="test") - - -def test_wrapper_access_token_initialization() -> None: - """Test Wrapper initializes with an API Key.""" - ZapierNLAWrapper(zapier_nla_oauth_access_token="test") - - -def test_list_raises_401_invalid_api_key() -> None: - """Test that a valid error is raised when the API Key is invalid.""" - mock_response = MagicMock() - mock_response.status_code = 401 - mock_response.raise_for_status.side_effect = requests.HTTPError( - "401 Client Error: Unauthorized for url: https://nla.zapier.com/api/v1/exposed/" - ) - mock_session = MagicMock() - mock_session.get.return_value = mock_response - - with patch("requests.Session", return_value=mock_session): - wrapper = ZapierNLAWrapper(zapier_nla_api_key="test") - - with pytest.raises(requests.HTTPError) as err: - wrapper.list() - - assert str(err.value).startswith( - "An unauthorized response occurred. Check that your api key is correct. " - "Err:" - ) - - -def test_list_raises_401_invalid_access_token() -> None: - """Test that a valid error is raised when the API Key is invalid.""" - mock_response = MagicMock() - mock_response.status_code = 401 - mock_response.raise_for_status.side_effect = requests.HTTPError( - "401 Client Error: Unauthorized for url: https://nla.zapier.com/api/v1/exposed/" - ) - mock_session = MagicMock() - mock_session.get.return_value = mock_response - - with patch("requests.Session", return_value=mock_session): - wrapper = ZapierNLAWrapper(zapier_nla_oauth_access_token="test") - - with pytest.raises(requests.HTTPError) as err: - wrapper.list() - - assert str(err.value).startswith( - "An unauthorized response occurred. Check that your access token is " - "correct and doesn't need to be refreshed. Err:" - ) - - -def test_list_raises_other_error() -> None: - """Test that a valid error is raised when an unknown HTTP Error occurs.""" - mock_response = MagicMock() - mock_response.status_code = 404 - mock_response.raise_for_status.side_effect = requests.HTTPError( - "404 Client Error: Not found for url" - ) - mock_session = MagicMock() - mock_session.get.return_value = mock_response - - with patch("requests.Session", return_value=mock_session): - wrapper = ZapierNLAWrapper(zapier_nla_oauth_access_token="test") - - with pytest.raises(requests.HTTPError) as err: - wrapper.list() - - assert str(err.value) == "404 Client Error: Not found for url" +"""Test building the Zapier tool, not running it.""" +from unittest.mock import MagicMock, patch + +import pytest +import requests + +from langchain.tools.zapier.prompt import BASE_ZAPIER_TOOL_PROMPT +from langchain.tools.zapier.tool import ZapierNLARunAction +from langchain.utilities.zapier import ZapierNLAWrapper + + +def test_default_base_prompt() -> None: + """Test that the default prompt is being inserted.""" + tool = ZapierNLARunAction( + action_id="test", + zapier_description="test", + params_schema={"test": "test"}, + api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), + ) + + # Test that the base prompt was successfully assigned to the default prompt + assert tool.base_prompt == BASE_ZAPIER_TOOL_PROMPT + assert tool.description == BASE_ZAPIER_TOOL_PROMPT.format( + zapier_description="test", + params=str(list({"test": "test"}.keys())), + ) + + +def test_custom_base_prompt() -> None: + """Test that a custom prompt is being inserted.""" + base_prompt = "Test. {zapier_description} and {params}." + tool = ZapierNLARunAction( + action_id="test", + zapier_description="test", + params_schema={"test": "test"}, + base_prompt=base_prompt, + api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), + ) + + # Test that the base prompt was successfully assigned to the default prompt + assert tool.base_prompt == base_prompt + assert tool.description == "Test. test and ['test']." + + +def test_custom_base_prompt_fail() -> None: + """Test validating an invalid custom prompt.""" + base_prompt = "Test. {zapier_description}." + with pytest.raises(ValueError): + ZapierNLARunAction( + action_id="test", + zapier_description="test", + params={"test": "test"}, + base_prompt=base_prompt, + api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), + ) + + +def test_format_headers_api_key() -> None: + """Test that the action headers is being created correctly.""" + tool = ZapierNLARunAction( + action_id="test", + zapier_description="test", + params_schema={"test": "test"}, + api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), + ) + headers = tool.api_wrapper._format_headers() + assert headers["Content-Type"] == "application/json" + assert headers["Accept"] == "application/json" + assert headers["X-API-Key"] == "test" + + +def test_format_headers_access_token() -> None: + """Test that the action headers is being created correctly.""" + tool = ZapierNLARunAction( + action_id="test", + zapier_description="test", + params_schema={"test": "test"}, + api_wrapper=ZapierNLAWrapper(zapier_nla_oauth_access_token="test"), + ) + headers = tool.api_wrapper._format_headers() + assert headers["Content-Type"] == "application/json" + assert headers["Accept"] == "application/json" + assert headers["Authorization"] == "Bearer test" + + +def test_create_action_payload() -> None: + """Test that the action payload is being created correctly.""" + tool = ZapierNLARunAction( + action_id="test", + zapier_description="test", + params_schema={"test": "test"}, + api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), + ) + + payload = tool.api_wrapper._create_action_payload("some instructions") + assert payload["instructions"] == "some instructions" + assert payload.get("preview_only") is None + + +def test_create_action_payload_preview() -> None: + """Test that the action payload with preview is being created correctly.""" + tool = ZapierNLARunAction( + action_id="test", + zapier_description="test", + params_schema={"test": "test"}, + api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), + ) + + payload = tool.api_wrapper._create_action_payload( + "some instructions", + preview_only=True, + ) + assert payload["instructions"] == "some instructions" + assert payload["preview_only"] is True + + +def test_create_action_payload_with_params() -> None: + """Test that the action payload with params is being created correctly.""" + tool = ZapierNLARunAction( + action_id="test", + zapier_description="test", + params_schema={"test": "test"}, + api_wrapper=ZapierNLAWrapper(zapier_nla_api_key="test"), + ) + + payload = tool.api_wrapper._create_action_payload( + "some instructions", + {"test": "test"}, + preview_only=True, + ) + assert payload["instructions"] == "some instructions" + assert payload["preview_only"] is True + assert payload["test"] == "test" + + +@pytest.mark.asyncio +async def test_apreview(mocker) -> None: # type: ignore[no-untyped-def] + """Test that the action payload with params is being created correctly.""" + tool = ZapierNLARunAction( + action_id="test", + zapier_description="test", + params_schema={"test": "test"}, + api_wrapper=ZapierNLAWrapper( + zapier_nla_api_key="test", + zapier_nla_api_base="http://localhost:8080/v1/", + ), + ) + mockObj = mocker.patch.object(ZapierNLAWrapper, "_arequest") + await tool.api_wrapper.apreview( + "random_action_id", + "some instructions", + {"test": "test"}, + ) + mockObj.assert_called_once_with( + "POST", + "http://localhost:8080/v1/exposed/random_action_id/execute/", + json={ + "instructions": "some instructions", + "preview_only": True, + "test": "test", + }, + ) + + +@pytest.mark.asyncio +async def test_arun(mocker) -> None: # type: ignore[no-untyped-def] + """Test that the action payload with params is being created correctly.""" + tool = ZapierNLARunAction( + action_id="test", + zapier_description="test", + params_schema={"test": "test"}, + api_wrapper=ZapierNLAWrapper( + zapier_nla_api_key="test", + zapier_nla_api_base="http://localhost:8080/v1/", + ), + ) + mockObj = mocker.patch.object(ZapierNLAWrapper, "_arequest") + await tool.api_wrapper.arun( + "random_action_id", + "some instructions", + {"test": "test"}, + ) + mockObj.assert_called_once_with( + "POST", + "http://localhost:8080/v1/exposed/random_action_id/execute/", + json={"instructions": "some instructions", "test": "test"}, + ) + + +@pytest.mark.asyncio +async def test_alist(mocker) -> None: # type: ignore[no-untyped-def] + """Test that the action payload with params is being created correctly.""" + tool = ZapierNLARunAction( + action_id="test", + zapier_description="test", + params_schema={"test": "test"}, + api_wrapper=ZapierNLAWrapper( + zapier_nla_api_key="test", + zapier_nla_api_base="http://localhost:8080/v1/", + ), + ) + mockObj = mocker.patch.object(ZapierNLAWrapper, "_arequest") + await tool.api_wrapper.alist() + mockObj.assert_called_once_with( + "GET", + "http://localhost:8080/v1/exposed/", + ) + + +def test_wrapper_fails_no_api_key_or_access_token_initialization() -> None: + """Test Wrapper requires either an API Key or OAuth Access Token.""" + with pytest.raises(ValueError): + ZapierNLAWrapper() + + +def test_wrapper_api_key_initialization() -> None: + """Test Wrapper initializes with an API Key.""" + ZapierNLAWrapper(zapier_nla_api_key="test") + + +def test_wrapper_access_token_initialization() -> None: + """Test Wrapper initializes with an API Key.""" + ZapierNLAWrapper(zapier_nla_oauth_access_token="test") + + +def test_list_raises_401_invalid_api_key() -> None: + """Test that a valid error is raised when the API Key is invalid.""" + mock_response = MagicMock() + mock_response.status_code = 401 + mock_response.raise_for_status.side_effect = requests.HTTPError( + "401 Client Error: Unauthorized for url: https://nla.zapier.com/api/v1/exposed/" + ) + mock_session = MagicMock() + mock_session.get.return_value = mock_response + + with patch("requests.Session", return_value=mock_session): + wrapper = ZapierNLAWrapper(zapier_nla_api_key="test") + + with pytest.raises(requests.HTTPError) as err: + wrapper.list() + + assert str(err.value).startswith( + "An unauthorized response occurred. Check that your api key is correct. " + "Err:" + ) + + +def test_list_raises_401_invalid_access_token() -> None: + """Test that a valid error is raised when the API Key is invalid.""" + mock_response = MagicMock() + mock_response.status_code = 401 + mock_response.raise_for_status.side_effect = requests.HTTPError( + "401 Client Error: Unauthorized for url: https://nla.zapier.com/api/v1/exposed/" + ) + mock_session = MagicMock() + mock_session.get.return_value = mock_response + + with patch("requests.Session", return_value=mock_session): + wrapper = ZapierNLAWrapper(zapier_nla_oauth_access_token="test") + + with pytest.raises(requests.HTTPError) as err: + wrapper.list() + + assert str(err.value).startswith( + "An unauthorized response occurred. Check that your access token is " + "correct and doesn't need to be refreshed. Err:" + ) + + +def test_list_raises_other_error() -> None: + """Test that a valid error is raised when an unknown HTTP Error occurs.""" + mock_response = MagicMock() + mock_response.status_code = 404 + mock_response.raise_for_status.side_effect = requests.HTTPError( + "404 Client Error: Not found for url" + ) + mock_session = MagicMock() + mock_session.get.return_value = mock_response + + with patch("requests.Session", return_value=mock_session): + wrapper = ZapierNLAWrapper(zapier_nla_oauth_access_token="test") + + with pytest.raises(requests.HTTPError) as err: + wrapper.list() + + assert str(err.value) == "404 Client Error: Not found for url" diff --git a/tests/unit_tests/utilities/__init__.py b/libs/langchain/tests/unit_tests/utilities/__init__.py similarity index 100% rename from tests/unit_tests/utilities/__init__.py rename to libs/langchain/tests/unit_tests/utilities/__init__.py diff --git a/tests/unit_tests/utilities/test_graphql.py b/libs/langchain/tests/unit_tests/utilities/test_graphql.py similarity index 100% rename from tests/unit_tests/utilities/test_graphql.py rename to libs/langchain/tests/unit_tests/utilities/test_graphql.py diff --git a/tests/unit_tests/utilities/test_loading.py b/libs/langchain/tests/unit_tests/utilities/test_loading.py similarity index 100% rename from tests/unit_tests/utilities/test_loading.py rename to libs/langchain/tests/unit_tests/utilities/test_loading.py diff --git a/tests/unit_tests/vectorstores/__init__.py b/libs/langchain/tests/unit_tests/vectorstores/__init__.py similarity index 100% rename from tests/unit_tests/vectorstores/__init__.py rename to libs/langchain/tests/unit_tests/vectorstores/__init__.py diff --git a/tests/unit_tests/vectorstores/test_sklearn.py b/libs/langchain/tests/unit_tests/vectorstores/test_sklearn.py similarity index 100% rename from tests/unit_tests/vectorstores/test_sklearn.py rename to libs/langchain/tests/unit_tests/vectorstores/test_sklearn.py diff --git a/tests/unit_tests/vectorstores/test_utils.py b/libs/langchain/tests/unit_tests/vectorstores/test_utils.py similarity index 100% rename from tests/unit_tests/vectorstores/test_utils.py rename to libs/langchain/tests/unit_tests/vectorstores/test_utils.py