Skip to content

Commit

Permalink
5007 bug tweaks to model enrichment in create model from equations (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dgauldie authored Oct 8, 2024
1 parent 1b72deb commit 7fc1c8d
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,27 @@
<tr v-for="field in fields" :key="field">
<td class="field">{{ formatField(field) }}</td>
<td v-for="(card, index) in modelCardsToCompare" :key="index">
<template v-if="!card?.[field]"> Not found </template>
<template v-if="!card?.[field]"> N/A </template>
<template v-else-if="Array.isArray(card[field])">
<ul class="bullet-list">
<li class="bullet-list-item" v-for="(item, k) in card[field]" :key="k">{{ item }}</li>
</ul>
</template>
<template v-else-if="typeof card[field] === 'object'">
<template v-for="(value, j) in Object.values(card[field])">
<template v-if="Array.isArray(value)">
{{ value.join(', ') }}
<template v-for="(entry, j) in Object.entries(card[field])" :key="j">
<div class="label">{{ formatField(entry[0]) }}:</div>
<template v-if="Array.isArray(entry[1])">
<ul class="bullet-list">
<li class="bullet-list-item" v-for="(item, k) in entry[1]" :key="k">{{ item }}</li>
</ul>
</template>
<div class="value" v-else>{{ entry[1] }}</div>
<template v-if="j < Object.entries(card[field]).length - 1">
<br />
</template>
<div class="value" v-else :key="j">{{ value }}</div>
</template>
</template>
<template v-else-if="Array.isArray(card[field])">{{ card[field].join(', ') }}</template>
<template v-else>{{ card[field] }}</template>
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -519,4 +530,18 @@ ul {
.legend-line.green::before {
background-color: lightgreen;
}
.label {
font-weight: var(--font-weight-semibold);
}
.bullet-list {
display: block !important;
list-style: disc outside;
margin-left: var(--gap-4);
padding-left: var(--gap-4);
}
.bullet-list-item {
display: list-item !important;
}
</style>
9 changes: 4 additions & 5 deletions packages/gollm/gollm_openai/prompts/model_card.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
INSTRUCTIONS = """
You are a helpful agent designed to populate metadata of a given AMR model.
You may have access to a document that describes the given AMR model and a JSON representation of the AMR model we want populated. Structural information should come from the AMR model.
You may only have access to the model. Do your best to populate the JSON object specified in the response format with as much information as possible.
If you cannot answer the entire query, provide as much information as possible. If there is no answer, populate fields with a null values. Do not leave any fields empty and do not make up information.
You may have access to a document that describes the given AMR model and a JSON representation of the AMR model we want populated.
Do your best to populate the JSON object specified in the response format with as much information as possible.
If you cannot answer the entire query, provide as much information as possible. If there is no answer, populate fields with a blank values. Do not leave any fields empty and do not make up information.
Use the following document as a reference:
Expand All @@ -18,7 +17,7 @@
{amr}
---MODEL END---
Do not respond in full sentences; only create a JSON object that satisfies the JSON schema specified in the response format.
Do not respond in full sentences; only create a JSON object that satisfies the JSON schema specified in the response format. Verify and format your answer against the JSON schema. Do not modify the JSON schema to fit your response.
Answer:
"""
198 changes: 86 additions & 112 deletions packages/gollm/gollm_openai/schemas/model_card.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,50 @@
"type": "object",
"properties": {
"summary": {
"type": "object",
"properties": {
"modelSummary": {
"type": "string",
"description": "A brief description of the system or process."
}
},
"required": [
"modelSummary"
],
"additionalProperties": false
"type": "string",
"description": "A detailed description of the model and how it was used. Summarize all the information extracted from the paper. Mention if it can likely be represented in Petri Net format."
},
"details": {
"specs": {
"type": "object",
"properties": {
"modelDescription": {
"type": "string",
"description": "Describe the structure of the model in the paper, including its places, transitions, and arcs. Mention if it can likely be represented in petrinet format."
"domain": {
"type": "array",
"description": "List of domains the model can be used for.",
"items": {
"type": "string"
}
},
"fundedBy": {
"type": {
"type": "string",
"description": "If applicable, list the funding sources."
"description": "Mathematical Model / Graphical Model / Other"
},
"modelType": {
"specification": {
"type": "string",
"description": "Mathematical / Graphical Model / Other"
"description": "Provide as much detail as possible about the model's structure and complexity. This can include information such as the number of places, transitions, parameter count, and arcs."
},
"states": {
"type": "array",
"description": "A list of state descriptions.",
"items": {
"type": "string",
"description": "A short paragraph describing and summarizing the model state. The paragraph should start with the state name, then a colon, then a description of the state including what units to use for it, and how this state can transition to other states."
}
},
"parameters": {
"type": "array",
"description": "A list of parameter descriptions.",
"items": {
"type": "string",
"description": "A short paragraph describing and summarizing the model parameter. The paragraph should start with the parameter name, then a colon, then a description of the parameter including what units to use for it."
}
}
},
"required": [
"modelDescription",
"fundedBy",
"modelType"
"domain",
"type",
"specification",
"states",
"parameters"
],
"additionalProperties": false
},
Expand All @@ -59,160 +71,122 @@
"biasRisksLimitations": {
"type": "object",
"properties": {
"modelBiasRisksLimitations": {
"biases": {
"type": "string",
"description": "Describe sources of bias and how these biases can affect simulation results of this model."
},
"risks": {
"type": "string",
"description": "Describe sources of risks and how these risks can affect simulation results of this model."
},
"limitations": {
"type": "string",
"description": "Describe sources of bias and risk based on the research paper"
"description": "Describe sources of limitations and how these limitations can affect simulation results of this model."
}
},
"required": [
"modelBiasRisksLimitations"
"biases",
"risks",
"limitations"
],
"additionalProperties": false
},
"testing": {
"type": "object",
"properties": {
"testingDataFactorsMetrics": {
"validation": {
"type": "string",
"description": "Describe how the model was validated, e.g., through simulation, comparison with real-world data, etc."
},
"metrics": {
"type": "string",
"description": "Describe the metrics used to evaluate the model."
}
},
"required": [
"testingDataFactorsMetrics"
"validation",
"metrics"
],
"additionalProperties": false
},
"specs": {
"gettingStarted": {
"type": "object",
"properties": {
"modelSpecs": {
"type": "string",
"description": "Details about the model's complexity, such as the number of places, transitions, parameter count, and arcs."
"steps": {
"type": "array",
"description": "a list of steps to use this model or a list of steps to get started with the model.",
"items": {
"type": "string"
}
},
"examples": {
"type": "array",
"description": "List of examples used in the paper to help users get started with the model.",
"items": {
"type": "string"
}
}
},
"required": [
"modelSpecs"
"steps",
"examples"
],
"additionalProperties": false
},
"glossary": {
"type": "array",
"description": "List of terms used in the paper and their definitions.",
"items": {
"type": "string"
}
},
"authors": {
"type": "array",
"description": "List of authors of the paper.",
"items": {
"type": "string"
}
},
"gettingStarted": {
"type": "object",
"properties": {
"examples": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"examples"
],
"additionalProperties": false
},
"citations": {
"type": "object",
"properties": {
"references": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"references"
],
"additionalProperties": false
"type": "array",
"description": "List of citations used in the paper.",
"items": {
"type": "string"
}
},
"moreInformation": {
"type": "object",
"properties": {
"fundedBy": {
"type": "string",
"description": "If applicable, list the funding sources describe in the paper."
},
"links": {
"type": "array",
"description": "List of links to additional information about the model.",
"items": {
"type": "string"
}
}
},
"required": [
"fundedBy",
"links"
],
"additionalProperties": false
},
"structuralInformation": {
"type": "object",
"properties": {
"schemaName": {
"type": "string"
},
"parameterNames": {
"type": "array",
"items": {
"type": "string"
}
},
"domain": {
"type": "array",
"items": {
"type": "string"
}
},
"modelType": {
"type": "array",
"items": {
"type": "string"
}
},
"modelStructure": {
"type": "array",
"items": {
"type": "string"
}
},
"modelParameters": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"schemaName",
"parameterNames",
"domain",
"modelType",
"modelStructure",
"modelParameters"
],
"additionalProperties": false
}
},
"required": [
"summary",
"details",
"specs",
"uses",
"biasRisksLimitations",
"testing",
"specs",
"gettingStarted",
"glossary",
"authors",
"gettingStarted",
"citations",
"moreInformation",
"structuralInformation"
"moreInformation"
],
"additionalProperties": false
}
4 changes: 2 additions & 2 deletions packages/gollm/gollm_openai/tool_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def model_config_from_document(research_paper: str, amr: str) -> dict:
frequency_penalty=0,
max_tokens=4000,
presence_penalty=0,
seed=905,
seed=123,
temperature=0,
top_p=1,
response_format={
Expand Down Expand Up @@ -271,7 +271,7 @@ def model_card_chain(amr: str, research_paper: str = None) -> dict:
frequency_penalty=0,
max_tokens=16000,
presence_penalty=0,
seed=123,
seed=365,
top_p=1,
response_format={
"type": "json_schema",
Expand Down
Loading

0 comments on commit 7fc1c8d

Please sign in to comment.