Real shipped codeTalent platform · SaaSAI integration

Automating a project brief in 3 questions

An interactive chat where the AI interviews you, reads PDFs, images and text files, and walks you through creating the job offer: it suggests a market rate and, in 3 questions, delivers a complete listing ready to publish.

ClientSeVedemo · Talent platform
RoleProduct Engineer
Duration4 weeks
StackExpress · Effect · OpenAI · Sharp · GCS
01 · Context

Fixing how job offers get created.

After we cut profile creation to under 37 seconds and improved its accuracy with the LinkedIn sync, a similar problem remained on the other side of the marketplace. Companies published offers through a 5-step wizard that did little to help them write a complete, consistent listing.

People looking for a professional are not always recruiters, they rarely write job offers, and they do not know the market in depth. The result was vague offers, one-line descriptions and rates detached from the market, which brought few applications, most of them far from the profile they wanted.

02 · Problem

A long form that asked users to take in too much before they could start.

The creation flow was a classic wizard: Project & Role, Rate, Contract, Interview link & preview before publishing. Technically flawless, and of little use to anyone who does not already know what to write. The form validated the fields and left the quality to chance.

1

No guidance on content. The wizard asked for title, category, tags and description, but did nothing to help write them or back them with data.

2

Rates with no market reference. Assuming that anyone hiring a freelancer knows market rates is a bet that does not pay off.

3

Rough descriptions bring mismatched applications. Nothing kept the description, responsibilities and expectations consistent with the skills the project actually needed.

Old flow: choosing the project typeOld flow: form with title, category and free-text descriptionOld flow: contract details and rates with no market referenceOld flow: choosing the ATS for applicationsOld flow: preview of an offer with a one-line description
The old flow: the 5-step wizard that validated fields but did not help fill them in.
03 · Results

Consistent offers, better-matched applications.

3 questions on average to produce a project brief
22% → 96% offers published with a complete description (role, responsibilities, requirements)
+64% applications per offer in the 30 days after release
Before / after the change
Complete description · before
22%
Complete description · after
96%
Time to create · before
~18 min
Time to create · after
~4 min
Applications per offer · before
5
Applications per offer · after
8.2
04 · Solution

An interview in place of a form.

A recruiter does not hand you a form to fill in. They ask questions, read documents, images and CVs, and when something is unclear they help you sort it out.

→

The AI interviews like a recruiter. It infers and extracts title, category, seniority and skills. The strategy is explicit in the prompt: deliver a first draft within 3 exchanges, then collect what is missing, and finally suggest the rate.

→

Up to 10 files: PDFs, images and text. CVs, requirements, project descriptions: PDFs or images are attached straight into the chat, compressed, processed and added to the conversation context.

→

Rates in line with the market. Rates are compared with those of the freelancers on the platform. No number is random: the AI suggests a market range consistent with the role, seniority and required skills.

→

Human in the loop. A second model extracts the structured offer payload from the conversation and updates the preview next to the chat, so every step can be reviewed before publishing.

New flow: the creation chat with the offer preview beside itNew flow: uploading a PDF straight into the messageNew flow: the AI infers profile and skills and asks what is missingNew flow: the chat suggests a market rate rangeNew flow: complete listing generated in preview next to the chatNew flow: reviewing and refining the generated offer before publishing
The new flow: from a brief attached in chat to a complete listing in preview, through to review before publishing.
05 · Under the hood

How our AI recruiter works.

The interface is a Solid.js chat, and the backend is an Express service built with Effect: typed errors, retries with exponential backoff, and every AI call tracked with its cost.

{1}

Two models, two jobs. One model talks with the user; the second summarises, extracts information and flags what is missing so the right questions get asked. Payload extraction uses a mini model with structured output: no fragile parsing, no invented fields.

DeepDive · the two-model service TS
One model handles the conversation
export const createChatStream = (
  messages: ChatMessage[],
  context: ChatContext
): Effect.Effect<AsyncIterable<ChatCompletionChunk>, AiServiceError> =>
  Effect.tryPromise({
    try: () =>
      openai.chat.completions.create({
        model: CHAT_MODEL, // the recruiter persona lives in the system prompt
        messages: [
          { role: "system", content: buildSystemPrompt(context) },
          ...messages,
        ],
        stream: true,
        stream_options: { include_usage: true },
      }),
    catch: (cause) => new AiServiceError({ cause }),
  });
The mini model extracts with strict JSON Schema
export const extractPayload = (
  messages: ChatMessage[],
  context: ChatContext,
  usageContext?: AiUsageContext
): Effect.Effect<AiJobOfferPayload, AiServiceError> =>
  createTrackedChatCompletion(
    {
      model: EXTRACTION_MODEL, // extraction only, no chat
      response_format: {
        type: "json_schema",
        json_schema: {
          name: "job_offer_payload",
          strict: true,
          schema: aiJobOfferPayloadJsonSchema,
        },
      },
      messages: [
        { role: "system", content: buildExtractionSystemPrompt(context) },
        ...messages,
      ],
    },
    { usageContext, callKind: AI_USAGE_CALL_KINDS.EXTRACTION }
  ).pipe(
    Effect.mapError((cause) => new AiServiceError({ cause })),
    Effect.map((res) => resolveRatePayload(parsePayload(res)))
  );
The rate is normalised before it reaches the form
const resolveRatePayload = (raw: AiJobOfferPayload): AiJobOfferPayload => {
  if (raw.payment_type === "fixed") {
    return { ...raw, rate_min: null, rate_max: null, rate_unit: null };
  }

  validateJobOfferRate({
    daily_rate_min: raw.rate_min ?? null,
    daily_rate_max: raw.rate_max ?? null,
    payment_type: "daily",
  });

  return { ...raw, payment_type: "daily", rate_unit: "daily" };
};
{2}

Attachments: compression, parsing and temporary storage. File type is decided by magic bytes, never by the extension. Images are compressed with Sharp at decreasing quality until they fit the budget, and PDFs become images page by page via Poppler. Everything goes through temporary storage on GCS and is deleted when the process ends or is interrupted.

DeepDive · the file pipeline TS
Orchestration, one Effect per step
export function validateAndAssemble(message: string, files: StoredFile[]) {
  return Effect.gen(function* () {
    const processed = yield* processFiles(files); // Sharp for images, Poppler for PDFs
    const blocks = assembleContentBlocks(message, processed);
    yield* validateImageBlocksBeforeSend(blocks); // nothing over the limit reaches the model
    return blocks;
  });
}
Magic bytes decide the type
export function detectFileType(buffer: Buffer): DetectedFileType | null {
  if (buffer[0] === 0x25 && buffer[1] === 0x50 && buffer[2] === 0x44 && buffer[3] === 0x46) {
    return { category: "pdf", mimeType: "application/pdf" }; // %PDF
  }
  if (buffer[0] === 0x89 && buffer[1] === 0x50 && buffer[2] === 0x4e && buffer[3] === 0x47) {
    return { category: "image", mimeType: "image/png" };
  }
  if (buffer[0] === 0xff && buffer[1] === 0xd8 && buffer[2] === 0xff) {
    return { category: "image", mimeType: "image/jpeg" };
  }
  return null; // the declared extension counts for nothing
}
Sharp lowers quality until it fits the budget
const JPEG_QUALITIES = [80, 60, 40, 20] as const;

for (const quality of JPEG_QUALITIES) {
  const compressed = await sharp(buffer)
    .resize(width, height, { fit: "inside", withoutEnlargement: true })
    .jpeg({ quality })
    .toBuffer();

  if (compressed.length <= IMAGE_TARGET_RAW_SIZE) {
    return buildImageBlock(compressed, "jpeg");
  }
}
Temporary storage on GCS
export function storeFile(userId: string, file: UploadedFile) {
  return Effect.tryPromise({
    try: async () => {
      const fileId = crypto.randomUUID();
      await bucket.file(buildGcsPath(userId, fileId)).save(file.buffer, {
        metadata: { contentType: file.detectedType.mimeType /* ... */ },
      });
      return fileId; // the client only gets the id, never the file
    },
    catch: (cause) => new GcsStoreError({ operation: "upload", cause }),
  });
}

export const downloadFiles = (fileIds: string[], userId: string) =>
  Effect.all(fileIds.map((id) => downloadFile(id, userId)), { concurrency: 3 });
{3}

Automatic context compaction. Every conversation has an estimated token budget. Past the threshold the history is compacted: the first and last messages stay, a summary replaces the rest, and old attachments are removed. Context bloat is the fastest way to degrade both quality and cost.

DeepDive · compaction TS
The budget is estimated before calling the model
export const TOKEN_BUDGET = 8000;

export const estimateTokens = (messages: ChatMessage[]): number =>
  messages.reduce((acc, m) => {
    if (typeof m.content === "string") {
      return acc + Math.ceil(m.content.length / 4);
    }
    return acc + m.content.reduce(
      (sum, part) =>
        part.type === "text" ? sum + Math.ceil(part.text.length / 4) : sum + 250,
      0
    );
  }, 0);
First and last messages stay, with a bridge in between
const MAX_MESSAGES_FOR_API = 10;
const ALWAYS_KEEP_FIRST = 2;

export const trimMessagesForChat = (messages: ChatMessage[]): ChatMessage[] => {
  if (messages.length <= MAX_MESSAGES_FOR_API) return messages;

  const first = messages.slice(0, ALWAYS_KEEP_FIRST);
  const recent = messages.slice(-(MAX_MESSAGES_FOR_API - ALWAYS_KEEP_FIRST));
  const bridge: ChatMessage = {
    role: "user",
    content: "[Messaggi precedenti omessi per brevità. Le informazioni raccolte finora sono già riflesse nei messaggi successivi.]",
  };

  return [...first, bridge, ...recent];
};
Old attachments leave the context
export const stripOldFileContent = (messages: ChatMessage[]): ChatMessage[] =>
  messages.map((msg, i) => {
    if (i === messages.length - 1) return msg; // the last one keeps its attachments
    if (Array.isArray(msg.content)) {
      const textPart = msg.content.find((p) => p.type === "text");
      return { ...msg, content: textPart?.text ?? "" };
    }
    return msg;
  });
{4}

Explicit guardrails. Off-topic requests are redirected through a three-level escalation, instructions hidden in attached files are ignored by design, and hard limits on messages and size keep huge files and runaway costs in check.

DeepDive · limits and retries TS
Typed errors in place of strings
import { Data } from "effect";

export class AiServiceError extends Data.TaggedError("AiServiceError")<{
  cause?: unknown;
}> {}

export class TokenBudgetExceededError extends Data.TaggedError(
  "TokenBudgetExceededError"
)<{ cause?: unknown }> {}

export class DbError extends Data.TaggedError("DbError")<{ cause?: unknown }> {}
Hard limits validated with Zod before touching the model
export const aiJobOfferChatRequestSchema = z.object({
  messages: z.array(chatMessageSchema).min(1).max(50),
  file_ids: z.array(z.string().uuid()).max(10).optional().default([]),
  visibility: z.enum(visibilityEnum),
  company_id: z.string(),
});
Retries with exponential backoff
Effect.tryPromise({
  try: () => openai.chat.completions.create(params),
  catch: (cause) => new AiServiceError({ cause }),
}).pipe(
  // two extra attempts, 500ms then 1s: a network blip never becomes a user error
  Effect.retry(
    Schedule.exponential("500 millis").pipe(Schedule.intersect(Schedule.recurs(2)))
  )
);
06 · The extra mile

Evaluation pipelines, and plenty of them.

Each model has its own prompt and relies on tools shared with other parts of the product. To avoid regressions, every change to a prompt or a tool goes through an evaluation pipeline: it generates 30 different scenarios and runs them, a model grader scores them and compares the result with the previous one, and if the score drops past the pass threshold the release is blocked. All automatic, all in CI/CD.

DeepDive · the evaluation pipeline TS
1 · The dataset generates itself
// an LLM generates varied scenarios: personas, edge cases, languages
const scenarios = yield* evaluator.generateDataset({
  taskDescription: JOB_OFFER_TASK,
  totalScenarios: 30,
  generationModel: GENERATION_MODEL,
});
2 · Each scenario runs and a judge model scores it
const results = yield* Effect.all(
  scenarios.map((scenario) =>
    Effect.gen(function* () {
      const input = extractInput(scenario);
      const output = yield* runPromptFn(input);
      const grade = yield* grader.grade(input, output, scenario);
      return { scenario, input, output, grade };
    })
  ),
  { concurrency: 3 }
);
3 · Pass rate and blocking criteria
const passThreshold = options.passThreshold ?? 7; // below 7 does not pass
const passRate =
  (scores.filter((s) => s >= passThreshold).length / scores.length) * 100;

// blocking criteria override the score: if violated, the run is red
const mandatoryCriteria = grader.getMandatoryCriteria();
const mandatoryViolationCount = results.filter((r) =>
  r.grade.violations.some((v) => mandatoryCriteria.includes(v))
).length;
07 · Challenges

Handling different formats and content without losing the conversation.

Everything becomes an image. It sounds counterintuitive, but we chose to convert files and PDFs into images and run them through incremental compression. This way the model never has to parse a PDF or DOCX: it reads the images like screenshots and never loses the context of the conversation.

08 · Before / After

What actually changed.

Before
Offers with a complete description 22%
  • 5-step wizard, ~18 minutes to publish
  • One-line descriptions accepted with no guidance
  • Rates set by gut feeling, often off-market
  • Few applications, poorly matched
After
Offers with a complete description 96%
  • A chat interview that wraps up in 3 questions
  • Complete listing generated: role, responsibilities, requirements
  • Rate range suggested from market data
  • PDFs and briefs attached in chat, live preview, one-click publishing

Want to bring AI into your product?

Let's talk: 30 minutes to see whether an integration makes sense for you.

Book a 30-minute call   More case studies
Free review of your product.  Book 30 minutes →