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.
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.
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.
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.
Rates with no market reference. Assuming that anyone hiring a freelancer knows market rates is a bet that does not pay off.
Rough descriptions bring mismatched applications. Nothing kept the description, responsibilities and expectations consistent with the skills the project actually needed.




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.





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.
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.
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 }),
}); 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)))
); 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" };
}; 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.
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;
});
} 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
} 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");
}
} 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 }); 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.
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); 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];
}; 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;
}); 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.
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 }> {} 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(),
}); 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)))
)
); 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.
// an LLM generates varied scenarios: personas, edge cases, languages
const scenarios = yield* evaluator.generateDataset({
taskDescription: JOB_OFFER_TASK,
totalScenarios: 30,
generationModel: GENERATION_MODEL,
}); 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 }
); 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; 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.
Let's talk: 30 minutes to see whether an integration makes sense for you.
Book a 30-minute call More case studies