Giter Club home page Giter Club logo

forge.openai's People

Contributors

anothercodetrader avatar jzo001 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

forge.openai's Issues

ThreadsService and others missing OpenAI-Beta=assistants=v1 http header

This line appears in AssistantService:

_apiHttpService.DefaultRequestHeaders.Add("OpenAI-Beta", "assistants=v1");

based on the curl examples on the OpenAi web site, such as https://platform.openai.com/docs/api-reference/threads it appears that the following services also need this line: ThreadsService, MessageService, RunService and RunStepService.

I suspect that this missing line is the cause of me seeing this error message while trying to call RunSvc.CreateThreadAndRunAsync(runRequest).Result

{
"error": {
"type": "invalid_request_error",
"code": "unknown_url",
"message": "Unknown request URL: POST /threads/runs. Please check the URL for typos, or see the docs at https://platform.openai.com/docs/api-reference/.",
"param": null
}
}

String Constants for Assistants API

This is a feature request.

It would be great if Forge.OpenAI had string constants defined for:

  1. RunResponse.Status . They are documented here: https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps It would also be nice to have a method "IsTerminalState" that takes a state and returns true if the state is "expired", "completed", "failed" or "cancelled".
  2. Message.Role - there are "system", "user" and "assistant".

This request is similar to what is already in place for Content.CONTENT_TYPE_XXXX

Feel free to close this request if it's out of scope.

Please add these Models "gpt-4-turbo" and "gpt-4-turbo-2024-04-09" in KnownModelTypes

Please add below models
"gpt-4-turbo"
"gpt-4-turbo-2024-04-09" in KnownModelTypes

i got htis email from openAI and they are now recommending
"We recommend developers using GPT-4 Turbo switch to calling gpt-4-turbo rather than gpt-4-turbo-preview or gpt-4-vision-preview. You can try the new GPT-4 Turbo model"

Hi there,

We’ve released an improved GPT-4 Turbo model, gpt-4-turbo-2024-04-09, and it is now generally available (GA) in the API under the gpt-4-turbo alias.

This model now supports vision, where the model can “see” and interpret the content of images. Additionally, vision requests can now use function calling and JSON mode.

This model is better at math, logical reasoning, and coding. Our open-source GitHub repo shows detailed eval results comparing this new model to previous model versions (e.g. gpt-4-0125-preview) and other models. Plus, you can use the code to run these evals yourself. Here’s a preview:

This model also writes in a more natural style, for example:

The last version had knowledge up until April 2023. This new model has knowledge up until December 2023. (Note: knowledge between April and December 2023 may have some inaccuracies.)

We recommend developers using GPT-4 Turbo switch to calling gpt-4-turbo rather than gpt-4-turbo-preview or gpt-4-vision-preview. You can try the new GPT-4 Turbo model in the playground.

If you have questions, reach out in the OpenAI developer forum. For the latest updates, follow @OpenAIDevs on X.

Happy building!
—The OpenAI team

RunService and RunStepService members not being initialized in the 2nd constructor of OpenAIService

In the 2nd constructor of OpenAIService, the one with this signature:

public OpenAIService(OpenAIOptions options, IApiHttpService apiHttpService, IProviderEndpointService providerEndpointService)

the RunService and RunStepService members are not being initialized and they remain null. Looks like maybe Zoltan forgot to add initialization for these two members when he added it to the first constructor?

Does not work on .net 46

Due to dependencies to System.Numerics, the library does not work with old .net 46, but only with .net Core - at least in my case.

br Andy

Assistant API

Hi there,

I see that you have examples for using the service with assistant APIs. Are you still working on it or can you create a release?

Cheers

Support for Azure Open AI

Hi there,

I'm attempting to swap over to Azure Open AI and have come up against two problems.

  1. the example here seems incomplete. It appears we have to provide the BaseAddress and AzureApiVersion. Is this correct?

  2. A bigger issue seems to be how you are handling AuthenticationInfo

public AuthenticationInfo(string apiKey)
        {
            if (string.IsNullOrWhiteSpace(apiKey)) throw new ArgumentNullException(nameof(apiKey));

            if (!apiKey.Contains("sk-"))
            {
                throw new ArgumentException($"{apiKey} parameter must start with 'sk-'");
            }

            ApiKey = apiKey;
        }

As far as I'm aware Azure does not prefix their API keys with sk-. Without adding the "sk-" I'm getting argument exception and if I add "sk-" to my Azure key I'm getting a 404. Are you able to provide some guidance.

Cheers
-Rob

Problems using tools/function (ChatToolFunction) with Parameters as a string

In your framework you have added "parameters" in the ChatToolFunction as a string. I cannot get it to work with just adding JSON in this string.

It is defined as as "object" in the documentation:
https://platform.openai.com/docs/api-reference/chat/create#chat-create-tools

This probably needs to be an object with the settings possible, like type, properties and required. Properties as its own object - with something dynamic because names like emotion and language are specific for this case.

When I create my own full JSON payload like below, where parameters is a normal object with no " around the parameters content, it works.
{
"tools": [
{
"type": "function",
"function": {
"description": "Classify the relevant information from the phrase.",
"name": "getinformation",
"parameters": {
"type": "object",
"properties": {
"emotion": {
"type": "string",
"description": "The emotion of the phrase."
},
"language": {
"type": "string",
"description": "The language of the phrase."
}
},
"required": [
"emotion",
"language"
]
}
}
}
]
}

Errormessage example:
{
"error": {
"message": ""{'type': 'object', 'properties': {'language': {'type': 'string','description': 'The language of the phrase.' }}}" is not of type 'object' - 'tools.0.function.parameters'",
"type": "invalid_request_error",
"param": null,
"code": null
}
}

Providing OpenAIOptions not really works

I want to create a differeny OpenAIService per key. Here's what I tried:

  1. I can use static OpenAIService.CreateService and provide options. This works but generally ServiceProvider should be disposed. Therefore I'm left with hanging undisposed instance of a container. This is an issue on it's own.

  2. I can use AddForgeOpenAIAsTransient in my root container and after call:

     IOpenAIService CreateService(OpenAIOptions options, IServiceProvider serviceProvider, IProviderEndpointService providerEndpointService)
    

This function gives me the impression that I can really provide OpenAIOptions but in reality each service resolves on it's own IApiHttpService that ends up with default IProviderEndpointService with default options inside.

Specifically this code is copypasted in many services:

        _apiHttpService = serviceProvider.GetRequiredService<IApiHttpService>();
        _providerEndpointService = providerEndpointService;

But it's actually wrong because provided providerEndpointService is not passed to _apiHttpService

  1. It doesn't matter what function I call to register services OpenAIProviderEndpointService is registered as singleton. Therefore it is shared and you can't really have different options in one app. Ok you can call a function from step 2. creating this service with options as constructor parameter but that still leaves IApiHttpService out of the box.

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.