rrg92 / powershai

Powershell + AI
Apache License 2.0
9 stars 1 forks source link

COM Tool Calling Support #5

Open rrg92 opened 1 week ago

rrg92 commented 1 week ago

Implement COM Function Calling support, as suggest by p3nGu1nZz in that discord thread: https://discord.com/channels/879548962464493619/1282446590954569780

many software companies provide these COM files openly on places like github, or distributed along with software which is typical, and sometimes closed for commercial software, orcale for example. you can also make your own COM file for software, but some assembly required. being

# Create a new Word application object
$word = New-Object -ComObject Word.Application

# Make Word visible (optional)
$word.Visible = $true

# Open an existing document
$document = $word.Documents.Open("C:\path\to\your\document.docx")

# Perform some operations, e.g., find and replace text
$find = $word.Selection.Find
$find.Text = "old text"
$find.Replacement.Text = "new text"
$find.Execute([ref]$null, [ref]$null, [ref]$null, [ref]$null, [ref]$null, [ref]$null, [ref]$null, [ref]$null, [ref]$null, [ref]$null, [ref]$null, [ref]$null, [ref]$null, [ref]$null)

# Save the document
$document.SaveAs("C:\path\to\your\new_document.docx")

# Close the document
$document.Close()

# Quit the Word application
$word.Quit()

# Release the COM object
[System.Runtime.InteropServices.Marshal]::ReleaseComObject($word)

most often its a real bore to have to craft these files, and being able to automate these by implementing your service level api for a llm model and scripts like this above are very powerful. in fact i working on building a similar arch in my Tau model that i am working on currently. This is a fantastic way to generate training data, eg, writing scripts to index a plethora of docx and xls and use llm to transform the data into call response format in the appropiate domain and context, anyways powershai could be a nice tool for this

p3nGu1nZz commented 1 week ago

looks good! Thats pretty much what I was trying to get across. I usually end up writing these scripts in ps or bat files which is less than ideal, Codify this process would be rad.