Skip to content

Commit

Permalink
chore: Include invocation result (#265)
Browse files Browse the repository at this point in the history
- Include invocation result in message endpoint
- Remove `public` from run-configs
  • Loading branch information
johnjcsmith authored Dec 10, 2024
1 parent 24b58d0 commit b4c3add
Show file tree
Hide file tree
Showing 13 changed files with 1,644 additions and 66 deletions.
4 changes: 0 additions & 4 deletions app/app/clusters/[clusterId]/configs/[promptId]/edit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export default function EditPromptTemplate({
initialPrompt?: string;
systemPrompt?: string;
attachedFunctions: string;
public: boolean;
resultSchema?: string;
inputSchema?: string;
}) => {
Expand All @@ -90,7 +89,6 @@ export default function EditPromptTemplate({
systemPrompt:
formData.systemPrompt === "" ? undefined : formData.systemPrompt,
name: formData.name === "" ? undefined : formData.name,
public: formData.public,
resultSchema: formData.resultSchema
? JSON.parse(formData.resultSchema)
: undefined,
Expand Down Expand Up @@ -195,7 +193,6 @@ export default function EditPromptTemplate({
attachedFunctions: version.attachedFunctions,
resultSchema: version.resultSchema,
inputSchema: version.inputSchema,
public: version.public,
});
setSelectedVersion(version.version);
toast.success(
Expand Down Expand Up @@ -231,7 +228,6 @@ export default function EditPromptTemplate({
initialPrompt: promptTemplate.initialPrompt ?? undefined,
systemPrompt: promptTemplate.systemPrompt ?? undefined,
attachedFunctions: promptTemplate.attachedFunctions,
public: promptTemplate.public,
resultSchema: promptTemplate.resultSchema
? promptTemplate.resultSchema
: undefined,
Expand Down
3 changes: 0 additions & 3 deletions app/app/clusters/[clusterId]/configs/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default function NewPromptTemplate({
name: string;
initialPrompt?: string;
systemPrompt?: string;
public: boolean;
attachedFunctions: string;
resultSchema?: string;
inputSchema?: string;
Expand All @@ -41,7 +40,6 @@ export default function NewPromptTemplate({
formData.initialPrompt === "" ? undefined : formData.initialPrompt,
systemPrompt:
formData.systemPrompt === "" ? undefined : formData.systemPrompt,
public: formData.public,
resultSchema: formData.resultSchema
? JSON.parse(formData.resultSchema)
: undefined,
Expand Down Expand Up @@ -94,7 +92,6 @@ export default function NewPromptTemplate({
initialData={{
name: "",
initialPrompt: "",
public: false,
attachedFunctions: [],
}}
onSubmit={handleSubmit}
Expand Down
4 changes: 0 additions & 4 deletions app/client/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,6 @@ export const definition = {
attachedFunctions: z.array(z.string()),
resultSchema: anyObject.nullable(),
inputSchema: anyObject.nullable(),
public: z.boolean(),
createdAt: z.date(),
updatedAt: z.date(),
versions: z.array(
Expand All @@ -1104,7 +1103,6 @@ export const definition = {
attachedFunctions: z.array(z.string()),
resultSchema: anyObject.nullable(),
inputSchema: anyObject.nullable(),
public: z.boolean(),
}),
),
}),
Expand Down Expand Up @@ -1133,7 +1131,6 @@ export const definition = {
attachedFunctions: z.array(z.string()).optional(),
resultSchema: anyObject.optional(),
inputSchema: z.object({}).passthrough().optional().nullable(),
public: z.boolean(),
}),
responses: {
201: z.object({ id: z.string() }),
Expand Down Expand Up @@ -1161,7 +1158,6 @@ export const definition = {
attachedFunctions: z.array(z.string()).optional(),
resultSchema: z.object({}).passthrough().optional().nullable(),
inputSchema: z.object({}).passthrough().optional().nullable(),
public: z.boolean(),
}),
responses: {
200: z.object({
Expand Down
34 changes: 0 additions & 34 deletions app/components/chat/prompt-template-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { Button } from "../ui/button";
import { Input } from "../ui/input";
import { Textarea } from "../ui/textarea";
import { StructuredOutputEditor } from "./structured-output-editor";
import { Switch } from "../ui/switch";
import Link from "next/link";

const formSchema = z.object({
Expand All @@ -27,7 +26,6 @@ const formSchema = z.object({
attachedFunctions: z.string(),
resultSchema: z.string().optional(),
inputSchema: z.string().optional(),
public: z.boolean().default(false),
});

type PromptTemplateFormProps = {
Expand All @@ -38,7 +36,6 @@ type PromptTemplateFormProps = {
attachedFunctions: string[];
resultSchema?: unknown;
inputSchema?: unknown;
public: boolean;
};
onSubmit: (data: z.infer<typeof formSchema>) => Promise<void>;
isLoading: boolean;
Expand All @@ -58,7 +55,6 @@ export function PromptTemplateForm({
attachedFunctions: initialData.attachedFunctions?.join(", "),
resultSchema: JSON.stringify(initialData.resultSchema, null, 2),
inputSchema: JSON.stringify(initialData.inputSchema, null, 2),
public: initialData.public,
},
});

Expand Down Expand Up @@ -252,36 +248,6 @@ export function PromptTemplateForm({
)}
/>
</div>
<FormField
control={form.control}
name="public"
render={({ field }) => (
<FormItem>
<FormLabel>Public (Front end usage)</FormLabel>
<FormDescription>
Should this Run Configuration be avilable for use from front end
applications.
<br />
Please see our{" "}
<Link
href="https://docs.inferable.ai/pages/frontend"
target="_blank"
className="underline"
>
docs
</Link>{" "}
for more information
</FormDescription>
<FormControl>
<Switch
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<Button type="submit" disabled={isLoading}>
{isLoading ? "Saving..." : "Save Run Configuration"}
</Button>
Expand Down
4 changes: 3 additions & 1 deletion app/components/workflow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ export function Run({
})) || [];

const eventElements =
runTimeline?.messages.map((m) => ({
runTimeline?.messages
.filter((m) => ["human", "agent", "template"].includes(m.type))
.map((m) => ({
element: (
<ElementWrapper
mutableId={mutableId}
Expand Down
1 change: 1 addition & 0 deletions control-plane/drizzle/0191_perfect_wasp.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "prompt_templates" DROP COLUMN IF EXISTS "public";
Loading

0 comments on commit b4c3add

Please sign in to comment.