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

Added gpt_action_mongodb_vector.md and modified registry.yaml for Mon… #1424

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

girishd
Copy link
Contributor

@girishd girishd commented Sep 23, 2024

MongoDB Vector Database

Summary

Added in the ability to perform a semantic search in MongoDB Vector Search

Motivation

We were planning to include a cookbook for a vector database like Pinecone. I decided to use MongoDB because it has a larger market share


For new content

When contributing new content, read through our contribution guidelines, and mark the following action items as completed:

  • [Done ] I have added a new entry in registry.yaml (and, optionally, in authors.yaml) so that my content renders on the cookbook website.
  • [Done ] I have conducted a self-review of my content based on the contribution guidelines:
    • [Done ] Relevance: This content is related to building with OpenAI technologies and is useful to others.
    • [Done ] Uniqueness: I have searched for related examples in the OpenAI Cookbook, and verified that my content offers new insights or unique information compared to existing documentation.
    • [ Done] Spelling and Grammar: I have checked for spelling or grammatical mistakes.
    • [ Done] Clarity: I have done a final read-through and verified that my submission is well-organized and easy to understand.
    • [ Done] Correctness: The information I include is correct and all of my code executes successfully.
    • [ Done] Completeness: I have explained everything fully, including all necessary references and citations.

We will rate each of these areas on a scale from 1 to 4, and will only accept contributions that score 3 or higher on all areas. Refer to our contribution guidelines for more details.

Copy link
Contributor

@pap-openai pap-openai left a comment

Choose a reason for hiding this comment

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

added a few comments


### Middleware Function

To create a Google Run Function, follow the steps in the [GCP Functions Action](https://cookbook.openai.com/examples/chatgpt/gpt_actions_library/gpt_middleware_google_cloud_function) cookbook.
Copy link
Contributor

Choose a reason for hiding this comment

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

would rename to "GPT Actions library (Middleware) - Google Cloud Function" (or other providers – we don't require GCP, right?)


## Application Information

### Application Key Links
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we're trying to remove those links or have them as hyperlink in the description to avoid verbosity. The Canvas LMS cookbook as been revamped to show this: https://cookbook.openai.com/examples/chatgpt/gpt_actions_library/gpt_action_canvas / https://github.com/openai/openai-cookbook/blob/main/examples/chatgpt/gpt_actions_library/gpt_action_canvas.md

Your `.env` file should contain the following values

```
OPENAI_API_KEY=
Copy link
Contributor

Choose a reason for hiding this comment

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

could we include example of format (e.g: sk-xxxx) – if useful ?
also can we point on how to actually pass those variables to the function (or at least indicating to set-up those variables in the middleware env) ?


### Create vector index

Ensure that your MongoDB collection has a vector index. Here is an example of how to create one
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a script to run this on the MONGODB_URI or a command line to connect to it?


Below is an example of what connecting to this Middlware might look like. You'll need to insert your application's & function's information in this section.

```javascript
Copy link
Contributor

Choose a reason for hiding this comment

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

this would be ```yaml


### In ChatGPT (refer to Step 2 in the Getting Started Example)

In ChatGPT, click on "Authentication" and choose **"OAuth"**. Enter in the information below.
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't we want to leverage a MongoDB Oauth connection, if possible? https://www.mongodb.com/docs/atlas/security-oidc/

Does it enable all authenticated users to Google (regardless of their directory) to run the function?


### Test the GPT

You are now ready to test out the GPT. You can enter a simple prompt like "I want to watch movies that involve spies and world war" and expect to see the following:
Copy link
Contributor

Choose a reason for hiding this comment

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

I imagine we'd like to load a dataset for this to be able to give that answer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants