Skip to content

Commit

Permalink
Update name
Browse files Browse the repository at this point in the history
  • Loading branch information
DennizSvens committed Nov 11, 2024
1 parent 765ce5c commit 4ca632b
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 50 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# LLMExcel
# LLM add-in for Excel

LLMExcel is a free, open-source Excel add-in that allows you to use GPT and Anthropic AI models directly within Excel spreadsheets.
LLM add-in for Excel is a free, open-source Excel add-in that allows you to use GPT and Anthropic AI models directly within Excel spreadsheets.

## Features

Expand Down Expand Up @@ -47,7 +47,7 @@ For more detailed information on available models:

## Contributing

We welcome contributions to LLMExcel! As an open-source project, we appreciate any help, from bug reports to feature additions. Here's how you can contribute:
We welcome contributions to LLM add-in for Excel! As an open-source project, we appreciate any help, from bug reports to feature additions. Here's how you can contribute:

1. Fork the repository
2. Create a new branch for your feature or bug fix
Expand All @@ -62,4 +62,4 @@ This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) fi

## About

LLMExcel is developed and maintained by [Liminity AB](https://liminity.se).
LLM add-in for Excel is developed and maintained by [Liminity AB](https://liminity.se).
8 changes: 4 additions & 4 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Support for LLMExcel
# Support for LLM add-in for Excel

## How to Get Help

If you're experiencing issues with LLMExcel or have questions about its usage, we're here to help. Here are the best ways to get support:
If you're experiencing issues with LLM add-in for Excel or have questions about its usage, we're here to help. Here are the best ways to get support:

1. **GitHub Issues**: For bug reports and feature requests, please use our [GitHub Issues](https://github.com/liminityab/llmexcel/issues) page. Before creating a new issue, please search existing issues to avoid duplicates.

Expand All @@ -14,8 +14,8 @@ If you're experiencing issues with LLMExcel or have questions about its usage, w

## Reporting Security Vulnerabilities

If you discover a security vulnerability within LLMExcel, please send an email to [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.
If you discover a security vulnerability within LLM add-in for Excel, please send an email to [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.

## Support Policy

LLMExcel is an open-source project maintained by Liminity AB. While we strive to provide timely support and address issues, please understand that our resources are limited. We prioritize critical bugs and security issues.
LLM add-in for Excel is an open-source project maintained by Liminity AB. While we strive to provide timely support and address issues, please understand that our resources are limited. We prioritize critical bugs and security issues.
21 changes: 21 additions & 0 deletions excel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Define the Excel add-in cache directories
CACHE_DIRS=(
"$HOME/Library/Containers/com.microsoft.Excel/Data/Library/Caches/Microsoft/Office/16.0/Wef/"
"$HOME/Library/Containers/com.microsoft.Excel/Data/Library/Application Support/Microsoft/Office/16.0/Wef/"
)

echo "Clearing Excel add-in cache..."

for DIR in "${CACHE_DIRS[@]}"; do
if [ -d "$DIR" ]; then
echo "Clearing cache in $DIR"
rm -rf "$DIR"/*
else
echo "Directory not found: $DIR"
fi
done

echo "Excel add-in cache cleared."
echo "Please restart Excel for the changes to take effect."
14 changes: 7 additions & 7 deletions manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
<Id>3b8923b8-6b7c-4b50-bf7e-1bd1844528d7</Id>
<Version>1.0.0.2</Version>
<ProviderName>LLMExcel</ProviderName>
<ProviderName>Liminity AB</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="LLMExcel"/>
<Description DefaultValue="LLMExcel is a free, open-source Excel add-in that allows you to use GPT and Anthropic AI models directly within Excel spreadsheets. "/>
<DisplayName DefaultValue="LLM add-in for Excel"/>
<Description DefaultValue="LLM add-in for Excel is a free, open-source Excel add-in that allows you to use GPT and Anthropic AI models directly within Excel spreadsheets. "/>
<IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-64.png"/>
<SupportUrl DefaultValue="https://www.liminity.se/"/>
Expand Down Expand Up @@ -96,13 +96,13 @@
</bt:Urls>
<bt:ShortStrings>
<bt:String id="Functions.Namespace" DefaultValue="LLMExcel"/>
<bt:String id="GetStarted.Title" DefaultValue="Get started with LLMExcel"/>
<bt:String id="GetStarted.Title" DefaultValue="Get started with LLM add-in for Excel"/>
<bt:String id="CommandsGroup.Label" DefaultValue="AI Tools"/>
<bt:String id="TaskpaneButton.Label" DefaultValue="Open LLMExcel"/>
<bt:String id="TaskpaneButton.Label" DefaultValue="Open LLM add-in for Excel"/>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="GetStarted.Description" DefaultValue="Your LLMExcel add-in loaded successfully. Go to the HOME tab and click the 'Open LLMExcel' button to get started."/>
<bt:String id="TaskpaneButton.Tooltip" DefaultValue="Click to open LLMExcel"/>
<bt:String id="GetStarted.Description" DefaultValue="Your LLM add-in for Excel loaded successfully. Go to the HOME tab and click the 'Open LLM add-in for Excel' button to get started."/>
<bt:String id="TaskpaneButton.Tooltip" DefaultValue="Click to open LLM add-in for Excel"/>
</bt:LongStrings>
</Resources>
</VersionOverrides>
Expand Down
2 changes: 1 addition & 1 deletion src/commands/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
function action(event: Office.AddinCommands.Event) {
const message: Office.NotificationMessageDetails = {
type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,
message: "LLMExcel is ready.",
message: "LLM add-in for Excel is ready.",
icon: "Icon.80x80",
persistent: true,
};
Expand Down
97 changes: 67 additions & 30 deletions src/functions/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ function createAIClient(provider: Provider, apiKey: string): AIClient {
/**
* Generates a response based on the given prompt using the specified AI model and provider.
* @customfunction PROMPT
* @param message The prompt message to send to the AI.
* @helpUrl https://llmexcel.liminity.se/help
* @param message The prompt message to send to the AI. a
* @param model The AI model to use for generating the response.
* @param apiKey The API key for the AI service.
* @param systemPrompt An optional system prompt to provide context for the AI.
Expand All @@ -112,23 +113,38 @@ export async function prompt(
throw new Error("Missing required parameters");
}

const client = createAIClient(provider as Provider, apiKey);
if (!["openai", "anthropic"].includes(provider.toLowerCase())) {
throw new Error("Invalid provider. Must be 'openai' or 'anthropic'");
}

const client = createAIClient(provider.toLowerCase() as Provider, apiKey);
const messages: Message[] = systemPrompt
? [
{ role: "system", content: systemPrompt },
{ role: "user", content: message },
]
: [{ role: "user", content: message }];
return await client.generateCompletion(messages, model);

const response = await client.generateCompletion(messages, model);
if (!response) {
throw new Error("Empty response from AI provider");
}
return response;
} catch (error) {
console.error("Error in prompt function:", error);
return `Error: ${error.message}`;
if (error instanceof Error) {
return `Error: ${error.message}`;
} else {
return "An unexpected error occurred";
}
}
}

/**
* Generates a streaming response based on the given prompt using the specified AI model and provider.
* @customfunction PROMPT_STREAM
* @streaming
* @helpUrl https://llmexcel.liminity.se/help
* @param message The prompt message to send to the AI.
* @param model The AI model to use for generating the response.
* @param apiKey The API key for the AI service.
Expand All @@ -144,32 +160,53 @@ export function promptStream(
provider: string,
invocation: CustomFunctions.StreamingInvocation<string>
): void {
if (!message || !model || !apiKey || !provider) {
invocation.setResult("Error: Missing required parameters");
return;
}
try {
if (!message || !model || !apiKey || !provider) {
throw new Error("Missing required parameters");
}

const client = createAIClient(provider as Provider, apiKey);
let fullResponse = "";

const messages: Message[] = systemPrompt
? [
{ role: "system", content: systemPrompt },
{ role: "user", content: message },
]
: [{ role: "user", content: message }];

client
.generateStreamingCompletion(messages, model, (chunk) => {
fullResponse += chunk;
invocation.setResult(fullResponse);
})
.catch((error) => {
console.error("Error in promptStream function:", error);
invocation.setResult(`Error: ${error.message}`);
});
if (!["openai", "anthropic"].includes(provider.toLowerCase())) {
throw new Error("Invalid provider. Must be 'openai' or 'anthropic'");
}

const client = createAIClient(provider.toLowerCase() as Provider, apiKey);
let fullResponse = "";

invocation.onCanceled = () => {
// Handle cancellation if needed
};
const messages: Message[] = systemPrompt
? [
{ role: "system", content: systemPrompt },
{ role: "user", content: message },
]
: [{ role: "user", content: message }];

client
.generateStreamingCompletion(messages, model, (chunk) => {
fullResponse += chunk;
invocation.setResult(fullResponse);
})
.then(() => {
if (!fullResponse) {
throw new Error("Empty response from AI provider");
}
})
.catch((error) => {
console.error("Error in promptStream function:", error);
if (error instanceof Error) {
invocation.setResult(`Error: ${error.message}`);
} else {
invocation.setResult("An unexpected error occurred");
}
});

invocation.onCanceled = () => {
console.log("Stream cancelled by user");
};
} catch (error) {
console.error("Error in promptStream function setup:", error);
if (error instanceof Error) {
invocation.setResult(`Error: ${error.message}`);
} else {
invocation.setResult("An unexpected error occurred");
}
}
}
8 changes: 4 additions & 4 deletions src/taskpane/taskpane.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LLMExcel</title>
<title>LLM add-in for Excel</title>
<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js"></script>
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/11.0.0/css/fabric.min.css"/>
<link href="taskpane.css" rel="stylesheet" type="text/css" />
Expand All @@ -14,15 +14,15 @@
<body class="ms-font-m ms-welcome ms-Fabric">
<div id="container">
<header class="ms-welcome__header">
<img class="ms-logo" src="https://llmexcel.liminity.se/assets/icon.svg" alt="LLMExcel" title="LLMExcel" />
<h1 class="ms-font-su">LLMExcel</h1>
<img class="ms-logo" src="https://llmexcel.liminity.se/assets/icon.svg" alt="LLM add-in for Excel" title="LLM add-in for Excel" />
<h1 class="ms-font-su">LLM add-in for Excel</h1>
<p class="ms-font-l">Powered by <a href="https://liminity.se" target="_blank">Liminity AB</a></p>
</header>

<main class="ms-welcome__main">
<section class="ms-welcome__features">
<h2 class="ms-font-xl">About</h2>
<p class="ms-font-m">LLMExcel is a free, open-source Excel add-in for using GPT and Anthropic inside Excel.</p>
<p class="ms-font-m">LLM add-in for Excel is a free, open-source Excel add-in for using GPT and Anthropic inside Excel.</p>

</section>
<!-- ... existing code ... -->
Expand Down

0 comments on commit 4ca632b

Please sign in to comment.