Coder Social home page Coder Social logo

griptape-ai / griptape-core Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 0.0 197 KB

Python framework for LLM middleware tools. Build once, run anywhere: LangChain, ChatGPT Plugins, Fixie.ai, etc.

Home Page: https://griptape.readthedocs.io

License: Apache License 2.0

Python 97.01% Jinja 1.71% Dockerfile 0.56% Makefile 0.71%
ai chatgpt langchain llm ml openai huggingface

griptape-core's Introduction

griptape-core

Tests PyPI Version Docs License Griptape Discord

griptape-core is a Python framework that enables developers to write tools for generative AI middleware once and use it anywhere.

griptape-core is part of griptape, a modular Python framework for integrating data, APIs, tools, memory, and chain of thought reasoning into LLMs.

griptape-core has three core components:

  • Tools: call external APIs, access databases, and run arbitrary code or CLI commands.
  • Executors: run your tools safely in any environment: local, containerized, or serverless in the cloud.
  • Adapters: convert tools into underlying middleware abstractions, such as ChatGPT Plugins, LangChain tools, and Fixie.ai agents.

Documentation

Please refer to Griptape Docs for:

  • Getting started guides.
  • Core concepts and design overviews.
  • Examples.
  • Contribution guidelines.

License

griptape-core is available under the Apache 2.0 License.

griptape-core's People

Contributors

vasinov avatar

Stargazers

Andy Edmonds avatar  avatar Devin Jones avatar Charlie Orford avatar Aodhan Roche avatar Nikolaus Schlemm avatar Nathan Lloyd Ward avatar Kyle Roche avatar  avatar

Watchers

Kyle Roche avatar  avatar Aodhan Roche avatar  avatar

griptape-core's Issues

Check for None type ENV variables in Griptape tools

I'm finding inconsistency in checking for a None value in a method of a griptape tool. The following test script can be used to replicate. When invoking the tool function directly, the None value is checked properly. When passed to the LLM, auth error is received.

import json
from decouple import config
from griptape.core.executors import LocalExecutor
from griptape.tools import WebScraper, Calculator, EmailClient
from skatepark import utils
from skatepark.drivers import OpenAiPromptDriver
from skatepark.memory import PipelineMemory
from skatepark.steps import PromptStep, ToolkitStep
from skatepark.structures import Pipeline
from skatepark.utils import ToolLoader

scraper = WebScraper(
    openai_api_key=config("OPENAI_API_KEY")
)
calculator = Calculator()
email_client = EmailClient(
    smtp_host=config("SMTP_HOST"),
    smtp_port=config("SMTP_PORT"),
    smtp_password=config("SMTP_PASSWORD"),
    smtp_from_email=config("SMTP_FROM_EMAIL"),
    smtp_use_ssl=config("SMTP_USE_SSL", cast=bool),
    imap_url=config("IMAP_URL"),
    imap_user=config("IMAP_USER"),
    password=config("EMAIL_PASSWORD"),
    #imap_password=config("IMAP_PASSWORD"),
    email_max_retrieve_count=config("EMAIL_MAX_RETRIEVE_COUNT", cast=int)
)

pipeline = Pipeline(
    memory=PipelineMemory(),
    prompt_driver=OpenAiPromptDriver(
        model="gpt-4"
    ),
    tool_loader=ToolLoader(
        tools=[calculator, scraper, email_client]
    )
)

pipeline.add_steps(
    ToolkitStep(
        "get emails from my inbox with a subject containing the word test",
        tool_names=[email_client.name]
    )
)
# print(tool_executor.execute(calculator.calculate, b"3*5").decode())
email_test_input = {
    "label": "INBOX",
    "key": "SUBJECT",
    "search_criteria": "test",
    "retrieve_count": 10
}

print(email_client.retrieve(json.dumps(email_test_input).encode()))

pipeline.run()
print(pipeline.memory.runs.pop().output)
#print(utils.Conversation(pipeline.memory.runs.pop().output).to_string())

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.