Fireworks AI
Generates texts using Fireworks AI API.
FireworksAIClient
Bases: BatchClient
Source code in dactyl_generation/fireworks_generation.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
__init__(fireworks_api_key, account_id)
Constructor for Fireworks AI Client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fireworks_api_key
|
str
|
Fireworks API key. |
required |
account_id
|
str
|
Account to use. |
required |
Source code in dactyl_generation/fireworks_generation.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
create_batch_job(batch_id, model, prompts_path, input_dataset_id, output_dataset_id, inference_parameters)
Creates a batch job for Fireworks AI Client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch_id
|
str
|
Name of batch job. |
required |
model
|
str
|
Fireworks model. |
required |
prompts_path
|
str
|
JSONL path to prompts to upload. |
required |
input_dataset_id
|
str
|
Input dataset name for prompts. |
required |
output_dataset_id
|
str
|
Output dataset name for generations. |
required |
inference_parameters
|
dict
|
Additional inference parameters. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
batch_dict |
dict
|
Dictionary containing batch information if successful. |
Source code in dactyl_generation/fireworks_generation.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
create_dataset(jsonl_path, dataset_id, example_count)
Creates and uploads a dataset to the Fireworks AI datasets endpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jsonl_path
|
str
|
Path to local dataset of prompts. |
required |
dataset_id
|
str
|
Name of dataset to upload as |
required |
example_count
|
int
|
number of prompts in dataset |
required |
Returns:
Source code in dactyl_generation/fireworks_generation.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
get_batch_job_output(file_path)
Fetches batch job results given JSON path to object generated from create_batch_job function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
File path to JSON object from |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dataframe |
DataFrame
|
Pandas dataframe containing generations. |
Source code in dactyl_generation/fireworks_generation.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |