Default codebot language

Hi,

It seems like it defaults to c# ? I created a new codebot window and looked up “Amazon.SecretsManager.Extensions.Caching.SecretsManagerCache example”

The code shown is c#

If I then asked what some oxygene code does and repeat the search it continues with oxygene. Its also a bit different

Amazon.SecretsManager.Extensions.Caching.SecretsManagerCache is a caching layer on top of AWS Secrets Manager that enables faster, cached access to secrets stored in AWS Secrets Manager.

Here's an example of how to use SecretsManagerCache:

var cacheOptions = new SecretsManagerCacheOptions
{
    CacheItemTTL = TimeSpan.FromMinutes(5),
    RefreshBeforeExpiration = TimeSpan.FromMinutes(1)
};

var cache = new SecretsManagerCache(cacheOptions);

var awsCredentials = new BasicAWSCredentials("awsAccessKey", "awsSecretKey");
var awsOptions = new AmazonSecretsManagerCacheOptions
{
    Region = RegionEndpoint.USWest2,
    Credentials = awsCredentials,
    Cache = cache
};

var config = new AmazonSecretsManagerConfig
{
    Cache = cache
};

var secrets = new AmazonSecretsManagerClient(awsOptions);

var secretValue = secrets.GetSecretStringAsync("MySecretName").Result;
Copy

In this example, we first create a new SecretsManagerCache instance with CacheItemTTL set to 5 minutes and RefreshBeforeExpiration set to 1 minute.

Next, we create an AmazonSecretsManagerClient instance with our AWS credentials, region, and SecretsManagerCache instance. We also set the Cache property of the AmazonSecretsManagerConfig to our SecretsManagerCache instance.

Finally, we call GetSecretStringAsync with the name of the secret we want to retrieve. The result is the value of the secret as a string. The value will be retrieved from the cache if it exists, and refreshed from AWS Secrets Manager if it has expired.

compared to the same question with oxygene

Here's an example of how to use Amazon.SecretsManager.Extensions.Caching.SecretsManagerCache:

First, add the Amazon.SecretsManager.Extensions.Caching NuGet package to your project.
Import the necessary namespaces:
uses
  Amazon.SecretsManager;
  Amazon.SecretsManager.Extensions.Caching;
Copy

Create an instance of an IAWSCredentialsFactory object and a RegionEndpoint object.
var factory: IAWSCredentialsFactory := new MyAWSCredentialsFactory();
var endpoint: RegionEndpoint := RegionEndpoint.USEast1;
Copy

Create an instance of the AWSCachedSecret class, passing in the factory and endpoint objects.
var cachedSecret: AWSCachedSecret := new AWSCachedSecret(factory, endpoint);
Copy

Call the GetSecretAsync method on the cachedSecret object, passing in the secret name:
var secretValue := await cachedSecret.GetSecretAsync('MySecretName').ConfigureAwait(false);
Copy

This will return the string value of the secret stored in AWS Secrets Manager with the name 'MySecretName'. The method call will be cached, which means future calls to GetSecretAsync with the same secret name will use the cached value rather than making another request to Secrets Manager.

Is there a reason for that ?

Cheers,
John

I’d need more context. The generated prompt includes the language (and platform) of your current course file, when invoked from the editor.

if you just type a prompt on your own w/o context in a new Chat, the context is whatever you gave it, so you’d have to specify what language you want to know about, as even Fire cant know what language you want to know about. I suppose I could include some hints for the selected default language set for Fire…

I don’t have a context of even an “active project” in the standalone CodeBot window (you could have 17 solutions open, using 4 different languages; the CodeBot window isn’t logically tied to one of them)

Who knows :joy:. Remember GPT is not actually sentient and understands what you’re asking. i don’t know (probably no-one does) at what level it puts together the knowledge about language syntax (oxygene vs C#) vs the knowledge about the APis it uses (maybe C# vs training data using the langauges/versions of the APIs).

It would also just be different due to randomization — you won’t get the exact same response when if asking for the SAME language (or the exact same prompt, even), every time.

Im opening it using the keyboard because I just want to ask it a question. I can make the question specific like “Amazon.SecretsManager.Extensions.Caching.SecretsManagerCache oxygene example” but I would prefer it defaulted to something other than c# since I just have the single language.

Okay.i’ll add the default language to the prompt. I am surprised it defaults to c#, though — but that might just be random. Out of curiosity, can you share a concrete prompt that you used that got you a c# answer?


Update hmm, I added “If no other programing langauge is specified, please use RemObjects Oxygene.” to the system message (where there language name is dynamic bse don the set default language. But GTP seems to ignore it when I ask

how do i use Amazon.SecretsManager.Extensions.Caching.SecretsManagerCache

I’m guessing that when asking about “known” APIs, it prefers to assume you’re using the language the API was created in/for. I don’t wanna add the default language the the prompt itself, because I’m afraid this will interfere when when the user does explicitly types a langauge name, and it’d be worse of you, say, as,

how do i use Amazon.SecretsManager.Extensions.Caching.SecretsManagerCache in Swift

and get an Oxygene response, suddenly.

I did read that GTP 3.5 does not adhere too strictly to the system message but that supposedly GTP 4 is better at that, so :crossed_fingers:t3: that maybe this will improve if/when we can switch to GTP 4 as an option (I’m still on there waiting list for API access).