Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide callbacks #4

Open
ggbetz opened this issue Nov 9, 2023 · 0 comments
Open

Provide callbacks #4

ggbetz opened this issue Nov 9, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@ggbetz
Copy link
Contributor

ggbetz commented Nov 9, 2023

Callback for langchain (for example):

from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain

import logikon

# Configure logikon debugger
config = logikon.DebugConfig(report_to=your_mlops_platforms)
lgk_handler = logikon.CallbackHandler(config=config)

# Set up chain and register debugger
llm = OpenAI()
prompt = PromptTemplate(
    input_variables=["question"],
    template="{question} Reason carefully before submitting your choice.",
)
chain = LLMChain(llm=llm, prompt=prompt, callbacks=[lgk_handler])

# Run chain
print(chain.run("Vim or Emacs?", callbacks=[lgk_handler]))
@ggbetz ggbetz added the enhancement New feature or request label Nov 9, 2023
@ggbetz ggbetz mentioned this issue Nov 9, 2023
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant