
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
CodeLinker aims to provide functions to link your code with language models. It builds on top of the Pydatic library and Tool Calling abilities introduced by OpenAI, which enabling models to generate content according to Json Schema.
The core concept of this package is to treat language models as a function handler. By defining a schema for return value of the function, we can call the function and let the model generate the return value.
To start with, we need to first define the configuration that will be used during exection:
config = CodeLinkerConfig(api_keys={
"gpt-3.5-turbo-16k":[{
"api_key": "your api key here",
"model": "model name alias here"
}]
})
cl = CodeLinker(config)
Learn more about the configuration in the Configuration page.
Currently, the package support two types of structured generation with language models: Function Definition
and Return Declearation
.
You can define the schema of the return value with pydantic package:
class HelloWorldSchema(BaseModel):
message: str = Field(description="the message to be returned")
Then we can use the cl
object to wrap the function you want to call:
@cl.smartFunc()
def hello_world() -> HelloWorldSchema:
"""Say hello to the world"""
The function's docstring will be passed to models as instruction about what this function should do. Now we can call the function and let the model generate the return value:
result = hello_world()
print(result.message)
# sample output:
# Hello, World!
Other wise, if you do not want to define the function, you can use the exec
method to call the function:
result = await cl.exec(return_type=HelloWorldSchema)
To be noticed, the exec
method is an async method, so you need to use await
to call it.
More details about structured generation can be found in the Structured Generation page.
FAQs
A tool to link the code with large language models.
We found that codelinker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.