Thinking filter and Formatter Patcher for OpenAI’s GPT OSS models and all other OpenAI models
""" title: OpenAI GPT OSS Think and Formatter Patcher author: Sub0X version: 1.1 """ import re from typing import Optional from pydantic import BaseModel, Field THINK_OPEN = "<think>" THINK_CLOSE = "</think>"
This is a filter that automatically corrects missing backticks (``) to (```) from all OpenAI models and replaces OpenAI’s output from: <|channel|>analysis<|message|>The user hasn't asked anything specific yet. They said "Pretty good". Assistant responded asking what they'd like to talk about: fun, interesting, question, project, random trivia.\n\nWe need to suggest 3-5 follow-up questions the user might ask next as a user. Since they haven't given direction, we can propose plausible user queries: maybe ask for a joke, ask for news summary, request help with a problem, ask for recommendations (books/movies), ask about AI capabilities, or ask something random.\n\nWe need to output JSON array of strings under key "follow_ups". Provide 3-5 suggestions. Let's provide 4.\n\nExamples:\n\n- "Can you tell me a funny joke?"\n- "What's a good movie recommendation for tonight?"\n- "Could you give me a quick summary of today's top tech news?"\n- "I'm working on a Python script to parse CSV files, can you help me with that?"\n\nReturn JSON.<|end|><|start|>assistant<|channel|>final<|message|>
To:
The user hasn't asked anything specific yet. They said "Pretty good". Assistant responded asking what they'd like to talk about: fun, interesting, question, project, random trivia.\n\nWe need to suggest 3-5 follow-up questions the user might ask next as a user. Since they haven't given direction, we can propose plausible user queries: maybe ask for a joke, ask for news summary, request help with a problem, ask for recommendations (books/movies), ask about AI capabilities, or ask something random.\n\nWe need to output JSON array of strings under key "follow_ups". Provide 3-5 suggestions. Let's provide 4.\n\nExamples:\n\n- "Can you tell me a funny joke?"\n- "What's a good movie recommendation for tonight?"\n- "Could you give me a quick summary of today's top tech news?"\n- "I'm working on a Python script to parse CSV files, can you help me with that?"\n\nReturn JSON.
We use optional analytics to improve our websites, and advertising cookies on this site. Privacy Policy.