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

First draft of AI Query Cards #871

Open
wants to merge 16 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions ai/fine-tuning-v1/and_query.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
prompt: """
How do I check more than one condition?
"""

solution: {
variable
When({Is(condition1) | And | variable2 | Is(condition2)} {
;; DoSomething
ShahFragcolor marked this conversation as resolved.
Show resolved Hide resolved
})
}

explicit: {
variable
ShahFragcolor marked this conversation as resolved.
Show resolved Hide resolved
When(Predicate: {Is(condition1) | And | variable2 | Is(condition2)} Action: {
ShahFragcolor marked this conversation as resolved.
Show resolved Hide resolved
;; DoSomething
})
}

explaination: """
We use When or If shards to create a conditional statement and do an action when the Predicate returns true.
To add more conditions to the Predicate we use the And shard.
"""

tag: "General"
}
20 changes: 20 additions & 0 deletions ai/fine-tuning-v1/appendTo_query.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
prompt: """
How to add a new element to the end of an existing Shards sequence?
"""

solution: {
element | AppendTo(sequence)
}

explicit: {
element | AppendTo(Collection: sequence)
ShahFragcolor marked this conversation as resolved.
Show resolved Hide resolved
}

explaination: """
The AppendTo Shard adds an element to the end of a sequence.
This shard works on both string and sequence variables.
"""

tag: "General"
}
23 changes: 23 additions & 0 deletions ai/fine-tuning-v1/assoc_query.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
prompt: """
How do I replace an element of an existing sequence?
"""

solution: {
[index0 variable1 index1 variable2] | Assoc(sequence)
}

explicit: {
[index0 variable1 index1 variable2] | Assoc(Name: sequence)
}

explaination: """
Here we are replacing element with index 0 in sequence into variable1 and element with index of 1 in sequence to variable2.
The input sequence for Assoc must always contain an even number of elements.
The elements of the input sequence are parsed in pairs.
The 1st element of each pair gives the index of the target element to update, and the 2nd element of that pair gives the new value for the target element.
Assoc can also be used to update a specific key in a table.
"""

tag: "General"
}
21 changes: 21 additions & 0 deletions ai/fine-tuning-v1/clear_query.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
prompt: """
How do i delete all the elements in a sequence.
"""

solution: {
Clear(sequence)
}

explicit: {
Clear(Name: sequence)
}

explaination: """
Clear removes all the elements of the sequence that has been passed to it in the Name: parameter.
This shard works on both sequences and tables.
Use the Key: parameter to delete all elements of the specified key in a table.
"""

tag: "General"
}
21 changes: 21 additions & 0 deletions ai/fine-tuning-v1/const_query.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
prompt: """
How do I create an unassigned constant in Shards.
"""

solution: {
Const(value)
ShahFragcolor marked this conversation as resolved.
Show resolved Hide resolved
}

explicit: {
Const(Value: value)
}

explaination: """
Const declares a constant value (of any data type) by passing it into the parameter :Value.
Such a value is usually declared for use as input in other shards.
A constant value declared with Const is un-named i.e., it is not assigned to any variable or allocated any alias.
"""

tag: "General"
}
20 changes: 20 additions & 0 deletions ai/fine-tuning-v1/count_query.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
prompt: """
How do I get the total number of elements in a sequence?
"""

solution: [{
Count(sequenceToCount)
}]

explicit: [{
Count(Name: sequenceToCount)
}]

explaination: """
Count parses the value passed to it in the :Name parameter, and returns the count of characters, elements, or key-value pairs depending on whether the data type passed to it was a string, a sequence, or a table.
This shard works on both sequences and tables. Parameter :Key applies only to tables.
"""

tag: "General"
}
20 changes: 20 additions & 0 deletions ai/fine-tuning-v1/count_query2.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
prompt: """
How do I count the total number of key and value pairs that a table has ?
"""

solution: [{
Count(tableToCount)
ShahFragcolor marked this conversation as resolved.
Show resolved Hide resolved
}]

explicit: [{
Count(Name: tableToCount)
}]

explaination: """
Count parses the value passed to it in the :Name parameter, and returns the count of characters, elements, or key-value pairs depending on whether the data type passed to it was a string, a sequence, or a table.
This shard works on both sequences and tables. Parameter :Key applies only to tables.
"""

tag: "General"
}
20 changes: 20 additions & 0 deletions ai/fine-tuning-v1/count_query3.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
prompt: """
How do I count the total number of key and value pairs that a table has ?
"""

solution: [{
Count(tableToCount keyToCount)
ShahFragcolor marked this conversation as resolved.
Show resolved Hide resolved
}]

explicit: [{
Count(Name: tableToCount Key: keyToCount)
}]

explaination: """
Count parses the value passed to it in the :Name parameter, and returns the count of characters, elements, or key-value pairs depending on whether the data type passed to it was a string, a sequence, or a table.
This shard works on both sequences and tables. Parameter :Key applies only to tables.
"""

tag: "General"
}
20 changes: 20 additions & 0 deletions ai/fine-tuning-v1/erase_query.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
prompt: """
How do I delete an element in a sequence.
"""

solution: [{
Erase ([indexToDelete] sequenceToDeleteFrom)
ShahFragcolor marked this conversation as resolved.
Show resolved Hide resolved
}]

explicit: [{
Erase (Indices:[indexToDelete] Name:sequenceToDeleteFrom)
}]

explaination: """
Erase deletes single or multiple elements (from sequences) and key-value pairs (from tables).
For a sequence, this shard expects the index (or a sequence of indices in descending order) of the element(s) to be erased, followed by the name of the sequence variable in the :Name parameter.
"""

tag: "General"
}
21 changes: 21 additions & 0 deletions ai/fine-tuning-v1/erase_query2.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
prompt: """
How do I delete multiple elements in a sequence.
"""

solution: [{
Erase ([indexToDelete1 indexToDelete2 indexToDelete3] sequenceToDeleteFrom)
}]

explicit: [{
Erase (Indices:[indexToDelete1 indexToDelete2 indexToDelete3] Name:sequenceToDeleteFrom)
}]

explaination: """
Erase deletes single or multiple elements (from sequences) and key-value pairs (from tables).
For a sequence, this shard expects the index (or a sequence of indices in descending order) of the element(s) to be erased, followed by the name of the sequence variable in the :Name parameter.
To delete more elements, add the more Indeces to the sequence in the Indeces: parameter.
"""

tag: "General"
}
21 changes: 21 additions & 0 deletions ai/fine-tuning-v1/erase_query3.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
prompt: """
How do I delete keys from a table
"""

solution: [{
Erase (["key1" "key2"] sequenceToDeleteFrom)
}]

explicit: [{
Erase (Indices:["key1" "key2"] Name:sequenceToDeleteFrom)
}]

explaination: """
Erase deletes single or multiple elements (from sequences) and key-value pairs (from tables).
For a sequence, this shard expects the index (or a sequence of indices in descending order) of the element(s) to be erased, followed by the name of the sequence variable in the :Name parameter.
To delete more keys, add the more keys to the sequence in the Keys: parameter.
"""

tag: "General"
}
26 changes: 26 additions & 0 deletions ai/fine-tuning-v1/forEach_query.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
prompt: """
How do I do an action for each element in a sequence?
"""

solution: [{
[element1 element2 element3]
| ForEach({
Math.Add(1)
})
}]

explicit: [{
[element1 element2 element3]
| ForEach(Apply:{
Math.Add(1)
})
}]

explaination: """
For each, processes every element or key-value pair of a sequence/table with a given shard or sequence of shards. In the example provided in the solution,
we will add 1 to element1 then element2 and element3.
"""

tag: "General"
}
24 changes: 24 additions & 0 deletions ai/fine-tuning-v1/indexO_query copy.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
prompt: """
How do I find the index number of a specific element in a sequence?
"""

solution: [{
sequence
|IndexOf(itemToFind)
> indexOfItem
}]

explicit: [{
sequence
ShahFragcolor marked this conversation as resolved.
Show resolved Hide resolved
|IndexOf(Item: itemToFind)
Update(Name: indexOfItem)
}]

explaination: """
Index of will take a sequence as an input and search through the sequence until it finds an exact match of the item stated in the Item parameter. Once a match
has been found, it will return the index of the matched item.
"""

tag: "General"
}
22 changes: 22 additions & 0 deletions ai/fine-tuning-v1/is_query.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
prompt: """
How do I check if something equals something else.
"""

solution: [{
variable1
When(Is(variable2) {variable1 | Math.Add(1)})
}]

explicit: [{
variable1
ShahFragcolor marked this conversation as resolved.
Show resolved Hide resolved
When(Predicate:Is(Value: variable2) Action:{variable1 | Math.Add(1)})
}]

explaination: """
The Is Shard when used in the Predicate parameter of a conditional Shard, like When, will check if the input of the conditional shard matches with what is
stated in the Value parameter of the Is shard. In this case, if variable 1 matches variable2, the When Shard will return true.
"""

tag: "General"
}
23 changes: 23 additions & 0 deletions ai/fine-tuning-v1/push_query.shs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
prompt: """
How to add a new element to an existing Shards sequence?
"""

solutions: [{
ShahFragcolor marked this conversation as resolved.
Show resolved Hide resolved
element >> sequence
} {
element | AppendTo(sequence)
}]

explicits: [{
Get(element) | Push(sequence)
} {
element | AppendTo(Collection: sequence)
}]

explaination: """
The Push method is used to add a new element to the end of a sequence.
The Get method is used to get an element from a sequence.
Remember, there might be type issues during composition if a sequence is bound to a certain type.
"""
}
Loading