Gpt-4-1106-preview edit shortcomings

I just want to check if I’m the only one experiencing gpt-4-1106-preview aka gpt-4 turbo having big issues with edits and even trouble handling letters beyond a-z. I love the speed though. Any inside info on when it’s going stable ;)?

Hi and welcome to the Developer Forum!

Can you post a code snippet of your API calling please, I have never seen an issue with handling letters over a-z. The AI itself only deals with numeric representations of works in the form of tokens, so this seems unlikely, unless there is some ASCII encoding issues somewhere higher up the chain.

It’s primarily when used for edits (formatting). It never happens with gpt-4.

last response:

flutter: decodeArgs: {answer: Nä men t�nka sig, s˚ m�nga ostar! Vi f�r starta en ostklubb och ge det ett f�rs�k. 🧀🔍😆}
flutter: formatResponse: OpenAIChatCompletionModel(id: chatcmpl-xxxxxxxxxxxxxxxxxxxx, created: 2024-01-12 13:06:06.000, choices: [OpenAIChatCompletionChoiceModel(index: 0, message: OpenAIChatCompletionChoiceMessageModel(role: OpenAIChatMessageRole.assistant, content: null, toolCalls: [OpenAIResponseToolCall(id: call_xxxxxxxxxxxxxxxxx type: function,function: OpenAIResponseFunction(name: formatResponse, arguments: {"adjustedSentence":"N\"a men t\"anka sig, s\"a m\"anga ostar! Vi f\"ar starta en ostklubb och ge det ett f\"ors\"ok. \n","translation":"\n"}))], ), finishReason: stop)], usage: OpenAIChatCompletionUsageModel(promptTokens: 216, completionTokens: 50, totalTokens: 266), systemFingerprint: fp_168383a679)
flutter: textmain: N"a men t"anka sig, s"a m"anga ostar! Vi f"ar starta en ostklubb och ge det ett f"ors"ok.

Generated from this call:

 Future<Map<String, dynamic>?> systemFormatResponse({
    required String target,
    required String mainLanguage,
    required String meaning,
    required String word,
    required String secondLanguage,
  }) async {
    List<OpenAIChatCompletionChoiceMessageModel> chatMessages = [];

    chatMessages.add(
      OpenAIChatCompletionChoiceMessageModel(
        content: [
          OpenAIChatCompletionChoiceMessageContentItemModel.text(
            'Responde with adjustments to a sentence.' +
                '\n' +
                'Then translate a sentence.',
          ),
        ],
        role: OpenAIChatMessageRole.system,
      ),
    );

    chatMessages.add(
      OpenAIChatCompletionChoiceMessageModel(
        content: [
          OpenAIChatCompletionChoiceMessageContentItemModel.text(
            'Adjust ```$target``` grammatically if needed (in $mainLanguage).' +
                '\n' +
                'Do not remove well formed normalized emojis.' +
                '\n' +
                'Make sure the adjusted sentences is valid $firstLanguage.}' +
                '\n' +
                '\n' +
                'Translate the adjusted sentence into $secondLanguage.' +
                '\n' +
                'if a form of ```$meaning``` is used in target sentence ($mainLanguage), use the right form of ```$word``` in the translation.' +
                '\n' +
                'Make sure the translation is valid $secondLanguage.}',
          )
        ],
        role: OpenAIChatMessageRole.user,
      ),
    );
    OpenAIChatCompletionModel chatCompletion =
        await OpenAI.instance.chat.create(
      model: openAiModel.gptPreview,
      messages: chatMessages,
      tools: [
        OpenAIToolModel(
          type: Strings.openAIToolTypeFunction,
          function: OpenAIFunctionModel.withParameters(
            name: Strings.openAIFunctionFormatResponse,
            description:
                'Holds adjusted sentence and translation from response',
            parameters: [
              OpenAIFunctionProperty.string(
                name: Strings.openAIParameterAdjestedSentence,
                description: 'the adjusted sentence (in $mainLanguage)',
                isRequired: true,
              ),
              OpenAIFunctionProperty.string(
                name: Strings.openAIParameterTranslation,
                description: 'the translation (in $secondLanguage)',
                isRequired: true,
              ),
            ],
          ),
        )
      ],
      toolChoice: ChatCompletionToolChoiceOption.tool(
        ChatCompletionNamedToolChoice(
          type: ChatCompletionNamedToolChoiceType.function,
          function: ChatCompletionFunctionCallOption(
              name: Strings.openAIFunctionFormatResponse),
        ),
      ),
      n: 1,
      temperature: 0.3,
    );
    debugPrint('formatResponse: ${chatCompletion.toString()}');

    return handleChatCompletion(
        response: chatCompletion,
        functionName: Strings.openAIFunctionFormatResponse);
  }

==================

sorry for bad code markup. couldn’t find what triggers a code window.

The markdown syntax for source code is to bookend the code with ```, e.g.

```
if x = 1 then
   print(Hello)
else
  print(Goodbye)
```

You can select an entire section of code, and use the </> preformatted text button in the forum editor.

The way to manually edit this is to use three backticks (```) on their own lines before and after the monospace code.

You can change the parsing by putting a language (``` ruby) on the first line.

That will help you display a code block. Example.

    for i, item in enumerate(em_dict['data']):
        em_bytes = base64.b64decode(item['embedding'])
        em_ndarray[i] = np.frombuffer(em_bytes, dtype=np.single)
        if not em_ndarray[i].size == 1536:
            raise ValueError

Thanks! I saw the environment solved it for me or was that the moderator?

As a moderator I did two things for your post.

  1. It was flagged as spam by the spam dectector so declined the flag so your post could be posted as expected.
  2. Add the markdown bookends to your code, e.g.
```javascript
if a = b then
```

The model currently has a problem with certain character sets, particularly brought out when employing functions, which I assume is the case here due to the presence of the “decodeArgs” container.

A new AI model is in development to address this.

You have a low temperature, which is good for diagnosis. You also or instead can employ the top_p:0.5 parameter which will prevent more unexpected tokens from entering the mix. It cannot prevent the most likely output being by an AI mistrained on garbage encoding through some error, though.

Thanks for the tip, l’ll be waiting, and sorry if this was asked before