reasoning-machines / prompt-lib Goto Github PK
View Code? Open in Web Editor NEWA set of utilities for running few-shot prompting experiments on large-language models
License: MIT License
A set of utilities for running few-shot prompting experiments on large-language models
License: MIT License
Add details of using --cached_timestamp
for inference.
I was running through notebooks/QueryOpenAI.ipynb and I get the following error during from prompt_lib.backends import openai_api
:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
[/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/QueryOpenAI.ipynb](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/QueryOpenAI.ipynb) Cell 5 line 1
----> [1](vscode-notebook-cell:/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/QueryOpenAI.ipynb#W4sZmlsZQ%3D%3D?line=0) from prompt_lib.backends import openai_api
File [~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/openai_api.py:11](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/openai_api.py:11)
[9](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/openai_api.py:9) from prompt_lib.backends.wrapper import BaseAPIWrapper
[10](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/openai_api.py:10) from prompt_lib.backends.self_hosted import OpenSourceAPIWrapper
---> [11](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/openai_api.py:11) from prompt_lib.backends.anthropic_api import AnthropicAPIWrapper
[13](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/openai_api.py:13) openai.api_key = os.getenv("OPENAI_API_KEY")
[15](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/openai_api.py:15) # check if orgainization is set
File [~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/anthropic_api.py:11](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/anthropic_api.py:11)
[8](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/anthropic_api.py:8) from prompt_lib.backends.wrapper import BaseAPIWrapper
[10](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/anthropic_api.py:10) ANTHROPIC_API_KEY = os.environ.get("ANTHROPIC_API_KEY", "Your_Default_Value")
---> [11](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/anthropic_api.py:11) client = anthropic.Client(ANTHROPIC_API_KEY)
[14](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/anthropic_api.py:14) class AnthropicAPIWrapper(BaseAPIWrapper):
[15](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/anthropic_api.py:15) @staticmethod
[16](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/anthropic_api.py:16) def _call_api(
[17](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/anthropic_api.py:17) prompt: str,
ref='~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/anthropic_api.py:0'>0</a>;32m (...)
[22](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/anthropic_api.py:22) num_completions: int = 1,
[23](https://file+.vscode-resource.vscode-cdn.net/Users/drnic/workspace/aiagents/self-refine/prompt-lib/notebooks/~/workspace/aiagents/self-refine/prompt-lib/prompt_lib/backends/anthropic_api.py:23) ) -> dict:
TypeError: Anthropic.__init__() takes 1 positional argument but 2 were given
Users should be able to switch between completely different backends (alpa/openai) with a parameter.
Currently the completion wrapper always returns the top 1 solution. Add an option to get the top n answers from the OpenAI API.
Allow formatting functions to be used for creating a prompt dynamically. Currently, prompts are created either by reading from a file or by using prefixes for question/answer. This excludes use cases like https://github.com/reasoning-machines/CoCoGen
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.