Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gemini connector integration #183668

Merged
merged 129 commits into from
Jun 6, 2024

Conversation

honeyn303
Copy link
Contributor

@honeyn303 honeyn303 commented May 16, 2024

Gemini Connector: Supports Google Gemini AI API

New Generative AI for Security connector. Allows user to define a Google Gemini AI connector.

Currently has the most basic executor RUN/TEST action to send request to the chat completion endpoint and receive back the response. Also implements the DASHBOARD to create the token tracking dashboard.

Example Gemini payload:

{
  "contents":[
    {
      "role":"user",
      "parts":[
        {
          "text":"Write the first line of a story about a magic backpack."
        }
      ]
    }
  ],
  "generation_config":{
    "temperature":0,
    "maxOutputTokens":8192
  }
}

Define connector

Screenshot 2024-05-22 at 9 07 29 AM Screenshot 2024-05-22 at 9 07 17 AM

Test connector

Screenshot 2024-05-22 at 9 06 58 AM

Token Dashboard

Screenshot 2024-05-22 at 9 11 31 AM Screenshot 2024-05-22 at 9 11 14 AM

Testing

Credentials for Google Gemini: https://p.elstc.co/paste/8sS2cMve#lWhE4ppTH9kVy2zm04egNxtrqO3AbU1C31GvMtvqYVF

  1. Create Gemini connectors with provided credentials
  2. Use elastic-product as the project
  3. Use the entire JSON payload in the PasteBin link as the Credentials JSON
  4. Test the connector by sending example payload
  5. Confirm results in Network tab. Should look like:
Screenshot 2024-05-22 at 9 09 47 AM
  1. Once you've successfully sent a message, navigate back to the connector edit tab and click the link to the token tracking dashboard
  2. Ensure the dashboard reflects the data you sent in the test

honeyn303 and others added 30 commits April 10, 2024 15:01
@peluja1012 peluja1012 added the ci:cloud-deploy Create or update a Cloud deployment label Jun 3, 2024
@peluja1012
Copy link
Contributor

/ci

Copy link
Contributor

@ersin-erdal ersin-erdal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, everything looks in line with the best practices.

Just not sure about removing .yarnrc, even if it is a must, should it be in this PR?

Copy link
Member

@sphilipse sphilipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting .yarnrc and adding a 147 kilobyte .yarn/releases/yarn-1.22.19.cjs file is definitely wrong, please revert those changes.

If yarn setup changes are needed, this PR is not the right place to do them and that'll require more discussion in a wider forum than just pushing it here.

@honeyn303
Copy link
Contributor Author

Deleting .yarnrc and adding a 147 kilobyte .yarn/releases/yarn-1.22.19.cjs file is definitely wrong, please revert those changes.

If yarn setup changes are needed, this PR is not the right place to do them and that'll require more discussion in a wider forum than just pushing it here.

@sphilipse I have reverted these changes.

@stephmilovic
Copy link
Contributor

buildkite test this

Copy link
Member

@sphilipse sphilipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still significant changes to .yarnrc that shouldn't be there. We should not need to mess with .yarnrc

@honeyn303
Copy link
Contributor Author

There are still significant changes to .yarnrc that shouldn't be there. We should not need to mess with .yarnrc

@sphilipse sure, this is done now

@stephmilovic
Copy link
Contributor

@elasticmachine merge upstream

@stephmilovic
Copy link
Contributor

buildkite test this

@stephmilovic
Copy link
Contributor

buildkite test this

@stephmilovic stephmilovic requested a review from sphilipse June 5, 2024 22:06
@stephmilovic
Copy link
Contributor

buildkite test this

@kibana-ci
Copy link
Collaborator

kibana-ci commented Jun 6, 2024

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
stackConnectors 249 258 +9

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
stackConnectors 533.4KB 560.7KB +27.3KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-npmDll 6.3MB 6.3MB +9.6KB
stackConnectors 51.1KB 52.6KB +1.5KB
total +11.1KB
Unknown metric groups

async chunk count

id before after diff
stackConnectors 82 87 +5

ESLint disabled line counts

id before after diff
stackConnectors 107 113 +6

Total ESLint disabled count

id before after diff
stackConnectors 113 119 +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:cloud-deploy Create or update a Cloud deployment 💝community release_note:enhancement Team:Security Generative AI Security Generative AI v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.