Created
January 11, 2025 16:30
-
-
Save cartermp/f37b6702109bbd7401be8a1cab8bdf8d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
//... other imports | |
"go.opentelemetry.io/otel" | |
"go.opentelemetry.io/otel/attribute" | |
"go.opentelemetry.io/otel/trace" | |
) | |
var tracer = otel.Tracer("MyTracerName") | |
//... | |
func fakeMostRelevantColumns(ctx context.Context, prompt string) { | |
ctx, span := tracer.Start(ctx, "queryml.MostRelevantColumns") | |
defer span.End() | |
// get columns | |
fakeCallEmbeddings(ctx) | |
fakeSaveInRedisCache(ctx) | |
// nlq embedding | |
fakeCallEmbeddings(ctx) | |
// columns come after 'COLUMNS:' in prompt and end with a newline | |
// take a slice from there and end it at the newline | |
columns := strings.Split(prompt, "COLUMNS:")[1] | |
columns = strings.Split(columns, "\n")[0] | |
str := "[" + columns + "]" | |
span.SetAttributes( | |
attribute.String("app.nlq.most_relevant_columns", str), | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment