Skip to content

Instantly share code, notes, and snippets.

@roh26it
Created October 19, 2023 14:55
Show Gist options
  • Save roh26it/c7b20efc1b8d62bf652f0867ccf7ae62 to your computer and use it in GitHub Desktop.
Save roh26it/c7b20efc1b8d62bf652f0867ccf7ae62 to your computer and use it in GitHub Desktop.
Anthropic / Portkey
import portkey
from portkey import Config, LLMOptions
portkey.api_key = "<YOUR PORTKEY API KEY>"
llm = LLMOptions(provider="anthropic", virtual_key="<YOUR VIRTUAL KEY>")
portkey.config = Config(llms=[llm], mode="single")
response = portkey.ChatCompletions.create(
model="claude-instant-1.2",
messages=[{"role":"user", "content": "What is the meaning of life, universe & everything?"}],
max_tokens=400
)
print(response.choices[0]["message"]["content"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment