Skip to content

Commit

Permalink
Modify readme
Browse files Browse the repository at this point in the history
  • Loading branch information
kathy-t committed Sep 26, 2024
1 parent 46eb3b7 commit 2e6c62e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
34 changes: 27 additions & 7 deletions topicgenerator/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
# Topic Generator

This is a Java program that generates topics for public Dockstore entries using OpenAI's gpt-3.5-turbo-16k AI model.
This is a Java program that generates topics for public Dockstore entries using AI.

The [entries.csv](entries.csv) file contains the TRS ID and default versions of public Dockstore entries to generate topics for. The [results](results) directory contains the generated topics for those entries from running the topic generator.

## Setup

### Configuration file

Create a configuration file like the following. A template `metrics-aggregator.config` file can be found [here](templates/topic-generator.config).
Create a configuration file like the following. A template `topic-generator.config` file can be found [here](templates/topic-generator.config).

```
[dockstore]
server-url: <Dockstore server url>
token: <Dockstore admin or curator token>
[ai]
openai-api-key: <OpenAI API key>
```

**Required:**
Expand All @@ -26,7 +23,26 @@ openai-api-key: <OpenAI API key>
- `https://staging.dockstore.org/api`
- `https://dockstore.org/api`
- `token`: The Dockstore token of an admin or curator. This token is used to upload topics to the webservice.
- `openai-api-key`: The OpenAI API key required for using the OpenAI APIs. See https://platform.openai.com/docs/api-reference/authentication for more details. This is used to generate topics.

### Authentication to invoke AI models

#### AWS Bedrock

By default, the program uses AWS Bedrock to invoke the Anthropic Claude 3 Haiku model to generate topics.
AWS credentials that have permissions to use the AWS Bedrock API are required and they must have access to the Anthropic Claude models on AWS.
There are several ways that this can be provided.
Read [this](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials.html#credentials-chain) for the default credential provider chain.


#### OpenAI (deprecated)

We have moved away from using OpenAI models to generate topics, but if you wish to use it, you need to add the following section to your configuration file.
See https://platform.openai.com/docs/api-reference/authentication for more details.

```
[ai]
openai-api-key: <OpenAI API key>
```

## Running the program

Expand All @@ -49,6 +65,10 @@ Usage: <main class> [options] [command] [command options]
name of the entries to generate topics for. The first line of the
file should contain the CSV fields: trsID,version
Default: ./entries.csv
-m, --model
The AI model to use
Default: CLAUDE_3_HAIKU
Possible Values: [CLAUDE_3_5_SONNET, CLAUDE_3_HAIKU, GPT_4O_MINI]
upload-topics Upload AI topics, generated by the generate-topics
command, for public Dockstore entries.
Expand All @@ -59,7 +79,7 @@ Usage: <main class> [options] [command] [command options]
of the entries to upload topics for. The first line of the file
should contain the CSV fields: trsId,aiTopic. The output file
generated by the generate-topics command can be used as the
argument.
argument.
```

### generate-topics
Expand Down
5 changes: 1 addition & 4 deletions topicgenerator/templates/topic-generator.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This is a template topic generator config file for prod. Modify it for different environments.
[dockstore]
server-url: https://dockstore.org/api
token: YOUR_ADMIN_OR_CURATOR_DOCKSTORE_TOKEN

[ai]
openai-api-key: YOUR_OPENAI_API_KEY
token: YOUR_ADMIN_OR_CURATOR_DOCKSTORE_TOKEN

0 comments on commit 2e6c62e

Please sign in to comment.