Comments (4)
Section: Generative API examples
Given the function name and behavior:
{
"actions": [
{
"component": "device",
"action": "save-custom-mode",
"parameter": "study-mode",
"commands": [
{
"component": "app",
"action": "disable-notifications",
"parameters": "",
},
{
"component": "device",
"action": "set-volume",
"parameters": "0",
},
{"component": "call", "action": "block-all", "parameters": ""},
{"component": "text", "action": "block-all", "parameters": ""},
{
"component": "call",
"action": "unblock",
"parameters": "555-555-5555",
},
{
"component": "text",
"action": "unblock",
"parameters": "555-555-5555",
},
],
}
]
}
text-davinci-003 generated:
# Candidate 1:
def save_custom_mode(modes):
for mode in modes['study-mode']:
if mode['action'] == 'disable-notifications':
disable_notifications(mode['component'])
elif mode['action'] == 'set-volume':
set_volume(mode['component'], mode['parameters'])
elif mode['action'] in ['block-all', 'unblock']:
manage_block(mode['component'], mode['action'], mode['parameters'])
# Candidate 2:
def save_custom_mode(mode_data):
# Parse mode data
mode_config = mode_data['study-mode']
# Iterate over mode data
for config in mode_config:
# Retrieve parameters
component = config['component']
action = config['action']
parameters = config['parameters']
# Execute action for component
if component == 'app':
if action == 'disable-notifications':
# Disable notifications
pass
elif component == 'device':
if action == 'set-volume':
# Set the device volume
pass
elif component == 'call':
if action == 'block-all':
# Block all incoming calls
pass
elif action == 'unblock':
# Unblock specific incoming call
pass
elif component == 'text':
if action == 'block-all':
# Block all incoming texts
pass
elif action == 'unblock':
# Unblock specific incoming text
pass
# Candidate 3:
def save_custom_mode(study_mode):
mode_list = eval(study_mode)
for mode in mode_list:
component = mode['component']
action = mode['action']
parameters = mode['parameters']
# Perform logic to save components and parameters
from smart.
Section: Generative API examples
Given the function name and behavior:
{
"actions": [
{
"component": "device",
"action": "save-custom-mode",
"parameter": "study-mode",
"commands": [
{
"component": "app",
"action": "disable-notifications",
"parameters": "",
},
{
"component": "device",
"action": "set-volume",
"parameters": "0",
},
{"component": "call", "action": "block-all", "parameters": ""},
{"component": "text", "action": "block-all", "parameters": ""},
{
"component": "call",
"action": "unblock",
"parameters": "555-555-5555",
},
{
"component": "text",
"action": "unblock",
"parameters": "555-555-5555",
},
],
}
]
}
claude-instant-v1 generated:
# Candidate 1:
def save_custom_mode({'study-mode': "[{'component': 'app', 'action': 'disable-notifications', 'parameters': ''}, {'component': 'device', 'action': 'set-volume', 'parameters': '0'}, {'component': 'call', 'action': 'block-all', 'parameters': ''}, {'component': 'text', 'action': 'block-all', 'parameters': ''}, {'component': 'call', 'action': 'unblock', 'parameters': '555-555-5555'}, {'component': 'text', 'action': 'unblock', 'parameters': '555-555-5555'}]"}):
pass
# Candidate 2:
def save_custom_mode(study_mode):
pass
# Candidate 3:
def save_custom_mode({'study-mode': "[{'component': 'app', 'action': 'disable-notifications', 'parameters': ''}, {'component': 'device', 'action': 'set-volume', 'parameters': '0'}, {'component': 'call', 'action': 'block-all', 'parameters': ''}, {'component': 'text', 'action': 'block-all', 'parameters': ''}, {'component': 'call', 'action': 'unblock', 'parameters': '555-555-5555'}, {'component': 'text', 'action': 'unblock', 'parameters': '555-555-5555'}]"}):
pass
from smart.
Mention that to give the model greater context, the entire repo could be given to the model before deployment. The model can then use that context and the current input for generating code at run-time.
from smart.
"[Metaprogramming] ... enables expressing anticipated variability in a domain explicitly" - page 10 of Meta-programming and Model-Driven Meta-program Development
from smart.
Related Issues (20)
- [DevOps] Pip installable
- [DevOps] Logging HOT 1
- [LLM] Integrate Cohere
- [Metaprogramming] Unit test + demo generative functions for Generative APIs HOT 1
- [Docs] Make a docs page HOT 1
- [Metaprogramming] _is_generative
- [LLM] Check syntax of generated code
- [LLM] Semantic Checker HOT 1
- [Paper] Add table with APIs
- [DevOps] Add mypy
- [Paper] Find code repair benchmarks HOT 1
- [Metaprogramming] Metapython LLM
- [Paper] STRIDE diagram and table
- [Documentation] Github CITATION file
- [Mojo] Mojo support
- [LLM] Rebuff - detect prompt injection HOT 1
- [Metaprogramming] Allow metaclasses to access database
- [Metaprogramming] Color stack_trace
- [Security] OpenSSF HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smart.