Giter Site home page Giter Site logo

codeblaze.semantickernel's Issues

method not found exception

hi i am getting method not found exception, can you please help and tell me what i am doing wrong
System.MissingMethodException: 'Method not found: 'System.Collections.Generic.Dictionary`2<System.String,System.Object> Microsoft.SemanticKernel.PromptExecutionSettings.get_ExtensionData()'.'


try
{
    var builder = Kernel.CreateBuilder();

    // provide the HTTP client used to interact with Ollama API
    builder.Services.AddTransient<HttpClient>();

    builder.AddOllamaTextGeneration(
       modelId: "mistral:latest", // Ollama model Id
        baseUrl: "http://127.0.0.1:11434" // Ollama endpoint
    );

    var kernel = builder.Build();
    string prompt = File.ReadAllText("prompt.txt");
    string input = "test";
    var result = await kernel.InvokePromptAsync(prompt, new KernelArguments
{     {"input", input}            });
    string s = result.GetValue<string>();
}
catch (Exception ex)
{

}

prompt.txt

Bot: How can I help you?
User: {{$input}}

---------------------------------------------

The intent of the user in 5 words or less:

i am using .net 8 winform project

GetStreamingChatMessageContentsAsync not working

Hi there,

Thanks so much for the connector.
Please could you describe how to get message streaming working?

I have set up the project accordingly and when attempting to stream i receive an error:

result = chatCompletionService.GetStreamingChatMessageContentsAsync(
history,
executionSettings: _openAIPromptExecutionSettings,
kernel: kernel);

System.Text.Json.JsonException
HResult=0x80131500
Message='{' is invalid after a single JSON value. Expected end of data. Path: $ | LineNumber: 1 | BytePositionInLine: 0.
Source=System.Text.Json
StackTrace:
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo1 jsonTypeInfo, Nullable1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 json, JsonTypeInfo1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at Codeblaze.SemanticKernel.Connectors.Ollama.OllamaChatCompletionService.d__2.MoveNext()
at Codeblaze.SemanticKernel.Connectors.Ollama.OllamaChatCompletionService.d__2.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at xxx.d__2.MoveNext() in xxx
at xxx.d__2.MoveNext() in xxx
at Program.<

$>d__0.MoveNext() in xxxx

This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
JsonReaderException: '{' is invalid after a single JSON value. Expected end of data. LineNumber: 1 | BytePositionInLine: 0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.