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

[Question]: Do you plan to integrate AWS Bedrock at some point? #308

Closed
roberttodor opened this issue Apr 10, 2024 · 2 comments
Closed

[Question]: Do you plan to integrate AWS Bedrock at some point? #308

roberttodor opened this issue Apr 10, 2024 · 2 comments
Labels

Comments

@roberttodor
Copy link

roberttodor commented Apr 10, 2024

It would be great to have AWS LLM integrated into your platform

@roberttodor roberttodor added the question Further information is requested label Apr 10, 2024
@JinHai-CN
Copy link
Contributor

Yes, I added this requirement to the roadmap.

@KevinHuSh KevinHuSh added Feature and removed question Further information is requested labels Apr 11, 2024
@Umpire2018
Copy link

In AWS Bedrock, The different model providers have individual request and response formats. Reference: here

  • Anthropic Claude
enclosed_prompt = "Human: " + prompt + "\n\nAssistant:"

body = {
    "prompt": enclosed_prompt,
    "max_tokens_to_sample": 200,
    "temperature": 0.5,
    "stop_sequences": ["\n\nHuman:"],
}

response = self.bedrock_runtime_client.invoke_model(
    modelId="anthropic.claude-v2", body=json.dumps(body)
)

response_body = json.loads(response["body"].read())
completion = response_body["completion"]

return completion
  • Mistral 7B
# Mistral instruct models provide optimal results when
# embedding the prompt into the following template:
instruction = f"<s>[INST] {prompt} [/INST]"

model_id = "mistral.mistral-7b-instruct-v0:2"

body = {
    "prompt": instruction,
    "max_tokens": 200,
    "temperature": 0.5,
}

response = self.bedrock_runtime_client.invoke_model(
    modelId=model_id, body=json.dumps(body)
)

response_body = json.loads(response["body"].read())
outputs = response_body.get("outputs")

completions = [output["text"] for output in outputs]

return completions

In my opinion, it is beneficial to leverage other widely-used frameworks to achieve multi-model support, which can free up resources for related work.

import os
from litellm import completion

os.environ["AWS_ACCESS_KEY_ID"] = ""
os.environ["AWS_SECRET_ACCESS_KEY"] = ""
os.environ["AWS_REGION_NAME"] = ""

response = completion(
  model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
  messages=[{ "content": "Hello, how are you?","role": "user"}]
)
from llama_index.llms.bedrock import Bedrock

llm = Bedrock(
    model="amazon.titan-text-express-v1",
    aws_access_key_id="AWS Access Key ID to use",
    aws_secret_access_key="AWS Secret Access Key to use",
    aws_session_token="AWS Session Token to use",
    aws_region_name="AWS Region to use, eg. us-east-1",
)

resp = llm.complete("Paul Graham is ")

@JinHai-CN JinHai-CN mentioned this issue Apr 15, 2024
27 tasks
@JinHai-CN JinHai-CN mentioned this issue May 10, 2024
20 tasks
KevinHuSh added a commit that referenced this issue Jul 8, 2024
### What problem does this PR solve?

#308 

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: KevinHuSh <[email protected]>
KevinHuSh pushed a commit that referenced this issue Jul 8, 2024
### What problem does this PR solve?

update Minimax and Azure-Openai  icon in setting page
#1156 #308 #433

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: Zhedong Cen <[email protected]>
cike8899 added a commit to cike8899/ragflow that referenced this issue Jul 19, 2024
KevinHuSh pushed a commit that referenced this issue Jul 19, 2024
### What problem does this PR solve?

feat: support AWS Bedrock #308
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
Halfknow pushed a commit to Halfknow/ragflow that referenced this issue Nov 11, 2024
### What problem does this PR solve?

infiniflow#308 

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: KevinHuSh <[email protected]>
Halfknow pushed a commit to Halfknow/ragflow that referenced this issue Nov 11, 2024
### What problem does this PR solve?

update Minimax and Azure-Openai  icon in setting page
infiniflow#1156 infiniflow#308 infiniflow#433

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: Zhedong Cen <[email protected]>
Halfknow pushed a commit to Halfknow/ragflow that referenced this issue Nov 11, 2024
### What problem does this PR solve?

feat: support AWS Bedrock infiniflow#308
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants