Skip to content

Commit

Permalink
adding pipet-code-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
cachatj committed Aug 31, 2024
1 parent 5d9f406 commit f5596d4
Show file tree
Hide file tree
Showing 131 changed files with 32,931 additions and 59 deletions.
907 changes: 907 additions & 0 deletions 0-jc_notebooks/analyze_codebase_with_gemini_1_5_pro_jc.ipynb

Large diffs are not rendered by default.

78 changes: 19 additions & 59 deletions 0-jc_notebooks/embed_GCP_documentation_jc.ipynb
Original file line number Diff line number Diff line change
@@ -1,53 +1,12 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "z3Gi-zdCeEbE"
},
"outputs": [],
"source": [
"# Copyright 2023 Google LLC\n",
"#\n",
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"# you may not use this file except in compliance with the License.\n",
"# You may obtain a copy of the License at\n",
"#\n",
"# https://www.apache.org/licenses/LICENSE-2.0\n",
"#\n",
"# Unless required by applicable law or agreed to in writing, software\n",
"# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
"# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
"# See the License for the specific language governing permissions and\n",
"# limitations under the License."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "WcfbGhs1eJF6"
},
"source": [
"# Document Q&A With Retrieval Augmented Generation\n",
"\n",
"<table align=\"left\">\n",
" <td style=\"text-align: center\">\n",
" <a href=\"https://colab.research.google.com/github/GoogleCloudPlatform/generative-ai/blob/main/search/retrieval-augmented-generation/examples/rag_google_documentation.ipynb\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/colab-logo-32px.png\" alt=\"Google Colaboratory logo\"><br> Run in Colab\n",
" </a>\n",
" </td>\n",
" <td style=\"text-align: center\">\n",
" <a href=\"https://github.com/GoogleCloudPlatform/generative-ai/blob/main/search/retrieval-augmented-generation/examples/rag_google_documentation.ipynb\">\n",
" <img src=\"https://cloud.google.com/ml-engine/images/github-logo-32px.png\" alt=\"GitHub logo\"><br> View on GitHub\n",
" </a>\n",
" </td>\n",
" <td style=\"text-align: center\">\n",
" <a href=\"https://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=https://raw.githubusercontent.com/GoogleCloudPlatform/generative-ai/main/search/retrieval-augmented-generation/examples/rag_google_documentation.ipynb\">\n",
" <img src=\"https://lh3.googleusercontent.com/UiNooY4LUgW_oTvpsNhPpQzsstV5W8F7rYgxgGBD85cWJoLmrOzhVs_ksK_vgx40SHs7jCqkTkCk=e14-rj-sc0xffffff-h130-w32\" alt=\"Vertex AI logo\"><br> Open in Vertex AI Workbench\n",
" </a>\n",
" </td>\n",
"</table>"
"# Document Q&A With Retrieval Augmented Generation\n"
]
},
{
Expand Down Expand Up @@ -80,7 +39,7 @@
"id": "jx1FQVAokWVb"
},
"source": [
"### Install libraries"
"#### Install libraries"
]
},
{
Expand All @@ -100,7 +59,7 @@
"id": "R5Xep4W9lq-Z"
},
"source": [
"### Restart current runtime\n",
"#### Restart current runtime\n",
"\n",
"To use the newly installed packages in this Jupyter runtime, you must restart the runtime. You can do this by running the cell below, which will restart the current kernel."
]
Expand Down Expand Up @@ -154,7 +113,7 @@
"id": "-jwsaMQYkZm8"
},
"source": [
"### Authenticate your notebook environment (Colab only)\n",
"#### Authenticate your notebook environment (Colab only)\n",
"\n",
"If you are running this notebook on Google Colab, you will need to authenticate your environment. To do this, run the new cell below. This step is not required if you are using [Vertex AI Workbench](https://cloud.google.com/vertex-ai-workbench)."
]
Expand Down Expand Up @@ -187,7 +146,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {
"id": "YLUml_s7iqBc"
},
Expand Down Expand Up @@ -219,12 +178,12 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# Define project information\n",
"PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\"}\n",
"PROJECT_ID = \"gcp-generative-ai\" # @param {type:\"string\"}\n",
"LOCATION = \"us-central1\" # @param {type:\"string\"}\n",
"\n",
"# Initialize Vertex AI SDK\n",
Expand All @@ -237,7 +196,7 @@
"id": "TKBmi2BMk_OU"
},
"source": [
"## Scrape text from Google Cloud documentation"
"## Scrape text from GCP GenAI VertexAI documentation via List"
]
},
{
Expand All @@ -251,7 +210,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 3,
"metadata": {
"id": "tXHmC10IitET"
},
Expand All @@ -278,7 +237,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 13,
"metadata": {
"id": "hMD6Qz_TkFMG"
},
Expand All @@ -293,12 +252,13 @@
" paragraphs = []\n",
"\n",
" body_div = soup.find(\"div\", class_=\"devsite-article-body\")\n",
" for child in body_div.findChildren():\n",
" if child.name == \"p\":\n",
" paragraphs.append(child.get_text().strip())\n",
" if child.name == \"h2\":\n",
" sections.append(\" \".join(paragraphs))\n",
" break\n",
" if body_div: # Check if body_div is not None\n",
" for child in body_div.findChildren():\n",
" if child.name == \"p\":\n",
" paragraphs.append(child.get_text().strip())\n",
" if child.name == \"h2\":\n",
" sections.append(\" \".join(paragraphs))\n",
" break\n",
"\n",
" for header in soup.find_all(\"h2\"):\n",
" paragraphs = []\n",
Expand All @@ -316,7 +276,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 14,
"metadata": {
"id": "poNdlLf4kFp5"
},
Expand Down Expand Up @@ -813,7 +773,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
17 changes: 17 additions & 0 deletions GCP-generative-ai.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"folders": [
{
"path": "."
},
{
"path": "../enterprise-knowledge-solution"
},
{
"path": "../quivr-llm-brain-app"
},
{
"path": "../gcp-genai-for-developers"
}
],
"settings": {}
}
24 changes: 24 additions & 0 deletions generative-ai-docs-gemini/pipet-code-agent/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
}
26 changes: 26 additions & 0 deletions generative-ai-docs-gemini/pipet-code-agent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local
out

# Editor directories and files
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

tsconfig.tsbuildinfo
*.tsbuildinfo
7 changes: 7 additions & 0 deletions generative-ai-docs-gemini/pipet-code-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Change Log

All notable changes to the "pipet-code-agent" extension are documented in this file.

## v0.0.1

- Initial release. Provides commands for generating code comments and code reviews
32 changes: 32 additions & 0 deletions generative-ai-docs-gemini/pipet-code-agent/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# How to Contribute

We would love to accept your patches and contributions to this project.

## Before you begin

### Sign our Contributor License Agreement

Contributions to this project must be accompanied by a
[Contributor License Agreement](https://cla.developers.google.com/about) (CLA).
You (or your employer) retain the copyright to your contribution; this simply
gives us permission to use and redistribute your contributions as part of the
project.

If you or your current employer have already signed the Google CLA (even if it
was for a different project), you probably don't need to do it again.

Visit <https://cla.developers.google.com/> to see your current agreements or to
sign a new one.

### Review our Community Guidelines

This project follows [Google's Open Source Community
Guidelines](https://opensource.google/conduct/).

## Contribution process

### Code Reviews

All submissions, including submissions by project members, require review. We
use [GitHub pull requests](https://docs.github.com/articles/about-pull-requests)
for this purpose.
Loading

0 comments on commit f5596d4

Please sign in to comment.