Skip to content

.Net: Bug: When using ChatCompletionAgent and the locally deployed llama3.2:3b model, the user's Chinese question became garbled in the function call parameters. #12103

Closed
@yong-zhang-newtera

Description

@yong-zhang-newtera

Describe the bug
Framework: Microsoft Semantic Kernel 1.49.0

I am testing ChatCompletionAgent with a locally deployed llama3.2:3b to query a knowledge base with data in Chinese via a text search plugin. When a user asks a question in Chinese, the agent can invoke the text search plugin, but with a garbled Chinese text, causing the search to fail. Please see the screenshot below:

Screenshots

Image

I attach part of my code below:

        kernelBuilder.Services.AddOllamaChatCompletion(
                modelId: LLMConfig.Instance.ConfigModel.ModelId,
                endpoint: new Uri(LLMConfig.Instance.ConfigModel.ApiEndpoint)
            );
    var textEmbeddingGeneration = vectorStoreFixture.TextEmbeddingGenerationService;
        var vectorSearch = vectorStoreFixture.VectorStoreRecordCollection;
        var customVectorSearch = new CustomVectorSearch(vectorSearch, threshold);

        // Create a text search instance using the InMemory vector store.
        var textSearch = new VectorStoreTextSearch<VectorRecordModel>(
            customVectorSearch,
            textEmbeddingGeneration);

        var searchPlugin = KernelPluginFactory.CreateFromFunctions(
            pluginName, description,
            [textSearch.CreateGetTextSearchResults(searchOptions: searchOptions)]);

        kernel.Plugins.Add(searchPlugin);

       var kernel = kernelBuilder.Build();
       ChatCompletionAgent faqAgent =
           new()
           {
               Name = "SearchFAQAgent",
               Instructions = LLMConfig.Instance.ConfigModel.Instructions,
               Kernel = kernel,
               Arguments =
                   new KernelArguments(new OllamaPromptExecutionSettings()
                   {
                       FunctionChoiceBehavior = FunctionChoiceBehavior.Auto()
                   })
           };

`

Platform

  • Language: [C#]
  • AI model: [llama3.2:3b]
  • IDE: [Visual Studio]
  • OS: [Windows]

Metadata

Metadata

Labels

.NETIssue or Pull requests regarding .NET codebugSomething isn't workingneeds more infoAny issue that is requires more information from contributors

Type

Projects

Status

Sprint: Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions