Spaces:
Running
Running
Fix loading order issue. Tidier example.
Browse files- server/lynxscribe_ops.py +13 -12
- web/src/NodeWithParams.svelte +2 -2
server/lynxscribe_ops.py
CHANGED
@@ -1,14 +1,15 @@
|
|
1 |
'''An example of passive ops. Just using LynxKite to describe the configuration of a complex system.'''
|
2 |
-
from .ops import register_passive_op, Parameter as P
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
1 |
'''An example of passive ops. Just using LynxKite to describe the configuration of a complex system.'''
|
2 |
+
from .ops import register_passive_op as reg, Parameter as P
|
3 |
|
4 |
+
reg('Scrape documents', inputs={}, params=[P('url', '')])
|
5 |
+
reg('Conversation logs', inputs={})
|
6 |
+
reg('Extract graph')
|
7 |
+
reg('Compute embeddings', params=[P.options('method', ['OpenAI', 'graph', 'Yi-34b']), P('dimensions', 1234)])
|
8 |
+
reg('Vector DB', inputs={'multi': '*'}, params=[P.options('backend', ['FAISS', 'ANN', 'HNSW'])])
|
9 |
+
reg('Chat UI', outputs={})
|
10 |
+
reg('Chat backend', inputs={})
|
11 |
+
reg('WhatsApp', inputs={})
|
12 |
+
reg('PII removal')
|
13 |
+
reg('Intent classification')
|
14 |
+
reg('System prompt', inputs={}, params=[P('prompt', 'You are a helpful chatbot.')])
|
15 |
+
reg('LLM', inputs={'multi': '*'}, params=[P.options('backend', ['GPT-4', 'Yi-34b', 'Claude 3 Opus', 'Google Gemini'])])
|
web/src/NodeWithParams.svelte
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
export let data: $$Props['data'];
|
8 |
const { updateNodeData } = useSvelteFlow();
|
9 |
$: meta = getContext('LynxKiteFlow').getMeta(data.title);
|
10 |
-
$: metaParams = Object.fromEntries(meta.data.params.map((p) => [p.name, p]));
|
11 |
</script>
|
12 |
|
13 |
<LynxKiteNode {...$$props}>
|
@@ -15,7 +15,7 @@
|
|
15 |
<div class="param">
|
16 |
<label>
|
17 |
{name}<br>
|
18 |
-
{#if metaParams[name]
|
19 |
<select
|
20 |
value={value}
|
21 |
on:change={(evt) => updateNodeData(id, { params: { ...data.params, [name]: evt.currentTarget.value } })}
|
|
|
7 |
export let data: $$Props['data'];
|
8 |
const { updateNodeData } = useSvelteFlow();
|
9 |
$: meta = getContext('LynxKiteFlow').getMeta(data.title);
|
10 |
+
$: metaParams = meta && Object.fromEntries(meta.data.params.map((p) => [p.name, p]));
|
11 |
</script>
|
12 |
|
13 |
<LynxKiteNode {...$$props}>
|
|
|
15 |
<div class="param">
|
16 |
<label>
|
17 |
{name}<br>
|
18 |
+
{#if metaParams?.[name]?.type?.enum}
|
19 |
<select
|
20 |
value={value}
|
21 |
on:change={(evt) => updateNodeData(id, { params: { ...data.params, [name]: evt.currentTarget.value } })}
|