The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Feature: GitLab url from ENV (#14221)
balaba-max64d5108f99f0
diff --git a/docs/docs/integrations/toolkits/gitlab.ipynb b/docs/docs/integrations/toolkits/gitlab.ipynbindex 3edb840ef2..83b40ffdd6 100644--- a/docs/docs/integrations/toolkits/gitlab.ipynb+++ b/docs/docs/integrations/toolkits/gitlab.ipynb@@ -77,6 +77,7 @@"\n","Before initializing your agent, the following environmental variables need to be set:\n","\n",+ "* **GITLAB_URL** - The URL hosted Gitlab. Defaults to \"https://gitlab.com\". \n","* **GITLAB_PERSONAL_ACCESS_TOKEN**- The personal access token you created in the last step\n","* **GITLAB_REPOSITORY**- The name of the Gitlab repository you want your bot to act upon. Must follow the format {username}/{repo-name}.\n","* **GITLAB_BRANCH**- The branch where the bot will make its commits. Defaults to 'main.'\n",@@ -111,6 +112,7 @@"outputs": [],"source": ["# Set your environment variables using os.environ\n",+ "os.environ[\"GITLAB_URL\"] = \"https://gitlab.example.org\"\n","os.environ[\"GITLAB_PERSONAL_ACCESS_TOKEN\"] = \"\"\n","os.environ[\"GITLAB_REPOSITORY\"] = \"username/repo-name\"\n","os.environ[\"GITLAB_BRANCH\"] = \"bot-branch-name\"\n",diff --git a/libs/langchain/langchain/utilities/gitlab.py b/libs/langchain/langchain/utilities/gitlab.pyindex 78765637c7..c36f8479e9 100644--- a/libs/langchain/langchain/utilities/gitlab.py+++ b/libs/langchain/langchain/utilities/gitlab.py@@ -38,6 +38,10 @@ class GitLabAPIWrapper(BaseModel):@root_validator()def validate_environment(cls, values: Dict) -> Dict:"""Validate that api key and python package exists in environment."""++ gitlab_url = get_from_dict_or_env(+ values, "gitlab_url", "GITLAB_URL", default=None+ )gitlab_repository = get_from_dict_or_env(values, "gitlab_repository", "GITLAB_REPOSITORY")@@ -62,7 +66,11 @@ class GitLabAPIWrapper(BaseModel):"Please install it with `pip install python-gitlab`")- g = gitlab.Gitlab(private_token=gitlab_personal_access_token)+ g = gitlab.Gitlab(+ url=gitlab_url,+ private_token=gitlab_personal_access_token,+ keep_base_url=True,+ )g.auth()