question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I want use `gpt-3.5-turbo` for nlp task

See original GitHub issue

I sometimes use gpt-3.5-turbo for NLP tasks like text-davinci-003. Because it’s cheaper and feels like it performs much better than Curie.

But there are some problems with this. In the current version of python-preview, if I use the chat backend, it forces the template to record the user’s conversation. This increases the number of tokens I use, which is costly. Also, if I’m dealing with long texts, it hits token limit in no time. like example below. image

This can be solved by putting a memorization setting in the PromptTemplateConfig class and modifying the semantic-kernel/python/semantic_kernel/orchestration/sk_function.py, as shown in the photo below. But I didn’t open the PR because I’m not sure if it will match the direction Microsoft is looking at. image

In the same vein, I’d like to see ChatCompletion imported via import_semantic_skill_from_directory the way it’s done in the text-davinci-003. Currently I’m importing skills the following way and it feels unnatural, please let me know if I’m missing something.

def import_skills(
    kernel: sk.Kernel, skill_dir="./skills"
) -> Dict[str, sk.SKFunctionBase]:
    skills = {}

    for skill in os.listdir(skill_dir):
        if skill.endswith("Skill"):
            s = kernel.import_semantic_skill_from_directory(skill_dir, skill)
            skills[skill] = s

    skills["ChatSkills"] = {}
    skills["ChatSkills"][
        "ExtractInformationList"
    ] = extract_information.build_semantic_chat_function(kernel)

    return skills

I think using skprompt.yaml for prompt template instead of skprompt.txt would allow for a much freer use of the model.

Issue Analytics

  • State:closed
  • Created 6 months ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
awharrison-28commented, Apr 26, 2023

@joowon-dm-snu ported, see https://github.com/microsoft/semantic-kernel/pull/643. Will be available with the next version of the pip package

1reaction
dluccommented, Apr 19, 2023

@joowon-dm-snu @tynguyen this is now implemented, pls see the latest nuget 0.12

example: https://github.com/microsoft/semantic-kernel/blob/main/samples/dotnet/kernel-syntax-examples/Example26_SemanticFunctionsUsingChatGPT.cs

IKernel kernel = new KernelBuilder().WithLogger(ConsoleLogger.Log).Build();

// Note: we use Chat Completion and GPT 3.5 Turbo
kernel.Config
    .AddAzureChatCompletionService("id", "gpt-35-turbo", "https://....openai.azure.com/", "...API KEY...");

var func = kernel.CreateSemanticFunction(
    "List the two planets closest to '{{$input}}', excluding moons, using bullet points.");

var result = await func.InvokeAsync("Jupiter");
Console.WriteLine(result);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Beginner's Guide to OpenAI's GPT-3.5-Turbo Model
In this tutorial, we will examine the reasons why it is preferable to use the GPT-3.5-Turbo Model over the previous GPT-3 version.
Read more >
Example Code & Implementation Considerations For GPT 3.5 ...
OpenAI released the API for The LLM gpt-3.5-turbo, which is the same model used in ChatGPT as we all know it. The Whisper...
Read more >
Beginner's Guide to OpenAI's GPT-3.5-Turbo Model
This tutorial explores the advantages of using the GPT-3.5-Turbo Model over other models, including GPT-4. We'll examine the changes that have been made, ......
Read more >
Harnessing the Power of Embeddings to Train GPT-3.5- ...
In this article, we propose a novel approach to leverage the power of embeddings by using Langchain to train GPT-3.5-Turbo on custom data...
Read more >
Chat GPT 3.5 Turbo: The Ultimate Language Model
It is a natural language processing model that can understand and generate text-based responses to a wide range of inputs, including questions, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found